From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4571 invoked by alias); 4 Nov 2014 19:03:18 -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 4557 invoked by uid 89); 4 Nov 2014 19:03:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 04 Nov 2014 19:03:15 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA4J3CYq015837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 4 Nov 2014 14:03:13 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA4J3Bm2026910 for ; Tue, 4 Nov 2014 14:03:12 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 0/3] fix permanent breakpoints Date: Tue, 04 Nov 2014 19:03:00 -0000 Message-Id: <1415127790-15091-1-git-send-email-palves@redhat.com> X-SW-Source: 2014-11/txt/msg00075.txt.bz2 This series fixes a few permanent breakpoints things. - Adds a default method to gdbarch_skip_permanent_breakpoint, which should be right for most archs. - Makes permanent breakpoints be a detail of a breakpoint location rather than of the whole breakpoint. Bad things happen today if a multi-location breakpoint happens to have some (but not all) of its locations on top of a breakpoint instruction. - Makes permanent breakpoints disablable. If the user disables the breakpoint, she gets the random SIGTRAP as if she hadn't set the breakpoint in the first place. - Fixes the skip-permanent-breakpoint code to actually just skip the breakpoint. GDB currently steps one instruction too much, along with getting other tricky details wrong. But the reason I'm looking at this now is that a recent change of mine regressed the gdb.arch/i386-bp_permanent.exp test. See: https://sourceware.org/ml/gdb/2014-11/msg00001.html Specifically, GDB is now hitting an assertion when skipping a permanent breakpoint: (gdb) stepi ../../src/gdb/infrun.c:2237: internal-error: resume: Assertion `sig != GDB_SIGNAL_0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) FAIL: gdb.arch/i386-bp_permanent.exp: Single stepping past permanent breakpoint. (GDB internal error) However, taking a closer look, the problem is in permanent breakpoint's code, not on the assertion itself. That is, the assertion caught something bogus. I've complained about permanent breakpoints being fundamentally broken before, at: https://www.sourceware.org/ml/gdb-patches/2013-10/msg00574.html And it turns out that the new test added by this series trips on issues related to what I mentioned in that email, and I so I ended up having to do the changes I proposed in that email... Tested on x86-64 Fedora 20. Pedro Alves (3): add a default method for gdbarch_skip_permanent_breakpoint make "permanent breakpoints" per location and disableable fix skipping permanent breakpoints gdb/arch-utils.c | 13 +- gdb/arch-utils.h | 8 + gdb/breakpoint.c | 71 +++---- gdb/breakpoint.h | 13 +- gdb/gdbarch.c | 13 +- gdb/gdbarch.h | 2 - gdb/gdbarch.sh | 2 +- gdb/i386-tdep.c | 15 -- gdb/infrun.c | 153 +++++++++++++-- gdb/testsuite/gdb.arch/i386-bp_permanent.c | 57 ++++++ gdb/testsuite/gdb.arch/i386-bp_permanent.exp | 49 ++--- gdb/testsuite/gdb.base/bp-permanent.c | 128 +++++++++++++ gdb/testsuite/gdb.base/bp-permanent.exp | 276 +++++++++++++++++++++++++++ 13 files changed, 672 insertions(+), 128 deletions(-) create mode 100644 gdb/testsuite/gdb.arch/i386-bp_permanent.c create mode 100644 gdb/testsuite/gdb.base/bp-permanent.c create mode 100644 gdb/testsuite/gdb.base/bp-permanent.exp -- 1.9.3