From 99894e1175c04ef470761406c0d20f61f5a7e9ba Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 12 Oct 2014 21:52:39 +0200 Subject: [PATCH] Fix "save breakpoints" for "disable $bpnum" command. gdb/ChangeLog 2014-10-12 Miroslav Franc Fix "save breakpoints" for "disable $bpnum" command. * breakpoint.c (save_breakpoints): Add $bpnum for disable. gdb/testsuite/ChangeLog 2014-10-12 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. --- gdb/ChangeLog | 5 +++++ gdb/breakpoint.c | 2 +- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.base/save-bp.c | 2 +- gdb/testsuite/gdb.base/save-bp.exp | 6 ++++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6e15e532051..724a97181f7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-10-12 Miroslav Franc + + Fix "save breakpoints" for "disable $bpnum" command. + * breakpoint.c (save_breakpoints): Add $bpnum for disable. + 2014-10-10 Pedro Alves * Makefile.in (ALL_TARGET_OBS): Remove mips-irix-tdep.o and solib-irix.o. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3044916a556..a144a7e96a9 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/ChangeLog b/gdb/testsuite/ChangeLog index fdd18d7ee5b..bb362dcaeba 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-10-12 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. + 2014-10-12 Jan Kratochvil * gdb.base/save-bp.exp (info break): Use gdb_test_sequence. diff --git a/gdb/testsuite/gdb.base/save-bp.c b/gdb/testsuite/gdb.base/save-bp.c index 9a72fe85b86..f01f031b0f6 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 61f647c1cdd..c8c9481431e 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" \ ] -- 2.30.2