This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] print a more useful error message for "gdb core"


Hi Doug,

On Thu, 21 Jan 2010 00:56:05 +0100, Doug Evans wrote:
> --- exec.c	19 Jan 2010 09:47:47 -0000	1.95
> +++ exec.c	20 Jan 2010 23:50:10 -0000
> @@ -253,6 +253,13 @@ exec_file_attach (char *filename, int fr
>        scratch_pathname = xstrdup (scratch_pathname);
>        cleanups = make_cleanup (xfree, scratch_pathname);
>  
> +      /* If the user accidentally did "gdb core", print a more useful
> +	 error message.  */
> +      if (bfd_check_format (exec_bfd, bfd_core))
> +	error (_("\"%s\" is a core file.\n"
> +		 "Please specify an executable to debug."),
> +		 scratch_pathname);
> +
>        if (!bfd_check_format (exec_bfd, bfd_object))
>  	{
>  	  /* Make sure to close exec_bfd, or else "run" might try to use


this patch has a regression with --enable-targets=all with i386-unknown-linux
gnu native host as at least the attached i386 .so file gets identified as
"trad-core" (and it gets no longer identified as bfd_object afterwards).

One should try the bfd_core variant only if bfd_object has already failed.


Regards,
Jan

Attachment: trad-core.so.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]