Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Delay deletion of step-resume breakpoints
@ 2007-08-13 21:03 Daniel Jacobowitz
  2007-08-13 21:13 ` Mark Kettenis
  2007-09-10 21:27 ` Daniel Jacobowitz
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-08-13 21:03 UTC (permalink / raw)
  To: gdb-patches

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?  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-09-10 21:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-13 21:03 [rfc] Delay deletion of step-resume breakpoints Daniel Jacobowitz
2007-08-13 21:13 ` Mark Kettenis
2007-08-13 21:37   ` Daniel Jacobowitz
2007-08-27 20:11     ` Daniel Jacobowitz
2007-08-14  3:12   ` Eli Zaretskii
2007-09-10 21:27 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox