Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: [rfc] Delay deletion of step-resume breakpoints
Date: Mon, 13 Aug 2007 21:03:00 -0000	[thread overview]
Message-ID: <20070813210326.GA24049@caradoc.them.org> (raw)

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


             reply	other threads:[~2007-08-13 21:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-13 21:03 Daniel Jacobowitz [this message]
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

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=20070813210326.GA24049@caradoc.them.org \
    --to=drow@false.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