From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19172 invoked by alias); 19 Sep 2013 14:48:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 19163 invoked by uid 89); 19 Sep 2013 14:48:30 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Sep 2013 14:48:30 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8JEmQYq010448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 19 Sep 2013 10:48:27 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8JEmPnM007554; Thu, 19 Sep 2013 10:48:25 -0400 Message-ID: <523B0EB8.2080801@redhat.com> Date: Thu, 19 Sep 2013 14:48:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: Muhammad Waqas Subject: [COMMIT PATCH] Fix regressions caused by thread-specific breakpoint deletion. (was: Re: [PATCH] PR gdb/11568 - delete thread-specific breakpoints on thread exit) References: <521CF7D0.5040801@redhat.com> <1377692710-2885-1-git-send-email-mwaqas@codesourcery.com> <5224C0EB.3000503@redhat.com> <5224C238.2060106@redhat.com> <871u4ykmgq.fsf@fleche.redhat.com> <5238AF1A.4070000@redhat.com> In-Reply-To: <5238AF1A.4070000@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-09/txt/msg00687.txt.bz2 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 * 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