Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Cc: Muhammad Waqas <mwaqas@codesourcery.com>
Subject: [COMMIT PATCH] Fix regressions caused by thread-specific breakpoint deletion. (was: Re: [PATCH] PR gdb/11568 - delete thread-specific breakpoints on thread exit)
Date: Thu, 19 Sep 2013 14:48:00 -0000	[thread overview]
Message-ID: <523B0EB8.2080801@redhat.com> (raw)
In-Reply-To: <5238AF1A.4070000@redhat.com>

The recent change to make GDB auto-delete thread-specific breakpoints
when the corresponding thread is deleted
(https://sourceware.org/ml/gdb-patches/2013-09/msg00038.html) caused
gdb.base/nextoverexit.exp to regress.

    Breakpoint 1, main () at .../gdb/testsuite/gdb.base/nextoverexit.c:21
    21        exit (0);
    (gdb) next
    [Inferior 1 (process 25208) exited normally]
    Thread-specific breakpoint -5 deleted - thread 1 is gone.
    Thread-specific breakpoint -6 deleted - thread 1 is gone.
    Thread-specific breakpoint -7 deleted - thread 1 is gone.
    Thread-specific breakpoint 0 deleted - thread 1 is gone.
    (gdb) FAIL: gdb.base/nextoverexit.exp: next over exit (the program exited)

We shouldn't be seeing this for internal or momentary breakpoints.  In
fact, we shouldn't even be trying to delete them, as whatever created
them will take care or it, and therefore it's dangerous to delete them
behind the creator's back.

I thought it'd still be good to tag thread-specific internal/momentary
breakpoints such that we'll no longer try to keep them insert in the
target, as they'll cause stops and thread hops in other threads, so I
tried disabling them instead.  That caused a problem when following a
child fork, and detaching from the parent, as we try to reset the
step-resume etc. breakpoints to the new child's thread
(breakpoint_re_set_thread), after the parent thread is already gone
(and the breakpoints are marked disabled).  I fixed that by
re-enabling internal/momentary breakpoints there, but, that didn't
feel super safe either (maybe we'd need a new flag in struct
breakpoint instead, to tag the thread-specific breakpoint as "not to
be inserted").  It felt like I was heading down a design rat hole,
and, other things will usually delete internal/momentary breakpoints
soon enough, so I left that little optimization for some other day.

So, internal/momentary breakpoints are no longer deleted/disabled at
all, and we end up with a one-liner fix.

Tested on x86_64 Fedora 17.

gdb/
2013-09-19  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (remove_threaded_breakpoints): Skip non-user
	breakpoints.
---
 gdb/breakpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 734dfd6..c132e24 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2938,7 +2938,7 @@ remove_threaded_breakpoints (struct thread_info *tp, int silent)
 
   ALL_BREAKPOINTS_SAFE (b, b_tmp)
     {
-      if (b->thread == tp->num)
+      if (b->thread == tp->num && user_breakpoint_p (b))
 	{
 	  b->disposition = disp_del_at_next_stop;
 
-- 
1.7.11.7


      reply	other threads:[~2013-09-19 14:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29  7:29 [PATCH with testcase] Bug 11568 - delete thread-specific breakpoint on the thread exit Muhammad Waqas
2013-07-29  9:21 ` Yao Qi
2013-07-29 11:42   ` Muhammad Waqas
2013-07-29 14:18     ` Yao Qi
2013-07-30 10:34       ` Muhammad Waqas
2013-07-31  2:41         ` Yao Qi
2013-08-01 10:51           ` Pedro Alves
2013-08-01 10:59             ` Yao Qi
2013-08-01 11:27               ` Pedro Alves
2013-08-01 12:10                 ` Yao Qi
2013-08-01 11:57         ` Pedro Alves
2013-08-01 12:44           ` Muhammad Waqas
2013-08-02  9:45             ` Pedro Alves
2013-08-05 12:01               ` Muhammad Waqas
2013-08-05 13:57                 ` Tom Tromey
2013-08-06  6:12                   ` Muhammad Waqas
2013-08-22  9:42                     ` Muhammad Waqas
2013-08-22 17:14                       ` Pedro Alves
2013-08-23  5:31                         ` Muhammad Waqas
2013-08-27 11:31                         ` Muhammad Waqas
2013-08-27 19:02                           ` Pedro Alves
2013-08-27 19:06                             ` Pedro Alves
2013-08-28 12:26                             ` Muhammad Waqas
2013-08-28 12:26                             ` Muhammad Waqas
2013-08-30 16:28                               ` Pedro Alves
2013-09-02  4:06                                 ` Muhammad Waqas
2013-09-02  8:39                                   ` Pedro Alves
2013-09-02  9:46                                     ` Muhammad Waqas
2013-09-02 10:24                                       ` Pedro Alves
2013-09-02 10:32                                         ` Muhammad Waqas
2013-09-02 10:48                                           ` Pedro Alves
2013-09-02 16:46                               ` Pedro Alves
2013-09-02 16:52                                 ` [PATCH] PR gdb/11568 - delete thread-specific breakpoints on " Pedro Alves
2013-09-09 16:07                                   ` Tom Tromey
2013-09-17 19:36                                     ` Pedro Alves
2013-09-19 14:48                                       ` Pedro Alves [this message]

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=523B0EB8.2080801@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mwaqas@codesourcery.com \
    /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