diff options
author | Muhammad Waqas <mwaqas@sourceware.org> | 2013-08-23 06:22:10 +0000 |
---|---|---|
committer | Muhammad Waqas <mwaqas@sourceware.org> | 2013-08-23 06:22:10 +0000 |
commit | 9eaabc7557aef5ca4f68daed3ab0c3f5a664a020 (patch) | |
tree | b5c841370f4398520793f5dfccf56da4679abb65 /gdb/testsuite/gdb.base/ena-dis-br.exp | |
parent | 101158d99a92eb10c71d4cf3a07d9ac887f68bfb (diff) | |
download | gdb-9eaabc7557aef5ca4f68daed3ab0c3f5a664a020.zip gdb-9eaabc7557aef5ca4f68daed3ab0c3f5a664a020.tar.gz gdb-9eaabc7557aef5ca4f68daed3ab0c3f5a664a020.tar.bz2 |
2013-08-12 Muhammad Waqas <mwaqas@codesourcery.com>
PR gdb/15501
* breakpoint.c (enable_command, disable_command): Iterate over
all specified breakpoint locations.
2013-07-12 Muhammad Waqas <mwaqas@codesourccery.com>
PR gdb/15501
* gdb.base/ena-dis-br.exp: Add test to verify
enable/disable commands work correctly with
multiple arguments that include multiple locations.
Diffstat (limited to 'gdb/testsuite/gdb.base/ena-dis-br.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/ena-dis-br.exp | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index 0c4f9d4..4bce607 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -301,5 +301,113 @@ gdb_test_multiple "continue 2" "$test" { } } +# Verify that GDB correctly handles the "enable/disable" command +# with arguments, that include multiple locations. +# +if ![runto_main] then { fail "enable/disable break tests suppressed" } + +set b1 0 +set b2 0 +set b3 0 +set b4 0 +set b1 [break_at main ""] +set b2 [break_at main ""] +set b3 [break_at main ""] +set b4 [break_at main ""] + +# Perform tests for disable/enable commands on multiple +# locations and breakpoints. +# +# WHAT - the command to test (disable/enable). +# +proc test_ena_dis_br { what } { + global b1 + global b2 + global b3 + global b4 + global gdb_prompt + + # OPPOS - the command opposite to WHAT. + # WHAT_RES - whether breakpoints are expected to end + # up enabled or disabled. + # OPPOS_RES- same as WHAT_RES but opposite. + # P1/P2 - proc to call (pass/fail). Must be + # opposites. + # Set variable values for disable command. + set oppos "enable" + set oppos_res "y" + set what_res "n" + set p1 "pass" + set p2 "fail" + + if { "$what" == "enable" } { + # Set varibale values for enable command. + set oppos "disable" + set oppos_res "n" + set what_res "y" + set p1 "fail" + set p2 "pass" + } + + # Now enable(disable) $b.1 $b2.1. + gdb_test_no_output "$what $b1.1 $b2.1" "$what \$b1.1 \$b2.1" + set test1 "${what}d \$b1.1 and \$b2.1" + + # Now $b1.1 and $b2.1 should be enabled(disabled). + gdb_test_multiple "info break" "$test1" { + -re "(${b1}.1)(\[^\n\r\]*)( n.*)(${b2}.1)(\[^\n\r\]*)( n.*)$gdb_prompt $" { + $p1 "$test1" + } + -re ".*$gdb_prompt $" { + $p2 "$test1" + } + } + + # Now enable(disable) $b1 fooo.1, it should give error on fooo. + gdb_test "$what $b1 fooo.1" \ + "Bad breakpoint number 'fooo'" \ + "$what \$b1 fooo.1" + + # $b1 should be enabled(disabled). + gdb_test "info break" \ + "(${b1})(\[^\n\r]*)( $what_res.*)" \ + "${what}d \$b1" + + gdb_test_no_output "$oppos $b3" "$oppos \$b3" + gdb_test_no_output "$what $b4 $b3.1" "$what \$b4 \$b3.1" + set test1 "${what}d \$b4 and \$b3.1,remain ${oppos}d \$b3" + + # Now $b4 $b3.1 should be enabled(disabled) and + # $b3 should remain disabled(enabled). + gdb_test_multiple "info break" "$test1" { + -re "(${b3})(\[^\n\r]*)( $oppos_res.*)(${b3}.1)(\[^\n\r\]*)( n.*)(${b4})(\[^\n\r\]*)( $what_res.*)$gdb_prompt $" { + $p1 "$test1" + } + -re "(${b3})(\[^\n\r]*)( $oppos_res.*)(${b4})(\[^\n\r\]*)( $what_res.*)$gdb_prompt $" { + $p2 "$test1" + } + } + + # Now enable(disable) $b4.1 fooobaar and + # it should give warning on fooobaar. + gdb_test "$what $b4.1 fooobaar" \ + "warning: bad breakpoint number at or near 'fooobaar'" \ + "$what \$b4.1 fooobar" + set test1 "${what}d \$b4.1" + + # $b4.1 should be enabled(disabled). + gdb_test_multiple "info break" "$test1" { + -re "(${b4}.1)(\[^\n\r\]*)( n.*)$gdb_prompt $" { + $p1 "$test1" + } + -re ".*$gdb_prompt $" { + $p2 "$test1" + } + } +} + +test_ena_dis_br "disable" +test_ena_dis_br "enable" + gdb_exit return 0 |