2004-07-13 15:01:04 +02:00
|
|
|
# This testcase is part of GDB, the GNU debugger.
|
|
|
|
|
2018-01-01 05:43:02 +01:00
|
|
|
# Copyright 1997-2018 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-08-23 20:14:19 +02:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-16 03:35:26 +02:00
|
|
|
# (at your option) any later version.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
1999-04-16 03:35:26 +02:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
1999-04-16 03:35:26 +02:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 20:14:19 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# test running programs
|
|
|
|
#
|
|
|
|
|
test suite update - gdb.base/[efg]
Convert files gdb.base/[efg]*.exp to use standard_output_file et al.
* ena-dis-br.exp, enum_cond.exp, enumval.exp, environ.exp,
eu-strip-infcall.exp, eval-skip.exp, exe-lock.exp,
expand-psymtabs.exp, exprs.exp, fileio.exp, find.exp,
fixsection.exp, foll-exec.exp, foll-fork.exp,
fortran-sym-case.exp, frame-args.exp, freebpcmd.exp, fullname.exp,
funcargs.exp, gcore-buffer-overflow.exp, gcore.exp, gdb1090.exp,
gdb11530.exp, gdb11531.exp, gdb1250.exp, gdb1555.exp, gdb1821.exp,
gdbindex-stabs.exp, gdbvars.exp, gnu-ifunc.exp, gnu_vector.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 20:50:30 +02:00
|
|
|
standard_testfile break.c break1.c
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2016-12-23 17:52:18 +01:00
|
|
|
if {[prepare_for_testing "failed to prepare" ${testfile} \
|
test suite update - gdb.base/[efg]
Convert files gdb.base/[efg]*.exp to use standard_output_file et al.
* ena-dis-br.exp, enum_cond.exp, enumval.exp, environ.exp,
eu-strip-infcall.exp, eval-skip.exp, exe-lock.exp,
expand-psymtabs.exp, exprs.exp, fileio.exp, find.exp,
fixsection.exp, foll-exec.exp, foll-fork.exp,
fortran-sym-case.exp, frame-args.exp, freebpcmd.exp, fullname.exp,
funcargs.exp, gcore-buffer-overflow.exp, gcore.exp, gdb1090.exp,
gdb11530.exp, gdb11531.exp, gdb1250.exp, gdb1555.exp, gdb1821.exp,
gdbindex-stabs.exp, gdbvars.exp, gnu-ifunc.exp, gnu_vector.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 20:50:30 +02:00
|
|
|
[list $srcfile $srcfile2] {debug nowarnings}]} {
|
|
|
|
return -1
|
2003-12-09 19:19:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
|
2012-02-15 00:28:15 +01:00
|
|
|
set bp_location7 [gdb_get_line_number "set breakpoint 7 here"]
|
test suite update - gdb.base/[efg]
Convert files gdb.base/[efg]*.exp to use standard_output_file et al.
* ena-dis-br.exp, enum_cond.exp, enumval.exp, environ.exp,
eu-strip-infcall.exp, eval-skip.exp, exe-lock.exp,
expand-psymtabs.exp, exprs.exp, fileio.exp, find.exp,
fixsection.exp, foll-exec.exp, foll-fork.exp,
fortran-sym-case.exp, frame-args.exp, freebpcmd.exp, fullname.exp,
funcargs.exp, gcore-buffer-overflow.exp, gcore.exp, gdb1090.exp,
gdb11530.exp, gdb11531.exp, gdb1250.exp, gdb1555.exp, gdb1821.exp,
gdbindex-stabs.exp, gdbvars.exp, gnu-ifunc.exp, gnu_vector.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 20:50:30 +02:00
|
|
|
set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile2]
|
2003-12-09 19:19:20 +01:00
|
|
|
set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
|
test suite update - gdb.base/[efg]
Convert files gdb.base/[efg]*.exp to use standard_output_file et al.
* ena-dis-br.exp, enum_cond.exp, enumval.exp, environ.exp,
eu-strip-infcall.exp, eval-skip.exp, exe-lock.exp,
expand-psymtabs.exp, exprs.exp, fileio.exp, find.exp,
fixsection.exp, foll-exec.exp, foll-fork.exp,
fortran-sym-case.exp, frame-args.exp, freebpcmd.exp, fullname.exp,
funcargs.exp, gcore-buffer-overflow.exp, gcore.exp, gdb1090.exp,
gdb11530.exp, gdb11531.exp, gdb1250.exp, gdb1555.exp, gdb1821.exp,
gdbindex-stabs.exp, gdbvars.exp, gnu-ifunc.exp, gnu_vector.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 20:50:30 +02:00
|
|
|
set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile2]
|
|
|
|
set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile2]
|
|
|
|
set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile2]
|
2003-12-09 19:19:20 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
if ![runto_main] then { fail "enable/disable break tests suppressed" }
|
|
|
|
|
|
|
|
# Verify that we can set a breakpoint (the location is irrelevant),
|
|
|
|
# then enable it (yes, it's already enabled by default), then hit it.
|
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
proc break_at { breakpoint where } {
|
|
|
|
global gdb_prompt
|
|
|
|
global expect_out
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
set test "break $breakpoint"
|
|
|
|
set bp 0
|
|
|
|
gdb_test_multiple "$test" "$test" {
|
|
|
|
-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
|
|
|
|
set bp $expect_out(1,string)
|
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $bp
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp [break_at "marker1" " line $bp_location15"]
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2010-06-01 23:29:21 +02:00
|
|
|
gdb_test_no_output "enable $bp" "enable break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*" \
|
|
|
|
"info break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
# See the comments in condbreak.exp for "run until breakpoint at
|
|
|
|
# marker1" for an explanation of the xfail below.
|
|
|
|
set test "continue to break marker1"
|
|
|
|
gdb_test_multiple "continue" "$test" {
|
|
|
|
-re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $" {
|
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $" {
|
|
|
|
xfail "$test"
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2010-06-01 23:29:21 +02:00
|
|
|
gdb_test_no_output "delete $bp" "delete break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
# Verify that we can set a breakpoint to be self-disabling after the
|
|
|
|
# first time it triggers.
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp [break_at "marker2" " line $bp_location8"]
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2010-06-01 23:29:21 +02:00
|
|
|
gdb_test_no_output "enable once $bp" "enable once break marker2"
|
2004-07-13 15:01:04 +02:00
|
|
|
|
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+y.*" \
|
|
|
|
"info auto-disabled break marker2"
|
|
|
|
|
|
|
|
# See the comments in condbreak.exp for "run until breakpoint at
|
|
|
|
# marker1" for an explanation of the xfail below.
|
|
|
|
set test "continue to auto-disabled break marker2"
|
|
|
|
gdb_test_multiple "continue" "$test" {
|
|
|
|
-re "Breakpoint \[0-9\]*, marker2.*$gdb_prompt $" {
|
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "Breakpoint \[0-9\]*, $hex in marker2.*$gdb_prompt $" {
|
|
|
|
xfail "$test"
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+n.*" \
|
|
|
|
"info auto-disabled break marker2"
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
# Verify that we don't stop at a disabled breakpoint.
|
1999-04-26 20:34:20 +02:00
|
|
|
gdb_continue_to_end "no stop"
|
|
|
|
rerun_to_main
|
|
|
|
gdb_continue_to_end "no stop at auto-disabled break marker2"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
# Verify that we can set a breakpoint to be self-deleting after the
|
|
|
|
# first time it triggers.
|
|
|
|
if ![runto_main] then {
|
|
|
|
fail "enable/disable break tests suppressed"
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp [break_at "marker3" " line $bp_location17"]
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2010-06-01 23:29:21 +02:00
|
|
|
gdb_test_no_output "enable del $bp" "enable del break marker3"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*" \
|
|
|
|
"info auto-deleted break marker2"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "continue" \
|
2014-11-14 17:45:41 +01:00
|
|
|
".*marker3 .*:$bp_location17.*" \
|
2004-07-13 15:01:04 +02:00
|
|
|
"continue to auto-deleted break marker3"
|
|
|
|
|
|
|
|
gdb_test "info break $bp" \
|
2011-02-23 20:20:39 +01:00
|
|
|
".*No breakpoint or watchpoint matching.*" \
|
2004-07-13 15:01:04 +02:00
|
|
|
"info auto-deleted break marker3"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# Verify that we can set a breakpoint and manually disable it (we've
|
|
|
|
# already proven that disabled bp's don't trigger).
|
|
|
|
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp [break_at "marker4" " line $bp_location14.*"]
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2010-06-01 23:29:21 +02:00
|
|
|
gdb_test_no_output "disable $bp" "disable break marker4"
|
2004-07-13 15:01:04 +02:00
|
|
|
|
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*" \
|
|
|
|
"info break marker4"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2012-02-15 00:28:15 +01:00
|
|
|
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"]
|
|
|
|
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp2 [break_at marker1 " line $bp_location15"]
|
2012-02-15 00:28:15 +01:00
|
|
|
|
2015-02-02 20:57:31 +01:00
|
|
|
gdb_test "enable count" \
|
|
|
|
"Argument required \\(hit count\\)\\." \
|
|
|
|
"enable count missing arguments"
|
|
|
|
|
|
|
|
gdb_test "enable count 2" \
|
|
|
|
"Argument required \\(one or more breakpoint numbers\\)\\." \
|
|
|
|
"enable count missing breakpoint number"
|
|
|
|
|
2012-02-15 00:28:15 +01:00
|
|
|
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" \
|
2014-11-14 17:45:41 +01:00
|
|
|
".*marker1 .*:$bp_location15.*" \
|
2012-02-15 00:28:15 +01:00
|
|
|
"continue through enable count, now disabled"
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
# 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.)
|
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
if ![runto_main] then {
|
|
|
|
fail "enable/disable break tests suppressed"
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp [break_at "marker1" " line $bp_location15.*"]
|
2004-07-13 15:01:04 +02:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
# Verify that an ignore of a non-existent breakpoint is gracefully
|
|
|
|
# handled.
|
2004-07-13 15:01:04 +02:00
|
|
|
|
|
|
|
gdb_test "ignore 999 2" \
|
|
|
|
"No breakpoint number 999..*" \
|
|
|
|
"ignore non-existent break"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# Verify that a missing ignore count is gracefully handled.
|
2004-07-13 15:01:04 +02:00
|
|
|
|
|
|
|
gdb_test "ignore $bp" \
|
|
|
|
"Second argument .specified ignore-count. is missing..*" \
|
|
|
|
"ignore break with missing ignore count"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# Verify that a negative or zero ignore count is handled gracefully
|
|
|
|
# (they both are treated the same).
|
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "ignore $bp -1" \
|
|
|
|
"Will stop next time breakpoint \[0-9\]* is reached..*" \
|
|
|
|
"ignore break marker1 -1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "ignore $bp 0" \
|
|
|
|
"Will stop next time breakpoint \[0-9\]* is reached..*" \
|
|
|
|
"ignore break marker1 0"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "ignore $bp 1" \
|
|
|
|
"Will ignore next crossing of breakpoint \[0-9\]*.*" \
|
|
|
|
"ignore break marker1"
|
|
|
|
|
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*ignore next 1 hits.*" \
|
|
|
|
"info ignored break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-04-26 20:34:20 +02:00
|
|
|
gdb_continue_to_end "no stop at ignored break marker1"
|
|
|
|
rerun_to_main
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-11-09 02:23:30 +01:00
|
|
|
# See the comments in condbreak.exp for "run until breakpoint at marker1"
|
|
|
|
# for an explanation of the xfail below.
|
2004-07-13 15:01:04 +02:00
|
|
|
set test "continue to break marker1, 2nd time"
|
|
|
|
gdb_test_multiple "continue" "$test" {
|
|
|
|
-re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $" {
|
|
|
|
pass "continue to break marker1, 2nd time"
|
|
|
|
}
|
|
|
|
-re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $" {
|
|
|
|
xfail "continue to break marker1, 2nd time"
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Verify that we can specify both an ignore count and an auto-delete.
|
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
if ![runto_main] then {
|
|
|
|
fail "enable/disable break tests suppressed"
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp [break_at marker1 " line $bp_location15.*"]
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "ignore $bp 1" \
|
|
|
|
"Will ignore next crossing of breakpoint \[0-9\]*.*" \
|
|
|
|
"ignore break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2010-06-01 23:29:21 +02:00
|
|
|
gdb_test_no_output "enable del $bp" "enable del break marker1"
|
2004-07-13 15:01:04 +02:00
|
|
|
|
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*ignore next 1 hits.*" \
|
|
|
|
"info break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-04-26 20:34:20 +02:00
|
|
|
gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
|
|
|
|
rerun_to_main
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "continue" \
|
2014-11-14 17:45:41 +01:00
|
|
|
".*marker1 .*:$bp_location15.*" \
|
2004-07-13 15:01:04 +02:00
|
|
|
"continue to ignored & auto-deleted break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# Verify that a disabled breakpoint's ignore count isn't updated when
|
|
|
|
# the bp is encountered.
|
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
if ![runto_main] then {
|
|
|
|
fail "enable/disable break tests suppressed"
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2014-11-14 17:45:41 +01:00
|
|
|
set bp [break_at marker1 " line $bp_location15"]
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "ignore $bp 10" \
|
|
|
|
"Will ignore next 10 crossings of breakpoint \[0-9\]*.*" \
|
|
|
|
"ignore break marker1"
|
|
|
|
|
2010-06-01 23:29:21 +02:00
|
|
|
gdb_test_no_output "disable $bp" "disable break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-04-26 20:34:20 +02:00
|
|
|
gdb_continue_to_end "no stop at ignored & disabled break marker1"
|
|
|
|
rerun_to_main
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "info break $bp" \
|
|
|
|
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \
|
|
|
|
"info ignored & disabled break marker1"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# Verify that GDB correctly handles the "continue" command with an argument,
|
|
|
|
# which is an ignore count to set on the currently stopped-at breakpoint.
|
|
|
|
# (Also verify that GDB gracefully handles the case where the inferior
|
|
|
|
# isn't stopped at a breakpoint.)
|
|
|
|
#
|
|
|
|
if ![runto_main] then { fail "enable/disable break tests suppressed" }
|
|
|
|
|
2004-07-13 15:01:04 +02:00
|
|
|
gdb_test "break $bp_location1" \
|
|
|
|
"Breakpoint \[0-9\]*.*, line $bp_location1.*" \
|
|
|
|
"prepare to continue with ignore count"
|
|
|
|
|
|
|
|
gdb_test "continue 2" \
|
|
|
|
"Will ignore next crossing of breakpoint \[0-9\]*. Continuing..*" \
|
|
|
|
"continue with ignore count"
|
|
|
|
|
|
|
|
gdb_test "next" ".*$bp_location11\[ \t\]*marker1.*" \
|
2013-11-24 01:43:29 +01:00
|
|
|
"step after continue with ignore count"
|
2004-07-13 15:01:04 +02:00
|
|
|
|
|
|
|
set test "continue with ignore count, not stopped at bpt"
|
|
|
|
gdb_test_multiple "continue 2" "$test" {
|
|
|
|
-re "Not stopped at any breakpoint; argument ignored.*$gdb_prompt $" {
|
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "No breakpoint number -1.*$gdb_prompt $" {
|
|
|
|
kfail gdb/1689 "$test"
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2013-08-23 08:22:10 +02:00
|
|
|
# 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).
|
|
|
|
#
|
2017-11-07 12:00:31 +01:00
|
|
|
# Note: tests involving location ranges (and more) are found in
|
|
|
|
# gdb.cp/ena-dis-br-range.exp.
|
|
|
|
#
|
2013-08-23 08:22:10 +02:00
|
|
|
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" \
|
2017-09-10 22:48:30 +02:00
|
|
|
"Bad breakpoint number 'fooo\\.1'" \
|
2013-08-23 08:22:10 +02:00
|
|
|
"$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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-07 12:00:31 +01:00
|
|
|
# Now enable(disable) '$b4.1 fooobaar'. This should error on
|
|
|
|
# fooobaar.
|
2013-08-23 08:22:10 +02:00
|
|
|
gdb_test "$what $b4.1 fooobaar" \
|
2017-11-07 12:00:32 +01:00
|
|
|
"Bad breakpoint number 'fooobaar'" \
|
2013-08-23 08:22:10 +02:00
|
|
|
"$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"
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_exit
|
|
|
|
return 0
|