Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] print error message if (auto) disassembly failed
Date: Thu, 16 Apr 2009 23:57:00 -0000	[thread overview]
Message-ID: <20090416235735.GO7585@adacore.com> (raw)
In-Reply-To: <83vdp4jn6j.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

> OK, but your suggested message text is too long, I think.  Something
> shorter, like "(address unreadable)" is better, IMO.

Frankly, I think this is overkill - even with the 64bit addresses
the line was still less than 70 characters long. But I'm not going
to argue. Here you go:

    (gdb) core core
    warning: core file may not match specified executable file.
    Core was generated by `./crash'.
    Program terminated with signal 6, Aborted.
    #0  0x00007fe6fe543307 in ?? ()
    0x00007fe6fe543307:     (cannot read memory)

2009-04-17  Joel Brobecker  <brobecker@adacore.com>

        * stack.c (do_gdb_disassembly): Print an error message if an error
        was thrown while trying to perform the disassembly.

I'm currently testing this patch on x86_64-linux, but I don't really
expect any problem.

-- 
Joel

[-- Attachment #2: stack.diff --]
[-- Type: text/x-diff, Size: 1128 bytes --]

commit de33df66fc64edf55aa81a7d08adccf911aa4fdf
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Tue Apr 14 15:23:25 2009 -0700

        * stack.c (do_gdb_disassembly): Print an error message if an error
        was thrown while trying to perform the disassembly.

diff --git a/gdb/stack.c b/gdb/stack.c
index dfe3900..bbeff2c 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -507,6 +507,21 @@ do_gdb_disassembly (int how_many, CORE_ADDR low, CORE_ADDR high)
     {
       gdb_disassembly_stub (&args);
     }
+  /* If an exception was thrown while doing the disassembly, print
+     the error message, to give the user a clue of what happened.  */
+  if (exception.reason == RETURN_ERROR)
+    {
+      if (exception.error == MEMORY_ERROR)
+	{
+	  /* For memory errors, prefer a short error message over
+	     the error message provided in the exception.  */
+	  gdb_flush (gdb_stdout);
+	  gdb_flush (gdb_stderr);
+	  fprintf_filtered (gdb_stderr, _("(cannot read memory)\n"));
+	}
+      else
+	exception_print (gdb_stderr, exception);
+    }
 }
 
 /* Print information about frame FRAME.  The output is format according

  parent reply	other threads:[~2009-04-16 23:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-16 17:39 Joel Brobecker
2009-04-16 17:52 ` Eli Zaretskii
2009-04-16 18:02   ` Joel Brobecker
2009-04-16 18:16     ` Eli Zaretskii
2009-04-16 19:07       ` Joel Brobecker
2009-04-16 21:37         ` Eli Zaretskii
2009-04-16 21:54           ` Joel Brobecker
2009-04-16 22:09             ` Pedro Alves
2009-04-17  9:10             ` Eli Zaretskii
2009-04-16 23:57           ` Joel Brobecker [this message]
2009-04-17  7:33             ` Hui Zhu
2009-04-17  9:22             ` Eli Zaretskii
2009-04-17 15:50               ` Joel Brobecker
2009-04-17 17:34             ` Daniel Jacobowitz
2009-04-17 22:16               ` Joel Brobecker
2009-04-18  6:48                 ` Eli Zaretskii
2009-04-16 22:23 ` Tom Tromey
2009-04-16 23:59   ` Joel Brobecker
2009-04-17  5:33     ` Hui Zhu
2009-04-17 15:57       ` Joel Brobecker
2009-04-17 16:16         ` Tom Tromey
2009-04-17 16:59         ` Hui Zhu
2009-04-17  9:23     ` Eli Zaretskii
2009-04-17 10:05       ` Eli Zaretskii
2009-04-23 18:49 ` Joel Brobecker

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=20090416235735.GO7585@adacore.com \
    --to=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --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