From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: RFC: finish_command_continuation and errors
Date: Thu, 18 Mar 2010 17:07:00 -0000 [thread overview]
Message-ID: <m3bpel36f9.fsf@fleche.redhat.com> (raw)
I'd appreciate comments on this patch, particularly from Pedro.
While debugging a gcj-compiled program yesterday, I got this error while
trying to re-run:
Cannot insert breakpoint 0.
Error accessing memory address 0x3e1dc5: Input/output error.
Looking at "maint info b" showed:
(gdb) maint info b
Num Type Disp Enb Address What
0 finish keep y 0x003ea395 ../../../../../trunk/libjava/classpath/tools/gnu/classpath/tools/javah/Main.java:414 inf 1 thread 1
stop only in thread 1
This can happen if gdb calls error while printing the return value.
In this case, the finish breakpoint is never deleted.
This patch fixes the problem by wrapping the call to print_return_value
in a TRY_CATCH. Other fixes are possible, but I chose this one because
it is small and occurs at the point in the code that must be
exception-safe.
Built and regtested on x86-64 (compile farm).
I also tried it again on my test case, provoked the error, and used
"maint info b" to verify that the finish breakpoint was deleted.
I also glanced at the other continuation functions in infcmd.c, but none
of them appeared to have a similar problem.
Tom
2010-03-18 Tom Tromey <tromey@redhat.com>
* infcmd.c (finish_command_continuation): Wrap print_return_value
in TRY_CATCH.
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.259
diff -u -r1.259 infcmd.c
--- infcmd.c 16 Feb 2010 21:18:46 -0000 1.259
+++ infcmd.c 18 Mar 2010 17:00:51 -0000
@@ -1420,7 +1420,19 @@
_("finish_command: function has no target type"));
if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
- print_return_value (SYMBOL_TYPE (a->function), value_type);
+ {
+ volatile struct gdb_exception ex;
+
+ TRY_CATCH (ex, RETURN_MASK_ALL)
+ {
+ /* print_return_value can throw an exception in some
+ circumstances. We need to catch this so that we still
+ delete the breakpoint. */
+ print_return_value (SYMBOL_TYPE (a->function), value_type);
+ }
+ if (ex.reason < 0)
+ exception_print (gdb_stdout, ex);
+ }
}
/* We suppress normal call of normal_stop observer and do it here so
next reply other threads:[~2010-03-18 17:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-18 17:07 Tom Tromey [this message]
2010-03-18 17:35 ` Pedro Alves
2010-03-18 17:59 ` Tom Tromey
2010-03-18 18:08 ` Joel Brobecker
2010-03-18 18:14 ` Pedro Alves
2010-03-18 18:22 ` Tom Tromey
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=m3bpel36f9.fsf@fleche.redhat.com \
--to=tromey@redhat.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