From 816338b5632aeb20e01a18a1d96a59fac6459cd9 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Tue, 14 Feb 2012 23:28:15 +0000 Subject: 2012-02-14 Stan Shebs * NEWS: Mention enable count command. * breakpoint.h (struct breakpoint): New field enable_count. * breakpoint.c (enable_breakpoint_disp): Add count argument. (enable_breakpoint): Add arg to call. (struct disp_data): New struct. (do_enable_breakpoint_disp): Interp arg as disp_data and unpack. (do_map_enable_once_breakpoint): Create a struct and pass it. (do_map_enable_delete_breakpoint): Ditto. (do_map_enable_count_breakpoint): New function. (enable_count_command): New function. (bpstat_stop_status): Decrement enable_count. (print_one_breakpoint_location): Report enable count. (_initialize_breakpoint): Add enable count command. * gdb.texinfo (Disabling Breakpoints): Document enable count. * gdb.base/ena-dis-br.exp: Add enable count test. --- gdb/testsuite/gdb.base/ena-dis-br.exp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gdb/testsuite/gdb.base/ena-dis-br.exp') diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index 2e5cdb1..2cf3e9a 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -46,6 +46,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] @@ -162,6 +163,31 @@ gdb_test "info break $bp" \ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*" \ "info break marker4" +if ![runto_main] then { + fail "enable/disable break tests suppressed" +} + +# Test enable count by stopping at a location until it is disabled +# and passes through. + +set bp [break_at $bp_location7 "line $bp_location7"] + +set bp2 [break_at marker1 " line ($bp_location15|$bp_location16)"] + +gdb_test_no_output "enable count 2 $bp" "disable break with count" + +gdb_test "continue" \ + ".*factorial .*:$bp_location7.*" \ + "continue from enable count, first time" + +gdb_test "continue" \ + ".*factorial .*:$bp_location7.*" \ + "continue from enable count, second time" + +gdb_test "continue" \ + ".*marker1 .*:($bp_location15|$bp_location16).*" \ + "continue through enable count, now disabled" + # Verify that we can set a breakpoint with an ignore count N, which # should cause the next N triggers of the bp to be ignored. (This is # a flavor of enablement/disablement, after all.) -- cgit v1.1