From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [patch] print a more useful error message for "gdb core"
Date: Wed, 20 Jan 2010 23:56:00 -0000 [thread overview]
Message-ID: <20100120235605.607D284413@ruffy.mtv.corp.google.com> (raw)
Hi.
If the user accidentally does "gdb core" gdb currently prints:
"/foo/bar": not in executable format: File format not recognized
This patch prints a more useful error message for this particular case:
"/foo/bar" is a core file.
Please specify an executable to debug.
I will check this in in a few days if there are no objections.
2010-01-20 Doug Evans <dje@google.com>
* exec.c (exec_file_attach): Print a more useful error message if the
user did "gdb core".
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.95
diff -u -p -r1.95 exec.c
--- 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
next reply other threads:[~2010-01-20 23:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 23:56 Doug Evans [this message]
2010-01-21 0:13 ` Doug Evans
2010-01-21 2:33 ` Hui Zhu
2010-01-21 13:58 ` Jan Kratochvil
2010-01-21 16:34 ` Tom Tromey
2010-01-21 17:17 ` Doug Evans
2010-01-25 4:22 ` Jan Kratochvil
2010-01-28 21:37 ` Jan Kratochvil
2010-01-28 21:39 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100120235605.607D284413@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox