From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12884 invoked by alias); 18 Oct 2013 14:48:04 -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 12863 invoked by uid 89); 18 Oct 2013 14:48:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,T_HDRS_LCASE autolearn=ham version=3.3.2 X-HELO: mms3.broadcom.com Received: from mms3.broadcom.com (HELO mms3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Oct 2013 14:48:03 +0000 Received: from [10.9.208.57] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Fri, 18 Oct 2013 07:47:37 -0700 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.438.0; Fri, 18 Oct 2013 07:47:51 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.1.438.0; Fri, 18 Oct 2013 07:47:51 -0700 Received: from [10.177.73.67] (unknown [10.177.73.67]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id C7C30246A4; Fri, 18 Oct 2013 07:47:50 -0700 (PDT) Message-ID: <52614A15.7070301@broadcom.com> Date: Fri, 18 Oct 2013 14:48:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: "gdb-patches@sourceware.org" cc: lgustavo@codesourcery.com Subject: [PATCH] Permanent breakpoints degrade to normal breakpoints on enable Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00565.txt.bz2 This patch: https://sourceware.org/ml/gdb-patches/2012-01/msg00964.html introduced what I believe is a stray line that causes permanent breakpoints to become normal breakpoints if the user ever tries to "enable" the permanent breakpoint. I've removed the extra line and written a test to cover this case. OK to apply? Andrew gdb/ChangeLog 2013-10-18 Andrew Burgess * breakpoint.c (enable_breakpoint_disp): Remove setting of enabled_state for permanent breakpoints. gdb/testsuite/ChangeLog 2013-10-18 Andrew Burgess * gdb.arch/i386-permbkpt.exp: Extend the existing tests, and add more tests. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 911f7b5..53ece71 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -14666,8 +14666,6 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition, if (bpt->enable_state != bp_permanent) bpt->enable_state = bp_enabled; - bpt->enable_state = bp_enabled; - /* Mark breakpoint locations modified. */ mark_breakpoint_modified (bpt); diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.exp b/gdb/testsuite/gdb.arch/i386-permbkpt.exp index 88bfff3..52c2ee1 100644 --- a/gdb/testsuite/gdb.arch/i386-permbkpt.exp +++ b/gdb/testsuite/gdb.arch/i386-permbkpt.exp @@ -18,6 +18,9 @@ # Test inserting breakpoints over permanent breakpoints on i386 and amd64. +global hex +global decimal + if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { verbose "Skipping i386 test for multi break at permanent breakpoint location." return @@ -35,5 +38,28 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list clean_restart ${binfile} -gdb_test "break main" "" "First permanent break" -gdb_test "break main" "" "Second permanent break" +gdb_test "break main" \ + "Breakpoint $decimal at $hex: .*" \ + "First permanent break" +gdb_test_no_output "set \$bp1 = \$bpnum" + +# Place a second breakpoint at the same place as the first, check +# that the first is called a "permanent" breakpoint. +gdb_test "break main" \ + "Note: breakpoint $decimal \\(permanent\\) also set at pc $hex\.\[\n\r\]+Breakpoint $decimal at $hex: .*" \ + "Second permanent break" +gdb_test_no_output "set \$bp2 = \$bpnum" + +# Now, delete the last breakpoint placed. +gdb_test_no_output "delete \$bp2" + +# Now 'enable' the first breakpoint, this should have no impact as the +# breakpoint is already enabled, however, we've had bugs in this code +# before now. +gdb_test_no_output "enable \$bp1" + +# Check that placing (another) second breakpoint at the same location as +# the first still reports the first as a permanent breakpoint. +gdb_test "break main" \ + "Note: breakpoint $decimal \\(permanent\\) also set at pc $hex\.\[\n\r\]+Breakpoint $decimal at $hex: .*" \ + "Third permanent break"