From: Phil Muldoon <pmuldoon@redhat.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [patch] Add cleanup branch for std::terminate breakpoints in call_function_by_hand
Date: Thu, 01 Oct 2009 16:05:00 -0000 [thread overview]
Message-ID: <4AC4D353.3010605@redhat.com> (raw)
This patches fixes a breakpoint leak that may occur when an inferior
function call is performed within a C++ executable. It adds a do_cleanup
call at one of the function exit entry points. (call_function_by_hand
can exit in several different scenarios, depending on the result of the
inferior call).
I decided to place a condition around the do_cleanup over a null_cleanup
just to save endless null_cleanup calls when the inferior is a C
executable (the cleanup is never needed there, as the breakpoint is not
set).
Apologies for introducing this bug a few months back, and finding and
fixing it during this busy (release) time!
I tested this on x86_64 with no regressions.
Regards
Phil
ChangeLog
2009-10-01 Phil Muldoon <pmuldoon@redhat.com>
* infcall.c (call_function_by_hand): Add a new cleanup branch for
std::terminate breakpoint.
--
Index: infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.121
diff -u -r1.121 infcall.c
--- infcall.c 28 Jul 2009 16:39:06 -0000 1.121
+++ infcall.c 1 Oct 2009 15:00:38 -0000
@@ -441,6 +441,7 @@
struct gdbarch *gdbarch;
struct breakpoint *terminate_bp = NULL;
struct minimal_symbol *tm;
+ struct cleanup *terminate_bp_cleanup;
ptid_t call_thread_ptid;
struct gdb_exception e;
const char *name;
@@ -772,7 +773,7 @@
/* Register a clean-up for
unwind_on_terminating_exception_breakpoint. */
if (terminate_bp)
- make_cleanup_delete_breakpoint (terminate_bp);
+ terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp);
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
If you're looking to implement asynchronous dummy-frames, then
@@ -987,6 +988,11 @@
internal_error (__FILE__, __LINE__, _("... should not be here"));
}
+ /* If we get here and the std::terminate() breakpoint has been set,
+ it has to be cleaned manually. */
+ if (terminate_bp)
+ do_cleanups (terminate_bp_cleanup);
+
next reply other threads:[~2009-10-01 16:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 16:05 Phil Muldoon [this message]
2009-10-01 16:44 ` Joel Brobecker
2009-10-01 20:12 ` committed: " Phil Muldoon
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=4AC4D353.3010605@redhat.com \
--to=pmuldoon@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