From patchwork Thu Oct 9 19:10:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 3181 Received: (qmail 13643 invoked by alias); 9 Oct 2014 19:10:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 13634 invoked by uid 89); 9 Oct 2014 19:10:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD 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; Thu, 09 Oct 2014 19:10:51 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s99JAmbI029189 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 9 Oct 2014 15:10:48 -0400 Received: from host2.jankratochvil.net (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s99JAix3003180 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Thu, 9 Oct 2014 15:10:46 -0400 Date: Thu, 9 Oct 2014 21:10:44 +0200 From: Jan Kratochvil To: Yao Qi Cc: gdb-patches@sourceware.org, Miroslav Franc Subject: [patchv2 2/2] save breakpoints does not save disabled breakpoints correctly Message-ID: <20141009191044.GC26010@host2.jankratochvil.net> References: <20141003203228.GB30562@host2.jankratochvil.net> <87mw95s5xz.fsf@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87mw95s5xz.fsf@codesourcery.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Thu, 09 Oct 2014 15:55:52 +0200, Yao Qi wrote: > This line is too long... IWBN to convert gdb_test to gdb_test_sequence, > so that the patterns are written for each line, and will be more clear. Done. Jan gdb/ 2014-10-03 Miroslav Franc Fix "save breakpoints" for "disable $bpnum" command. * breakpoint.c (save_breakpoints): Add $bpnum for disable. gdb/testsuite/ 2014-10-09 Jan Kratochvil Fix "save breakpoints" for "disable $bpnum" command. * gdb.base/save-bp.c (main): Add label. * gdb.base/save-bp.exp: Add 8th disabled breakpoint. Match it. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3044916..a144a7e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -16130,7 +16130,7 @@ save_breakpoints (char *filename, int from_tty, } if (tp->enable_state == bp_disabled) - fprintf_unfiltered (fp, "disable\n"); + fprintf_unfiltered (fp, "disable $bpnum\n"); /* If this is a multi-location breakpoint, check if the locations should be individually disabled. Watchpoint locations are diff --git a/gdb/testsuite/gdb.base/save-bp.c b/gdb/testsuite/gdb.base/save-bp.c index 9a72fe8..f01f031 100644 --- a/gdb/testsuite/gdb.base/save-bp.c +++ b/gdb/testsuite/gdb.base/save-bp.c @@ -31,6 +31,6 @@ main (void) break_me (); /* Try a condition-specific breakpoint. */ break_me (); /* Finally, try a breakpoint with commands. */ - return 0; + return 0; /* Return line. */ } diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp index 61f647c..c8c9481 100644 --- a/gdb/testsuite/gdb.base/save-bp.exp +++ b/gdb/testsuite/gdb.base/save-bp.exp @@ -47,6 +47,10 @@ gdb_test "commands\nsilent\nend" "End with.*" "add breakpoint commands" gdb_test "dprintf ${srcfile}:${loc_bp5},\"At foo entry\\n\"" "Dprintf .*" +set loc_bp8 [gdb_get_line_number "Return line"] +gdb_breakpoint "${srcfile}:${loc_bp8}" +gdb_test_no_output {disable $bpnum} + # Now, save the breakpoints into a file... if {[is_remote host]} { set bps bps @@ -71,6 +75,7 @@ gdb_test "source $bps" "" "source bps" # Now, verify that all breakpoints have been created correctly... set bp_row_start "\[0-9\]+ +breakpoint +keep +y +0x\[0-9a-f\]+ +in" +set disabled_row_start "\[0-9\]+ +breakpoint +keep +n +0x\[0-9a-f\]+ +in" set dprintf_row_start "\[0-9\]+ +dprintf +keep +y +0x\[0-9a-f\]+ +in" gdb_test_sequence "info break" "info break" [list \ "\[\r\n\]+Num +Type +Disp +Enb +Address +What" \ @@ -84,4 +89,5 @@ gdb_test_sequence "info break" "info break" [list \ "\[\r\n\]+\[ \t\]+silent" \ "\[\r\n\]+$dprintf_row_start main at \[^\r\n\]*$srcfile:$loc_bp5" \ "\[\r\n\]+\[ \t\]+printf" \ + "\[\r\n\]+$disabled_row_start main at \[^\r\n\]*$srcfile:$loc_bp8" \ ]