This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] Delay deletion of step-resume breakpoints
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Mon, 13 Aug 2007 17:03:26 -0400
- Subject: [rfc] Delay deletion of step-resume breakpoints
This patch addresses a problem I encountered a long time ago.
Unfortunately I can't find the testcase, and all my attempts to write
a new one have failed. But, logically, I'm pretty sure the problem
still exists - it's just hard to trigger.
delete_thread calls free_thread, which calls delete_breakpoint. But
delete_thread is called from a number of places during target_wait on
various targets - when the program might not be stopped, so deleting
the breakpoint will fail. This patch changes the delete_breakpoint
call to set disp_del_at_next_stop instead. The breakpoint will stick
around a little longer, but still be collected.
The problem with writing a test case is that you need a step resume
breakpoint in a non-current thread when that thread exits. This is
timing sensitive and I haven't had any luck reproducing it today.
Does anyone else think this patch is right (or wrong)?
--
Daniel Jacobowitz
CodeSourcery
2007-08-13 Daniel Jacobowitz <dan@codesourcery.com>
* thread.c (free_thread): Do not delete the step resume breakpoint
right away.
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.53
diff -u -p -r1.53 thread.c
--- thread.c 10 Apr 2007 14:53:46 -0000 1.53
+++ thread.c 13 Aug 2007 20:42:58 -0000
@@ -87,9 +87,11 @@ static void
free_thread (struct thread_info *tp)
{
/* NOTE: this will take care of any left-over step_resume breakpoints,
- but not any user-specified thread-specific breakpoints. */
+ but not any user-specified thread-specific breakpoints. We can not
+ delete the breakpoint straight-off, because the inferior might not
+ be stopped at the moment. */
if (tp->step_resume_breakpoint)
- delete_breakpoint (tp->step_resume_breakpoint);
+ tp->step_resume_breakpoint->disposition = disp_del_at_next_stop;
/* FIXME: do I ever need to call the back-end to give it a
chance at this private data before deleting the thread? */