Index: ena-dis-br.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ena-dis-br.exp,v retrieving revision 1.22 diff -u -p -r1.22 ena-dis-br.exp --- ena-dis-br.exp 27 Jun 2013 18:50:30 -0000 1.22 +++ ena-dis-br.exp 15 Aug 2013 09:12:04 -0000 @@ -301,5 +301,88 @@ gdb_test_multiple "continue 2" "$test" { } } +# Verify that GDB correctly handles the "enable/disable" command with arguments. +# +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 ""] + +# This proc will work correctly If args will be according to below explaned values +# +# If "what" = "disable" then +# "what_res" = "n" +# "p1" = "pass" +# "p2" = "fail". +# +# If "what" = "enable" then +# "what_res" = "y" +# "p1" = "fail" +# "p2" = "pass". + +proc test_ena_dis_br { what what_res p1 p2 } { + global b1 + global b2 + global b3 + global b4 + global gdb_prompt + + gdb_test_no_output "$what $b1.1 $b2.1" "$what \$b1.1 \$b2.1" + set test1 "$what \$b1.1 and \$b2.1" + + 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" + } + } + + gdb_test "$what $b1 fooo.1" \ + "Bad breakpoint number 'fooo'" \ + "$what \$b1 fooo.1" + + gdb_test "info break" \ + "(${b1})(\[^\n\r]*)( $what_res.*)" \ + "${what}d \$b1" + + gdb_test_no_output "$what $b4 $b3.1" "$what \$b4 \$b3.1" + set test1 "${what}d \$b4 and \$b3.1,remain enabled \$b3" + + gdb_test_multiple "info break" "$test1" { + -re "(${b3})(\[^\n\r]*)( y.*)(${b3}.1)(\[^\n\r\]*)( n.*)(${b4})(\[^\n\r\]*)( $what_res.*)$gdb_prompt $" { + $p1 "$test1" + } + -re "(${b3})(\[^\n\r]*)( y.*)(${b4})(\[^\n\r\]*)( $what_res.*)$gdb_prompt $" { + $p2 "$test1" + } + } + + gdb_test "$what $b4.1 fooobaar" \ + "warning: bad breakpoint number at or near 'fooobaar'" \ + "$what \$b4.1 fooobar" + set test1 "${what}d \$b4.1" + + 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" "n" "pass" "fail" +test_ena_dis_br "enable" "y" "fail" "pass" + gdb_exit return 0