# the first breakpoint inside nested_sub.
gdb_run_cmd
-gdb_test "" "Breakpoint $decimal, foo\\.nested_sub \\(\\).*"
-
+gdb_test "" "Breakpoint $decimal, foo\\.nested_sub \\(\\).*" "run to first breakpoint"
# Load the first executable.
-gdb_test "shell mv ${binfile} ${common_binfile}" ".*" ""
+gdb_test "shell mv ${binfile} ${common_binfile}" "" \
+ "shell mv \${binfile} \${common_binfile}"
gdb_load ${common_binfile}
# Start the program, we should land in the program main procedure
# second executable into its place. Ensure that the new
# executable is at least a second newer than the old.
-gdb_test "shell mv ${common_binfile} ${binfile}" ".*" ""
-gdb_test "shell mv ${binfile2} ${common_binfile}" ".*" ""
-gdb_test "shell sleep 1" ".*" ""
-gdb_test "shell touch ${common_binfile}" ".*" ""
+gdb_test "shell mv ${common_binfile} ${binfile}" "" \
+ "shell mv \${common_binfile} \${binfile}"
+gdb_test "shell mv ${binfile2} ${common_binfile}" "" \
+ "shell mv \${binfile2} \${common_binfile}"
+gdb_test "shell sleep 1" "" "shell sleep 1, once"
+gdb_test "shell touch ${common_binfile}" "" \
+ "shell touch \${common_binfile}"
# Start the program a second time, GDB should land in procedure Second
# this time.
# starting after having re-read symbols. PR 17855.
gdb_breakpoint break_me
-gdb_test "shell touch ${binfile}$EXEEXT" ".*" ""
-gdb_test "shell sleep 1" ".*" ""
+gdb_test "shell touch ${binfile}$EXEEXT" "" \
+ "shell touch \${binfile}\$EXEEXT"
+gdb_test "shell sleep 1" "" "shell sleep 1, twice"
if { [gdb_start_cmd] < 0 } {
# PR 17855: At this point gdb may have crashed or gotten an internal
"Breakpoint $decimal.*" \
gdb_run_cmd
-gdb_test "" "Breakpoint $decimal, foo \\(\\).*"
+gdb_test "" "Breakpoint $decimal, foo \\(\\).*" \
+ "run to foo"
gdb_test "continue" \
"Continuing\\..*Breakpoint $decimal, foo \\(\\).*"
gdb_run_cmd
gdb_test "" \
- "Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*"
+ "Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
+ "run to foo_o224_021.child1.child2"
set opt_addr_in "($hex in)?"
gdb_test "bt" \
# Start the inferior and run to the first stop
gdb_run_cmd
-gdb_test "" ".*Stopped due to shared library event.*"
+gdb_test "" ".*Stopped due to shared library event.*" \
+ "run to shared library event"
# Check if we're using probes.
set using_probes 0
# Test with value history
-gdb_test "print 1" "" ""
-gdb_test "print 2" "" ""
-gdb_test "print 3" "" ""
-gdb_test "print 4" "" ""
-gdb_test "print 5" "" ""
-gdb_test "print 6" "" ""
-
-# $2 is 2 and $$ is 5
-gdb_test_no_output "disable \$2 \$\$" "disable using history values"
-
-set see1 0
-set see2 0
-set see3 0
-set see4 0
-set see5 0
-set see6 0
-
-gdb_test_multiple "info break" "check disable with history values" {
- -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" {
- set see1 1
- exp_continue
- }
- -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in [func marker2] at \[^\r\n\]*" {
- set see2 1
- exp_continue
- }
- -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" {
- set see3 1
- exp_continue
- }
- -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" {
- set see4 1
- exp_continue
- }
- -re "5\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location1\[^\r\n\]*" {
- set see5 1
- exp_continue
- }
- -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" {
- set see6 1
- exp_continue
- }
- -re ".*$gdb_prompt $" {
- if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then {
- pass "check disable with history values"
- } else {
- fail "check disable with history values"
+with_test_prefix "with value history" {
+ gdb_test "print 1"
+ gdb_test "print 2"
+ gdb_test "print 3"
+ gdb_test "print 4"
+ gdb_test "print 5"
+ gdb_test "print 6"
+
+ # $2 is 2 and $$ is 5
+ gdb_test_no_output "disable \$2 \$\$" "disable using history values"
+
+ set see1 0
+ set see2 0
+ set see3 0
+ set see4 0
+ set see5 0
+ set see6 0
+
+ gdb_test_multiple "info break" "check disable with history values" {
+ -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" {
+ set see1 1
+ exp_continue
+ }
+ -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in [func marker2] at \[^\r\n\]*" {
+ set see2 1
+ exp_continue
+ }
+ -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" {
+ set see3 1
+ exp_continue
+ }
+ -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" {
+ set see4 1
+ exp_continue
+ }
+ -re "5\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location1\[^\r\n\]*" {
+ set see5 1
+ exp_continue
+ }
+ -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" {
+ set see6 1
+ exp_continue
+ }
+ -re ".*$gdb_prompt $" {
+ if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then {
+ pass "check disable with history values"
+ } else {
+ fail "check disable with history values"
+ }
}
}
}
-gdb_test "enable" "" ""
-gdb_test "set \$foo = 3" "" ""
-gdb_test "set \$bar = 6" "" ""
-gdb_test_no_output "disable \$foo \$bar" "disable with convenience values"
-
-set see1 0
-set see2 0
-set see3 0
-set see4 0
-set see5 0
-set see6 0
-
-gdb_test_multiple "info break" "check disable with convenience values" {
- -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" {
- set see1 1
- exp_continue
- }
- -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" {
- set see2 1
- exp_continue
- }
- -re "3\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location7\[^\r\n\]*" {
- set see3 1
- exp_continue
- }
- -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" {
- set see4 1
- exp_continue
- }
- -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" {
- set see5 1
- exp_continue
- }
- -re "6\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location2\[^\r\n\]*" {
- set see6 1
- exp_continue
- }
- -re ".*$gdb_prompt $" {
- if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then {
- pass "check disable with convenience values"
- } else {
- fail "check disable with convenience values"
+with_test_prefix "with convenience vars" {
+ gdb_test "enable"
+ gdb_test "set \$foo = 3"
+ gdb_test "set \$bar = 6"
+ gdb_test_no_output "disable \$foo \$bar" "disable with convenience values"
+
+ set see1 0
+ set see2 0
+ set see3 0
+ set see4 0
+ set see5 0
+ set see6 0
+
+ gdb_test_multiple "info break" "check disable with convenience values" {
+ -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" {
+ set see1 1
+ exp_continue
+ }
+ -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" {
+ set see2 1
+ exp_continue
+ }
+ -re "3\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location7\[^\r\n\]*" {
+ set see3 1
+ exp_continue
+ }
+ -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" {
+ set see4 1
+ exp_continue
+ }
+ -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" {
+ set see5 1
+ exp_continue
+ }
+ -re "6\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location2\[^\r\n\]*" {
+ set see6 1
+ exp_continue
+ }
+ -re ".*$gdb_prompt $" {
+ if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then {
+ pass "check disable with convenience values"
+ } else {
+ fail "check disable with convenience values"
+ }
}
}
}
# test with bad values
-gdb_test "enable" "" ""
-gdb_test "disable 10" "No breakpoint number 10." \
- "disable non-existent breakpoint 10"
-
-gdb_test_no_output "set \$baz = 1.234"
-gdb_test "disable \$baz" \
- "Convenience variable must have integer value.*" \
- "disable with non-integer convenience var"
-gdb_test "disable \$grbx" \
- "Convenience variable must have integer value.*" \
- "disable with non-existent convenience var"
-gdb_test "disable \$10" \
- "History has not yet reached .10." \
- "disable with non-existent history value"
-gdb_test "disable \$1foo" \
- "Convenience variable must have integer value.*" \
- "disable with badly formed history value"
+with_test_prefix "bad values" {
+ gdb_test "enable"
+ gdb_test "disable 10" "No breakpoint number 10." \
+ "disable non-existent breakpoint 10"
+
+ gdb_test_no_output "set \$baz = 1.234"
+ gdb_test "disable \$baz" \
+ "Convenience variable must have integer value.*" \
+ "disable with non-integer convenience var"
+ gdb_test "disable \$grbx" \
+ "Convenience variable must have integer value.*" \
+ "disable with non-existent convenience var"
+ gdb_test "disable \$10" \
+ "History has not yet reached .10." \
+ "disable with non-existent history value"
+ gdb_test "disable \$1foo" \
+ "Convenience variable must have integer value.*" \
+ "disable with badly formed history value"
+}
# FIXME: The rest of this test doesn't work with anything that can't
# handle arguments.
gdb_breakpoint $break1_loc
gdb_test "continue" "breakpoint 1.*" "break1 start"
+gdb_test "checkpoint" "" "checkpoint one"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 two"
+gdb_test "checkpoint" "" "checkpoint two"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 three"
+gdb_test "checkpoint" "" "checkpoint three"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 four"
+gdb_test "checkpoint" "" "checkpoint four"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 five"
+gdb_test "checkpoint" "" "checkpoint five"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 six"
+gdb_test "checkpoint" "" "checkpoint six"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 seven"
+gdb_test "checkpoint" "" "checkpoint seven"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 eight"
+gdb_test "checkpoint" "" "checkpoint eight"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 nine"
+gdb_test "checkpoint" "" "checkpoint nine"
-gdb_test "checkpoint" ".*" ""
gdb_test "continue 10" "breakpoint 1.*" "break1 ten"
-
-gdb_test "checkpoint" ".*" ""
+gdb_test "checkpoint" "" "checkpoint ten"
gdb_test "info checkpoints" \
" 1 .* 2 .* 3 .* 4 .* 5 .* 6 .* 7 .* 8 .* 9 .* 10 .*" \
gdb_breakpoint $break1_loc
gdb_test "restart 1" "Switching to .*c == EOF.*" "restart 1 two"
-gdb_test "continue" ".*" ""
+gdb_test "continue" "" "continue, 1"
gdb_test "continue 100" "breakpoint 1.*" "breakpoint 1 1 one"
gdb_test "step" "if .c == EOF.*" "step in 1 two"
gdb_test "print lines" " = 102.*" "verify lines 1 two"
gdb_test "restart 2" "Switching to .*c == EOF.*" "restart 2 two"
-gdb_test "continue" ".*" ""
+gdb_test "continue" "" "continue, 2"
gdb_test "continue 100" "breakpoint 1.*" "breakpoint 1 2 one"
gdb_test "step" "if .c == EOF.*" "step in 2 two"
gdb_test "print lines" " = 112.*" "verify lines 2 two"
gdb_test "restart 3" "Switching to .*c == EOF.*" "restart 3 two"
-gdb_test "continue" ".*" ""
+gdb_test "continue" "" "continue, 3"
gdb_test "continue 500" "breakpoint 1.*" "breakpoint 1 3 one"
gdb_test "step" "if .c == EOF.*" "step in 3 two"
gdb_test "print lines" " = 522.*" "verify lines 3 two"
gdb_test "restart 4" "Switching to .*c == EOF.*" "restart 4 two"
-gdb_test "continue" ".*" ""
+gdb_test "continue" "" "continue, 4"
gdb_test "continue 500" "breakpoint 1.*" "breakpoint 1 4 one"
gdb_test "step" "if .c == EOF.*" "step in 4 two"
gdb_test "print lines" " = 532.*" "verify lines 4 two"
gdb_test "restart 5" "Switching to .*c == EOF.*" "restart 5 two"
-gdb_test "continue" ".*" ""
+gdb_test "continue" "" "continue, 5"
gdb_test "continue 1000" "breakpoint 1.*" "breakpoint 1 5 one"
gdb_test "step" "if .c == EOF.*" "step in 5 two"
gdb_test "print lines" " = 1042.*" "verify lines 5 two"
gdb_test "restart 6" "Switching to .*c == EOF.*" "restart 6 two"
-gdb_test "continue" ".*" ""
+gdb_test "continue" "" "continue, 6"
gdb_test "continue 1000" "breakpoint 1.*" "breakpoint 1 6 one"
gdb_test "step" "if .c == EOF.*" "step in 6 two"
gdb_test "print lines" " = 1052.*" "verify lines 6 two"
gdb_test "restart 7" "Switching to .*c == EOF.*" "restart 7 two"
-gdb_test "continue" ".*" ""
+gdb_test "continue" "" "continue, 7"
gdb_test "continue 1100" "breakpoint 1.*" "breakpoint 1 7 one"
gdb_test "step" "if .c == EOF.*" "step in 7 two"
gdb_test "print lines" " = 1162.*" "verify lines 7 two"
gdb_breakpoint "${testfile}.c:[gdb_get_line_number "loop-line" ${testfile}.c]" \
temporary
- # gdb_continue_to_breakpoint would print a pass message.
- gdb_test "continue" "Temporary breakpoint .* loop-line .*" ""
+ gdb_test "continue" "Temporary breakpoint .* loop-line .*"
- gdb_test_no_output "set range-stepping off" ""
- gdb_test_no_output "set debug infrun 1" ""
+ gdb_test_no_output "set range-stepping off"
+ gdb_test_no_output "set debug infrun 1"
- set test "run a bit #$pass"
set abort 1
- gdb_test_multiple "step" $test {
+ gdb_test_multiple "step" "run a bit" {
-re {\[infrun\] process_event_stop_test: stepping inside range} {
- # Suppress pass $test
- verbose -log "$pf_prefix $test: ran"
+ pass $gdb_test_name
set abort 0
}
}
set gdb_pid [exp_pid -i [board_info host fileid]]
remote_exec host "kill -TERM ${gdb_pid}"
- set test "expect eof #$pass"
+ set test "expect eof"
set abort 1
set stepping 0
# If GDB mishandles the SIGTERM and doesn't exit, this should FAIL
# with timeout. We don't expect a GDB prompt, so we see one,
# we'll FAIL too.
- gdb_test_multiple "" $test {
+ gdb_test_multiple "" "expect eof" {
eof {
- verbose -log "$pf_prefix $test: got eof"
+ pass "$gdb_test_name (got eof)"
set abort 0
}
-re {\[infrun\] process_event_stop_test: stepping inside range} {
set passes 50
for {set pass 0} {$pass < $passes} {incr pass} {
- clean_restart ${testfile}
- if { [do_test $pass] != 0 } {
- break
+ with_test_prefix "pass=$pass" {
+ clean_restart ${testfile}
+ if { [do_test $pass] != 0 } {
+ break
+ }
}
}
-re-not "#define THREE" \
-re-not "#define FOUR"
-gdb_test "next" ".*" ""
+gdb_test "next" "" "next, 1"
set r1 "#define FOO \" \""
set r2 "#define ONE"
-re-not "#define THREE" \
-re-not "#define FOUR"
-gdb_test "next" ".*" ""
+gdb_test "next" "" "next, 2"
-# in alpabetical order...
+# in alphabetical order...
set r1 "#define FOO \"world\""
set r2 "#define ONE"
set r3 "#define THREE"
set test "info macros *\$pc"
gdb_test_lines $test "" $r1.*$r2.*$r3.*$r4 \
-re-not "#define FOUR"
-gdb_test "next" ".*" ""
+gdb_test "next" "" "next, 3"
set r1 "#define FOO \" \""
set r2 "#define ONE"
gdb_test_lines $test $testname $r1.*$r2.*$r3 \
-re-not "#define THREE" \
-re-not "#define FOUR"
-gdb_test "next" ".*" ""
-gdb_test "next" ".*" ""
+gdb_test "next" "" "next, 4"
+gdb_test "next" "" "next, 5"
set r1 "#define DEF_MACROS"
set testname "$test 6"
-re-not "#define THREE" \
-re-not "#define FOUR"
-gdb_test "next" ".*" ""
+gdb_test "next" "" "next, 6"
set r1 "#define DEF_MACROS"
set r2 "#define FOO\\(a\\) foo = a"
set r3 "#define FOUR"
delete_breakpoints
gdb_breakpoint "pie_execl_marker"
-gdb_test "info breakpoints" ".*" ""
+gdb_test "info breakpoints" "" "info breakpoints first"
set addr1 ""
set test "pie_execl_marker address first"
}
}
-gdb_test "info breakpoints" ".*" ""
+gdb_test "info breakpoints" "" "info breakpoints second"
set addr2 ""
set test "pie_execl_marker address second"
set arg [lindex $args $x]
if { ($x == $final) || ([string first ".*" [lindex $args [expr $x + 1]]] >= 0) } {
set match [lindex $args [expr $x + 1]]
- if { $count == 1 } {
- set mess "$message"
- } else {
- set mess "$message (#$count)"
+ set mess "$message -- $match"
+ if { $count != 1 } {
+ append mess " (#$count)"
}
incr count
incr x
} else {
- set mess ""
set match ""
+ set mess "$message -- $match"
}
verbose "doing $arg $match"
- if [gdb_test "$arg" "$match" "$mess"] {
- fail "$message -- $match"
+ if [gdb_test -nopass "$arg" "$match" "$mess"] {
return 1
}
}
#
proc check_sizeof { type size } {
- gdb_test "next" "" ""
- gdb_test "p size" " = ${size}" "check sizeof \"$type\""
+ with_test_prefix "check sizeof \"$type\"" {
+ gdb_test "next"
+ gdb_test "p size" " = ${size}" "size matches"
+ }
}
check_sizeof "char" ${sizeof_char}
check_sizeof "long double" ${sizeof_long_double}
proc check_valueof { exp val } {
- gdb_test "next" "" ""
- gdb_test "p /d value" " = ${val}" "check valueof \"$exp\""
+ with_test_prefix "check valueof \"$exp\"" {
+ gdb_test "next"
+ gdb_test "p /d value" " = ${val}" "value matches"
+ }
}
# Check that GDB and the target agree over the sign of a character.
# A wrapper around 'clean_restart' from gdb.exp, this performs the
# normal clean_restart, but then disables the currently disabled
# style.
-proc clean_restart_and_disable { args } {
+proc clean_restart_and_disable { prefix args } {
global currently_disabled_style
- eval "clean_restart $args"
+ with_test_prefix "$prefix" {
+ eval "clean_restart $args"
- if { $currently_disabled_style != "" } {
- set st $currently_disabled_style
- gdb_test_no_output "set style $st background none" ""
- gdb_test_no_output "set style $st foreground none" ""
- gdb_test_no_output "set style $st intensity normal" ""
+ if { $currently_disabled_style != "" } {
+ set st $currently_disabled_style
+ gdb_test_no_output "set style $st background none"
+ gdb_test_no_output "set style $st foreground none"
+ gdb_test_no_output "set style $st intensity normal"
+ }
}
}
# Restart GDB with the correct TERM variable setting, this
# means that GDB will enable styling.
- clean_restart_and_disable ${binfile}
+ clean_restart_and_disable "restart 1" ${binfile}
set readnow [readnow]
set re_styled $re2_styled
}
- gdb_test_no_output "set width $width"
- gdb_test "frame" $re_styled "frame when width=$width"
-
- # Reset width back to 0. Doing this in the loop rather than
- # after, avoids trying to do "set width 30" while width is 20,
- # which causes horizontal scrolling in the case that the fallback
- # stub-termcap.c is used:
+ # Override width for the duration of the command, letting
+ # GDB reset back to 0. Doing this in the loop rather than
+ # after, avoids trying to do "set width 30" while width is
+ # 20, which causes horizontal scrolling in the case that
+ # the fallback stub-termcap.c is used:
# ^M<et width 30^M
# (gdb) FAIL: gdb.base/style.exp: all styles enabled: set width 30
- gdb_test_no_output "set width 0" ""
+ gdb_test "with width $width -- frame" $re_styled \
+ "frame when width=$width"
}
set macro_line [gdb_get_line_number "\#define SOME_MACRO"]
"short${cut_for_thre_expr}ad apply.*" \
]
- clean_restart_and_disable
+ clean_restart_and_disable "restart 2"
set quoted [string_to_regexp $binfile]
set pass_re "Reading symbols from [limited_style $quoted file]\.\.\."
# Restart GDB with the correct TERM variable setting, this
# means that GDB will enable styling.
- clean_restart_and_disable $::binfile
+ clean_restart_and_disable "restart 3" $::binfile
set styled_hex [limited_style $::hex address]
set main [limited_style main function]
fail $test
}
}
- gdb_test_no_output "set variable size = $rdsize" ""
- gdb_test_no_output "set variable offset = $rdoffset" ""
+ gdb_test_no_output -nopass "set variable size = $rdsize"
+ gdb_test_no_output -nopass "set variable offset = $rdoffset"
set test "continue"
set got_hit 0
gdb_test_multiple $test $test {
-re " start_again .*\r\n$gdb_prompt $" {
}
}
- gdb_test_no_output "delete $wpnum" ""
+ gdb_test_no_output -nopass "delete $wpnum"
set test "wp(size=$wpsize offset=$wpoffset) rd(size=$rdsize offset=$rdoffset) expect=$expect_hit"
if {$expect_hit == $got_hit} {
pass $test
}
}
}
- gdb_test_no_output "set variable size = 1" ""
- gdb_test_no_output "set variable offset = 1" ""
+ gdb_test_no_output -nopass "set variable size = 1"
+ gdb_test_no_output -nopass "set variable offset = 1"
set test "continue"
set got_hit 0
gdb_test_multiple $test $test {
clean_restart $testfile
if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} {
- gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+ gdb_test_no_output "set can-use-hw-watchpoints 0"\
+ "disable fast watches, 1"
}
if [initialize] then {
clean_restart $testfile
if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} {
- gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+ gdb_test_no_output "set can-use-hw-watchpoints 0" \
+ "disable fast watches, 2"
}
# Only enabled for some targets merely because it has not been tested
fail "set test_function breakpoint for $func"
} elseif { [gdb_test "continue" \
"Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \
- ""] != 0 } {
- fail "continue to test_function for $func"
+ "continue to test_function for $func"] != 0 } {
} else {
gdb_breakpoint "$func"
set i [expr {[string last : $func] + 1}]
fail "set test_function breakpoint for $func"
} elseif {[gdb_test "continue" \
"Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \
- ""] != 0} {
- fail "continue to test_function for $func"
+ "continue to test_function for $func"] != 0} {
} else {
gdb_breakpoint "$func"
gdb_test "continue" \
}
set pre_regs($count) [capture_command_output "info all-registers" ""]
- gdb_test "si" "" ""
+ gdb_test -nopass "si"
}
# Registers contents after each backward single step.
for {set i [expr $count - 1]} {$i >= 0} {incr i -1} {
- gdb_test "reverse-stepi" "" ""
+ gdb_test -nopass "reverse-stepi"
set post_regs($i) [capture_command_output "info all-registers" ""]
}
# Proceed to end of main
gdb_test "break $endmain" \
- "Breakpoint.* file .*$srcfile, line $endmain.*" ""
+ "Breakpoint.* file .*$srcfile, line $endmain.*" \
+ "break at end of main"
gdb_test_multiple "continue" "go to end of main forward" {
-re ".*Breakpoint $decimal,.*$srcfile:$endmain.*$gdb_prompt $" {
#
# Module global variable, reverse
-
-set breakloc [gdb_get_line_number \
- "module_global_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print aglobal" ".* = 0$newline" "module global reverse-breakpoint"
-gdb_test "step" ".* module global post-change .*" ""
-gdb_test "print aglobal" ".* = 1$newline" "module global forward past bp"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print aglobal" ".* = 0$newline" "module global reverse-step to bp"
-
+with_test_prefix "module global variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "module_global_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print aglobal" " = 0$newline" "module global reverse-breakpoint"
+ gdb_test "step" " module global post-change .*"
+ gdb_test "print aglobal" " = 1$newline" "module global forward past bp"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print aglobal" " = 0$newline" "module global reverse-step to bp"
+}
# Module static variable, reverse
-
-set breakloc [gdb_get_line_number \
- "module_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print astatic" ".* = 0$newline" "module static reverse-breakpoint"
-gdb_test "step" ".* module static post-change .*" ""
-gdb_test "print astatic" ".* = 1$newline" "module static forward"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print astatic" ".* = 0$newline" "module static reverse-step"
+with_test_prefix "module static variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "module_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print astatic" " = 0$newline" "module static reverse-breakpoint"
+ gdb_test "step" " module static post-change .*"
+ gdb_test "print astatic" " = 1$newline" "module static forward"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print astatic" " = 0$newline" "module static reverse-step"
+}
# Function static variable, reverse
-
-set breakloc [gdb_get_line_number \
- "function_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "function static reverse-breakpoint"
-gdb_test "step" ".* function static post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "function static forward"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "function static reverse-step"
+with_test_prefix "function static variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "function_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "function static reverse-breakpoint"
+ gdb_test "step" " function static post-change .*"
+ gdb_test "print a" " = 1$newline" "function static forward"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print a" " = 0$newline" "function static reverse-step"
+}
# Auto variable, reverse
-
-set breakloc [gdb_get_line_number \
- "auto_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "auto var reverse-breakpoint"
-gdb_test "step" ".* auto post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "auto var forward"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "auto var reverse-step"
+with_test_prefix "auto variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "auto_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "auto var reverse-breakpoint"
+ gdb_test "step" " auto post-change .*"
+ gdb_test "print a" " = 1$newline" "auto var forward"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print a" " = 0$newline" "auto var reverse-step"
+}
# Register variable, reverse
-
-set breakloc [gdb_get_line_number \
- "register_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "register var reverse-breakpoint"
-gdb_test "step" ".* register post-change .*" ""
-gdb_test "print a" ".* = 1$newline" \
- "register var step post-change, first time"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "register var reverse step-to"
+with_test_prefix "register variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "register_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "register var reverse-breakpoint"
+ gdb_test "step" " register post-change .*"
+ gdb_test "print a" " = 1$newline" \
+ "register var step post-change, first time"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print a" " = 0$newline" "register var reverse step-to"
+}
# Proceed to beginning of main
-gdb_test "tbreak $beginmain" ".*$srcfile, line $beginmain.*" ""
+gdb_test "tbreak $beginmain" ".*$srcfile, line $beginmain.*" \
+ "tbreak at beginning of main"
gdb_test "reverse-continue" ".*$srcfile:$beginmain.*" "reverse to main"
# Now repeat tests while replaying forward.
# Register variable, forward
-
-set breakloc [gdb_get_line_number \
- "register_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "register var forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "register var forward step-to"
-gdb_test "step" ".* register post-change .*" ""
-gdb_test "print a" ".* = 1$newline" \
- "register var step post-change, second time"
+with_test_prefix "register variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "register_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "register var forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print a" " = 0$newline" "register var forward step-to"
+ gdb_test "step" " register post-change .*" "step, 2"
+ gdb_test "print a" " = 1$newline" \
+ "register var step post-change, second time"
+}
# Auto variable, forward
-
-set breakloc [gdb_get_line_number \
- "auto_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "auto var forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "auto var forward step-to"
-gdb_test "step" ".* auto post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "auto var step post-change"
+with_test_prefix "auto variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "auto_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "auto var forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print a" " = 0$newline" "auto var forward step-to"
+ gdb_test "step" " auto post-change .*" "step, 2"
+ gdb_test "print a" " = 1$newline" "auto var step post-change"
+}
# Function static variable, forward
-
-set breakloc [gdb_get_line_number \
- "function_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "function static forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "function static forward step-to"
-gdb_test "step" ".* function static post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "function static step post-change"
+with_test_prefix "function static variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "function_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "function static forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print a" " = 0$newline" "function static forward step-to"
+ gdb_test "step" " function static post-change .*" "step, 2"
+ gdb_test "print a" " = 1$newline" "function static step post-change"
+}
# Module static variable, forward
-
-set breakloc [gdb_get_line_number \
- "module_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print astatic" ".* = 0$newline" "module static forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print astatic" ".* = 0$newline" "module static forward step-to"
-gdb_test "step" ".* module static post-change .*" ""
-gdb_test "print astatic" ".* = 1$newline" "module static step post-change"
+with_test_prefix "module static variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "module_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print astatic" " = 0$newline" "module static forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print astatic" " = 0$newline" "module static forward step-to"
+ gdb_test "step" " module static post-change .*" "step, 2"
+ gdb_test "print astatic" " = 1$newline" "module static step post-change"
+}
# Module global variable, forward
-
-set breakloc [gdb_get_line_number \
- "module_global_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print aglobal" ".* = 0$newline" "module global forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print aglobal" ".* = 0$newline" "module global forward step-to"
-gdb_test "step" ".* module global post-change .*" ""
-gdb_test "print aglobal" ".* = 1$newline" "module global step post-change"
+with_test_prefix "module global variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "module_global_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print aglobal" " = 0$newline" "module global forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print aglobal" " = 0$newline" "module global forward step-to"
+ gdb_test "step" " module global post-change .*" "step, 2"
+ gdb_test "print aglobal" " = 1$newline" "module global step post-change"
+}
# Proceed to end of main
gdb_test "break $endmain" \
- "Breakpoint.* file .*$srcfile, line $endmain.*" ""
+ "Breakpoint.* file .*$srcfile, line $endmain.*" \
+ "break at end of main"
gdb_continue_to_breakpoint "end of main" ".*$srcfile:$endmain.*"
###
#
# Module global variable, reverse
-
-set breakloc [gdb_get_line_number \
- "module_global_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print aglobal" ".* = 0$newline" "module global reverse-breakpoint"
-gdb_test "step" ".* module global post-change .*" ""
-gdb_test "print aglobal" ".* = 1$newline" "module global forward past bp"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print aglobal" ".* = 0$newline" "module global reverse-step to bp"
-
+with_test_prefix "module global variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "module_global_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print aglobal" " = 0$newline" "module global reverse-breakpoint"
+ gdb_test "step" " module global post-change .*"
+ gdb_test "print aglobal" " = 1$newline" "module global forward past bp"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print aglobal" " = 0$newline" "module global reverse-step to bp"
+}
# Module static variable, reverse
-
-set breakloc [gdb_get_line_number \
- "module_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print astatic" ".* = 0$newline" "module static reverse-breakpoint"
-gdb_test "step" ".* module static post-change .*" ""
-gdb_test "print astatic" ".* = 1$newline" "module static forward"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print astatic" ".* = 0$newline" "module static reverse-step"
+with_test_prefix "module static variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "module_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print astatic" " = 0$newline" "module static reverse-breakpoint"
+ gdb_test "step" " module static post-change .*"
+ gdb_test "print astatic" " = 1$newline" "module static forward"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print astatic" " = 0$newline" "module static reverse-step"
+}
# Function static variable, reverse
-
-set breakloc [gdb_get_line_number \
- "function_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "function static reverse-breakpoint"
-gdb_test "step" ".* function static post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "function static forward"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "function static reverse-step"
+with_test_prefix "function static variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "function_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "function static reverse-breakpoint"
+ gdb_test "step" " function static post-change .*"
+ gdb_test "print a" " = 1$newline" "function static forward"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print a" " = 0$newline" "function static reverse-step"
+}
# Auto variable, reverse
-
-set breakloc [gdb_get_line_number \
- "auto_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "auto var reverse-breakpoint"
-gdb_test "step" ".* auto post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "auto var forward"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "auto var reverse-step"
+with_test_prefix "auto variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "auto_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "auto var reverse-breakpoint"
+ gdb_test "step" " auto post-change .*"
+ gdb_test "print a" " = 1$newline" "auto var forward"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print a" " = 0$newline" "auto var reverse-step"
+}
# Register variable, reverse
-
-set breakloc [gdb_get_line_number \
- "register_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "register var reverse-breakpoint"
-gdb_test "step" ".* register post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "register var step post-change"
-gdb_test "reverse-step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" \
- "register var reverse step-to, first time"
+with_test_prefix "register variable, reverse" {
+ set breakloc [gdb_get_line_number \
+ "register_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "register var reverse-breakpoint"
+ gdb_test "step" " register post-change .*"
+ gdb_test "print a" " = 1$newline" "register var step post-change"
+ gdb_test "reverse-step" "$newline$breakloc.*"
+ gdb_test "print a" " = 0$newline" \
+ "register var reverse step-to, first time"
+}
# Proceed to beginning of main
-gdb_test "tbreak $beginmain" ".*$srcfile, line $beginmain.*" ""
-gdb_test "reverse-continue" ".*$srcfile:$beginmain.*" "reverse to main"
+gdb_test "tbreak $beginmain" "$srcfile, line $beginmain.*"
+gdb_test "reverse-continue" "$srcfile:$beginmain.*" "reverse to main"
# Now repeat tests while replaying forward.
# Register variable, forward
-set breakloc [gdb_get_line_number \
- "register_state: set breakpoint here" $srcfile]
+with_test_prefix "register variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "register_state: set breakpoint here" $srcfile]
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
-gdb_test "print a" ".* = 0$newline" "register var forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "register var forward step-to"
-gdb_test "step" ".* register post-change .*" ""
-gdb_test "print a" ".* = 1$newline" \
- "register var step post-change, second time"
+ gdb_test "print a" " = 0$newline" "register var forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print a" " = 0$newline" "register var forward step-to"
+ gdb_test "step" " register post-change .*" "step, 2"
+ gdb_test "print a" " = 1$newline" \
+ "register var step post-change, second time"
+}
# Auto variable, forward
-
-set breakloc [gdb_get_line_number \
- "auto_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "auto var forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "auto var forward step-to"
-gdb_test "step" ".* auto post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "auto var step post-change"
+with_test_prefix "auto variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "auto_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "auto var forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print a" " = 0$newline" "auto var forward step-to"
+ gdb_test "step" " auto post-change .*" "step, 2"
+ gdb_test "print a" " = 1$newline" "auto var step post-change"
+}
# Function static variable, forward
-
-set breakloc [gdb_get_line_number \
- "function_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print a" ".* = 0$newline" "function static forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print a" ".* = 0$newline" "function static forward step-to"
-gdb_test "step" ".* function static post-change .*" ""
-gdb_test "print a" ".* = 1$newline" "function static step post-change"
+with_test_prefix "function static variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "function_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print a" " = 0$newline" "function static forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print a" " = 0$newline" "function static forward step-to"
+ gdb_test "step" " function static post-change .*" "step, 2"
+ gdb_test "print a" " = 1$newline" "function static step post-change"
+}
# Module static variable, forward
-
-set breakloc [gdb_get_line_number \
- "module_static_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print astatic" ".* = 0$newline" "module static forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print astatic" ".* = 0$newline" "module static forward step-to"
-gdb_test "step" ".* module static post-change .*" ""
-gdb_test "print astatic" ".* = 1$newline" "module static step post-change"
+with_test_prefix "module static variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "module_static_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print astatic" " = 0$newline" "module static forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print astatic" " = 0$newline" "module static forward step-to"
+ gdb_test "step" " module static post-change .*" "step, 2"
+ gdb_test "print astatic" " = 1$newline" "module static step post-change"
+}
# Module global variable, forward
-
-set breakloc [gdb_get_line_number \
- "module_global_state: set breakpoint here" $srcfile]
-
-gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" ""
-gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc"
-
-gdb_test "print aglobal" ".* = 0$newline" "module global forward-breakpoint"
-gdb_test "reverse-step" ".*hide.*" ""
-gdb_test "step" ".*$newline$breakloc.*" ""
-gdb_test "print aglobal" ".* = 0$newline" "module global forward step-to"
-gdb_test "step" ".* module global post-change .*" ""
-gdb_test "print aglobal" ".* = 1$newline" "module global step post-change"
-
+with_test_prefix "module global variable, forward" {
+ set breakloc [gdb_get_line_number \
+ "module_global_state: set breakpoint here" $srcfile]
+
+ gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*"
+ gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc"
+
+ gdb_test "print aglobal" " = 0$newline" "module global forward-breakpoint"
+ gdb_test "reverse-step" "hide.*"
+ gdb_test "step" "$newline$breakloc.*" "step, 1"
+ gdb_test "print aglobal" " = 0$newline" "module global forward step-to"
+ gdb_test "step" " module global post-change .*" "step, 2"
+ gdb_test "print aglobal" " = 1$newline" "module global step post-change"
+}
proc my_gdb_test {cmd pattern message} {
upvar inf inf
upvar iter iter
- if {[gdb_test_multiple $cmd "access mem ($message, inf=$inf, iter=$iter)" {
- -wrap -re $pattern {
- }
- }] != 0} {
+ if {[gdb_test -nopass \
+ $cmd $pattern "access mem ($message, inf=$inf, iter=$iter)"] \
+ != 0} {
uplevel 1 {set ok 0}
return -code break
}
while {!$::done && $ok} {
incr iter
verbose -log "xxxxx: iteration $iter"
- gdb_test "info threads" ".*" ""
+ gdb_test -nopass "info threads"
if {$inf == 1} {
set inf 2
break
}
- gdb_test "detach" "Detaching from.*" ""
+ gdb_test -nopass "detach" "Detaching from.*"
}
if {$passes < 3} {
} elseif {$step_at == 1 && $now == 2} {
set failed 0
# Continue over the re-signalling back to the handle entry.
- gdb_test_no_output {enable $step1} ""
- gdb_test "continue" " step-1 .*" ""
+ gdb_test_no_output -nopass {enable $step1}
+ gdb_test -nopass "continue" " step-1 .*"
set now 1
- gdb_test_no_output {disable $step1} ""
+ gdb_test_no_output -nopass {disable $step1}
} else {
fail $test
}
# created above.
gdb_breakpoint "main"
gdb_run_cmd
-if {[gdb_test "" "Breakpoint .*"] != 0} {
+if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} {
return -1
}
gdb_tfind_test "8.6: find start frame" "start" "0"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp2:" ""
+ "TDP $tdp2:" "printf TDP start"
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 1, collect nothing"
gdb_tfind_test "8.6: find frame 1" "1" "1"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp3:" ""
+ "TDP $tdp3:" "printf TDP frame 1"
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 1, collect regs"
gdb_tfind_test "8.6: find frame 2" "2" "2"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp4:" ""
+ "TDP $tdp4:" "printf TDP frame 2"
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 1, collect args and locals"
gdb_tfind_test "8.6: find frame 4" "4" "4"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp6:" ""
+ "TDP $tdp6:" "printf TDP frame 4"
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 4
gdb_tfind_test "8.6: find frame 5" "5" "5"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp2:" ""
+ "TDP $tdp2:" "printf TDP frame 5"
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 2, collect nothing"
gdb_tfind_test "8.6: find frame 6" "6" "6"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp3:" ""
+ "TDP $tdp3:" "printf TDP frame 6"
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 2, collect regs"
gdb_tfind_test "8.6: find frame 7" "7" "7"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp4:" ""
+ "TDP $tdp4:" "printf TDP frame 7"
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 2, collect args and locals"
gdb_tfind_test "8.6: find frame 9" "9" "9"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp6:" ""
+ "TDP $tdp6:" "printf TDP frame 9"
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 9
gdb_tfind_test "8.6: find frame 10" "10" "10"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp2:" ""
+ "TDP $tdp2:" "printf TDP frame 10"
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 3, collect nothing"
gdb_tfind_test "8.6: find frame 11" "11" "11"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp3:" ""
+ "TDP $tdp3:" "printf TDP frame 11"
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 3, collect regs"
gdb_tfind_test "8.6: find frame 12" "12" "12"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp4:" ""
+ "TDP $tdp4:" "printf TDP frame 12"
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 3, collect args and locals"
gdb_tfind_test "8.6: find frame 14" "14" "14"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp6:" ""
+ "TDP $tdp6:" "printf TDP frame 14"
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 14
gdb_tfind_test "8.6: find frame 15" "15" "15"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp2:" ""
+ "TDP $tdp2:" "printf TDP frame 15"
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 4, collect nothing"
gdb_tfind_test "8.6: find frame 16" "16" "16"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp3:" ""
+ "TDP $tdp3:" "printf TDP frame 16"
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 4, collect regs"
gdb_tfind_test "8.6: find frame 17" "17" "17"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp4:" ""
+ "TDP $tdp4:" "printf TDP frame 17"
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 4, collect args and locals"
gdb_tfind_test "8.6: find frame 19" "19" "19"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
- "TDP $tdp6:" ""
+ "TDP $tdp6:" "printf TDP frame 19"
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 19
gdb_test "printf \"x \%d x\\n\", depth == 3" \
"1.13: trace in recursion: depth not equal to 3"
# Finished!
-gdb_test "tfind none" ".*" ""
+gdb_test "tfind none" ".*"
gdb_breakpoint "end" qualified
}
-proc run_trace_experiment { msg test_func } {
+proc run_trace_experiment { test_func } {
global gdb_prompt
- gdb_test "continue" \
- ".*Breakpoint \[0-9\]+, begin .*" \
- "collect $msg: advance to begin"
+ with_test_prefix "run trace experiment" {
+ gdb_test "continue" \
+ ".*Breakpoint \[0-9\]+, begin .*" \
+ "advance to begin"
- set test "collect $msg: start trace experiment"
- gdb_test_multiple "tstart" "$test" {
- -re "^tstart\r\n$gdb_prompt $" {
- pass "$test"
- }
- }
+ gdb_test_no_output "tstart" "start trace experiment"
- gdb_test "continue" \
+ gdb_test "continue" \
"Continuing.*Breakpoint \[0-9\]+, end.*" \
- "collect $msg: run trace experiment"
- gdb_test "tstop" \
+ "run trace experiment"
+ gdb_test "tstop" \
"\[\r\n\]+" \
- "collect $msg: stop trace experiment"
- gdb_test "tfind start" \
+ "stop trace experiment"
+ gdb_test "tfind start" \
"#0 $test_func .*" \
- "collect $msg: tfind test frame"
+ "tfind test frame"
+ }
}
global cr
global gdb_prompt
- prepare_for_trace_test
+ with_test_prefix "collect $msg" {
+ prepare_for_trace_test
- gdb_test "trace args_test_func" \
+ gdb_test "trace args_test_func" \
"Tracepoint \[0-9\]+ at .*" \
- "collect $msg: set tracepoint"
- gdb_trace_setactions "collect $msg: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect $myargs" "^$"
- # Begin the test.
- run_trace_experiment $msg args_test_func
+ # Begin the test.
+ run_trace_experiment args_test_func
- # Frame arguments and their entry values are displayed correctly with
- # various values of "print entry-values" when a trace frame is
- # selected.
+ # Frame arguments and their entry values are displayed correctly with
+ # various values of "print entry-values" when a trace frame is
+ # selected.
- gdb_test "tfind -1" ".*" ""
- gdb_test_no_output "set print entry-values only" ""
- gdb_test "tfind 0" \
- " \\(argc@entry=\[^,\]*, argi@entry=\[^,\]*, argf@entry=\[^,\]*, argd@entry=\[^,\]*, argstruct@entry=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
- "collect $msg: tfind 0 with entry-values only"
+ with_test_prefix "entry-values only" {
+ gdb_test "tfind -1" ".*"
+ gdb_test_no_output "set print entry-values only"
+ gdb_test "tfind 0" \
+ " \\(argc@entry=\[^,\]*, argi@entry=\[^,\]*, argf@entry=\[^,\]*, argd@entry=\[^,\]*, argstruct@entry=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
+ "tfind 0 with entry-values only"
+ }
- gdb_test "tfind -1" ".*" ""
- gdb_test_no_output "set print entry-values both" ""
- gdb_test "tfind 0" \
- " \\(argc=\[^,\]*, argc@entry=\[^,\]*, argi=\[^,\]*, argi@entry=\[^,\]*, argf=\[^,\]*, argf@entry=\[^,\]*, argd=\[^,\]*, argd@entry=\[^,\]*, argstruct=\[^,\]*, argstruct@entry=\[^,\]*, argarray=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
- "collect $msg: tfind 0 with entry-values both"
+ with_test_prefix "entry-values both" {
+ gdb_test "tfind -1" ".*" ""
+ gdb_test_no_output "set print entry-values both" ""
+ gdb_test "tfind 0" \
+ " \\(argc=\[^,\]*, argc@entry=\[^,\]*, argi=\[^,\]*, argi@entry=\[^,\]*, argf=\[^,\]*, argf@entry=\[^,\]*, argd=\[^,\]*, argd@entry=\[^,\]*, argstruct=\[^,\]*, argstruct@entry=\[^,\]*, argarray=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
+ "tfind 0 with entry-values both"
+ }
- gdb_test "print argc" \
+ gdb_test "print argc" \
"\\$\[0-9\]+ = 1 '.001'$cr" \
- "collect $msg: collected arg char"
- gdb_test "print argi" \
+ "collected arg char"
+ gdb_test "print argi" \
"\\$\[0-9\]+ = 2$cr" \
- "collect $msg: collected arg int"
- gdb_test "print argf" \
+ "collected arg int"
+ gdb_test "print argf" \
"\\$\[0-9\]+ = 3.\[23\]\[0-9\]*$cr" \
- "collect $msg: collected arg float"
- gdb_test "print argd" \
+ "collected arg float"
+ gdb_test "print argd" \
"\\$\[0-9\]+ = 4.\[34\]\[0-9\]*$cr" \
- "collect $msg: collected arg double"
+ "collected arg double"
- # struct arg as one of several args (near end of list)
- gdb_test "print argstruct.memberc" \
+ # struct arg as one of several args (near end of list)
+ gdb_test "print argstruct.memberc" \
"\\$\[0-9\]+ = 101 'e'$cr" \
- "collect $msg: collected arg struct member char"
- gdb_test "print argstruct.memberi" \
+ "collected arg struct member char"
+ gdb_test "print argstruct.memberi" \
"\\$\[0-9\]+ = 102$cr" \
- "collect $msg: collected arg struct member int"
- gdb_test "print argstruct.memberf" \
+ "collected arg struct member int"
+ gdb_test "print argstruct.memberf" \
"\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \
- "collect $msg: collected arg struct member float"
- gdb_test "print argstruct.memberd" \
+ "collected arg struct member float"
+ gdb_test "print argstruct.memberd" \
"\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \
- "collect $msg: collected arg struct member double"
+ "collected arg struct member double"
- # array arg as one of several args (near end of list)
+ # array arg as one of several args (near end of list)
- # It isn't clear why is the test assuming the array's elements are
- # collected. In C, an array as function parameters is a special
- # case; it's just a pointer into the caller's array, and as such,
- # that's what normally the debug info describes. Maybe this was
- # originaly written for a compiler where array parameters were
- # really described as arrays in debug info.
+ # It isn't clear why is the test assuming the array's elements are
+ # collected. In C, an array as function parameters is a special
+ # case; it's just a pointer into the caller's array, and as such,
+ # that's what normally the debug info describes. Maybe this was
+ # originaly written for a compiler where array parameters were
+ # really described as arrays in debug info.
- setup_xfail "*-*-*"
- gdb_test "print argarray\[0\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[0\]" \
"\\$\[0-9\]+ = 111$cr" \
- "collect $msg: collected argarray #0"
+ "collected argarray #0"
- setup_xfail "*-*-*"
- gdb_test "print argarray\[1\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[1\]" \
"\\$\[0-9\]+ = 112$cr" \
- "collect $msg: collected argarray #1"
+ "collected argarray #1"
- setup_xfail "*-*-*"
- gdb_test "print argarray\[2\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[2\]" \
"\\$\[0-9\]+ = 113$cr" \
- "collect $msg: collected argarray #2"
+ "collected argarray #2"
- setup_xfail "*-*-*"
- gdb_test "print argarray\[3\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[3\]" \
"\\$\[0-9\]+ = 114$cr" \
- "collect $msg: collected argarray #3"
+ "collected argarray #3"
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect $msg: cease trace debugging"
+ "cease trace debugging"
+ }
}
proc gdb_collect_argstruct_test { myargs msg } {
global cr
global gdb_prompt
- prepare_for_trace_test
+ with_test_prefix "collect $msg" {
+ prepare_for_trace_test
- gdb_test "trace argstruct_test_func" \
+ gdb_test "trace argstruct_test_func" \
"Tracepoint \[0-9\]+ at .*" \
- "collect $msg: set tracepoint"
- gdb_trace_setactions "collect $msg: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect $myargs" "^$"
- # Begin the test.
- run_trace_experiment $msg argstruct_test_func
+ # Begin the test.
+ run_trace_experiment argstruct_test_func
- # struct argument as only argument
- gdb_test "print argstruct.memberc" \
+ # struct argument as only argument
+ gdb_test "print argstruct.memberc" \
"\\$\[0-9\]+ = 101 'e'$cr" \
- "collect $msg: collected arg struct member char"
- gdb_test "print argstruct.memberi" \
+ "collected arg struct member char"
+ gdb_test "print argstruct.memberi" \
"\\$\[0-9\]+ = 102$cr" \
- "collect $msg: collected arg struct member int"
- gdb_test "print argstruct.memberf" \
+ "collected arg struct member int"
+ gdb_test "print argstruct.memberf" \
"\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \
- "collect $msg: collected arg struct member float"
- gdb_test "print argstruct.memberd" \
+ "collected arg struct member float"
+ gdb_test "print argstruct.memberd" \
"\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \
- "collect $msg: collected arg struct member double"
+ "collected arg struct member double"
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect $msg: cease trace debugging"
+ "cease trace debugging"
+ }
}
global cr
global gdb_prompt
- prepare_for_trace_test
+ with_test_prefix "collect $msg" {
- gdb_test "trace argarray_test_func" \
+ prepare_for_trace_test
+
+ gdb_test "trace argarray_test_func" \
"Tracepoint \[0-9\]+ at .*" \
- "collect $msg: set tracepoint"
- gdb_trace_setactions "collect $msg: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect $myargs" "^$"
- # Begin the test.
- run_trace_experiment $msg argarray_test_func
+ # Begin the test.
+ run_trace_experiment argarray_test_func
- # array arg as only argument
+ # array arg as only argument
- # It isn't clear why is the test assuming the array's elements are
- # collected. In C, an array as function parameters is a special
- # case; it's just a pointer into the caller's array, and as such,
- # that's what normally the debug info describes. Maybe this was
- # originaly written for a compiler where array parameters were
- # really described as arrays in debug info.
+ # It isn't clear why is the test assuming the array's elements
+ # are collected. In C, an array as function parameters is a
+ # special case; it's just a pointer into the caller's array,
+ # and as such, that's what normally the debug info describes.
+ # Maybe this was originaly written for a compiler where array
+ # parameters were really described as arrays in debug info.
- setup_xfail "*-*-*"
- gdb_test "print argarray\[0\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[0\]" \
"\\$\[0-9\]+ = 111$cr" \
- "collect $msg: collected argarray #0"
+ "collected argarray #0"
- setup_xfail "*-*-*"
- gdb_test "print argarray\[1\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[1\]" \
"\\$\[0-9\]+ = 112$cr" \
- "collect $msg: collected argarray #1"
+ "collected argarray #1"
- setup_xfail "*-*-*"
- gdb_test "print argarray\[2\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[2\]" \
"\\$\[0-9\]+ = 113$cr" \
- "collect $msg: collected argarray #2"
+ "collected argarray #2"
- setup_xfail "*-*-*"
- gdb_test "print argarray\[3\]" \
+ setup_xfail "*-*-*"
+ gdb_test "print argarray\[3\]" \
"\\$\[0-9\]+ = 114$cr" \
- "collect $msg: collected argarray #3"
+ "collected argarray #3"
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect $msg: cease trace debugging"
+ "cease trace debugging"
+ }
}
global cr
global gdb_prompt
- prepare_for_trace_test
-
- # Find the comment-identified line for setting this tracepoint.
- set testline 0
- gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" {
- -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
- set testline $expect_out(1,string)
- pass "collect $msg: find tracepoint line"
+ with_test_prefix "collect $msg" {
+ prepare_for_trace_test
+
+ # Find the comment-identified line for setting this tracepoint.
+ set testline 0
+ gdb_test_multiple "list $func, +30" "find tracepoint line" {
+ -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
+ set testline $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ -re ".*$gdb_prompt " {
+ fail "$gdb_test_name (skipping locals test)"
+ return
+ }
+ timeout {
+ fail "$gdb_test_name (skipping locals test)"
+ return
+ }
}
- -re ".*$gdb_prompt " {
- fail "collect $msg: find tracepoint line (skipping locals test)"
- return
- }
- timeout {
- fail "collect $msg: find tracepoint line (skipping locals test)"
- return
- }
- }
- gdb_test "trace $testline" \
+ gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
- "collect $msg: set tracepoint"
- gdb_trace_setactions "collect $msg: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect $mylocs" "^$"
- # Begin the test.
- run_trace_experiment $msg $func
+ # Begin the test.
+ run_trace_experiment $func
- gdb_test "print locc" \
- "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \
- "collect $msg: collected local char"
- gdb_test "print loci" \
+ gdb_test "print locc" \
+ "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \
+ "collected local char"
+ gdb_test "print loci" \
"\\$\[0-9\]+ = 12$cr" \
- "collect $msg: collected local int"
- gdb_test "print locf" \
+ "collected local int"
+ gdb_test "print locf" \
"\\$\[0-9\]+ = 13.\[23\]\[0-9\]*$cr" \
- "collect $msg: collected local float"
- gdb_test "print locd" \
+ "collected local float"
+ gdb_test "print locd" \
"\\$\[0-9\]+ = 14.\[34\]\[0-9\]*$cr" \
- "collect $msg: collected local double"
+ "collected local double"
- gdb_test "print locst.memberc" \
+ gdb_test "print locst.memberc" \
"\\$\[0-9\]+ = 15 '.017'$cr" \
- "collect $msg: collected local member char"
- gdb_test "print locst.memberi" \
+ "collected local member char"
+ gdb_test "print locst.memberi" \
"\\$\[0-9\]+ = 16$cr" \
- "collect $msg: collected local member int"
- gdb_test "print locst.memberf" \
+ "collected local member int"
+ gdb_test "print locst.memberf" \
"\\$\[0-9\]+ = 17.\[67\]\[0-9\]*$cr" \
- "collect $msg: collected local member float"
- gdb_test "print locst.memberd" \
+ "collected local member float"
+ gdb_test "print locst.memberd" \
"\\$\[0-9\]+ = 18.\[78\]\[0-9\]*$cr" \
- "collect $msg: collected local member double"
+ "collected local member double"
- gdb_test "print locar\[0\]" \
+ gdb_test "print locar\[0\]" \
"\\$\[0-9\]+ = 121$cr" \
- "collect $msg: collected locarray #0"
- gdb_test "print locar\[1\]" \
+ "collected locarray #0"
+ gdb_test "print locar\[1\]" \
"\\$\[0-9\]+ = 122$cr" \
- "collect $msg: collected locarray #1"
- gdb_test "print locar\[2\]" \
+ "collected locarray #1"
+ gdb_test "print locar\[2\]" \
"\\$\[0-9\]+ = 123$cr" \
- "collect $msg: collected locarray #2"
- gdb_test "print locar\[3\]" \
+ "collected locarray #2"
+ gdb_test "print locar\[3\]" \
"\\$\[0-9\]+ = 124$cr" \
- "collect $msg: collected locarray #3"
-
+ "collected locarray #3"
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect $msg: cease trace debugging"
+ "cease trace debugging"
+ }
}
proc gdb_collect_registers_test { myregs } {
global spreg
global pcreg
- prepare_for_trace_test
+ with_test_prefix "collect $myregs" {
+ prepare_for_trace_test
- # We'll simply re-use the args_test_function for this test
- gdb_test "trace args_test_func" \
+ # We'll simply re-use the args_test_function for this test
+ gdb_test "trace args_test_func" \
"Tracepoint \[0-9\]+ at .*" \
- "collect $myregs: set tracepoint"
- gdb_trace_setactions "collect $myregs: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect $myregs" "^$"
- # Begin the test.
- run_trace_experiment $myregs args_test_func
+ # Begin the test.
+ run_trace_experiment args_test_func
- test_register "\$$fpreg" $myregs
- test_register "\$$spreg" $myregs
- test_register "\$$pcreg" $myregs
+ test_register "\$$fpreg" $myregs
+ test_register "\$$spreg" $myregs
+ test_register "\$$pcreg" $myregs
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect $myregs: cease trace debugging"
+ "cease trace debugging"
+ }
}
proc gdb_collect_expression_test { func expr val msg } {
prepare_for_trace_test
- # Find the comment-identified line for setting this tracepoint.
- set testline 0
- gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" {
- -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
- set testline $expect_out(1,string)
- pass "collect $msg: find tracepoint line"
+ with_test_prefix "collect $msg" {
+ # Find the comment-identified line for setting this tracepoint.
+ set testline 0
+ gdb_test_multiple "list $func, +30" "find tracepoint line" {
+ -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
+ set testline $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ -re ".*$gdb_prompt " {
+ pass "$gdb_test_name (skipping locals test)"
+ return
+ }
+ timeout {
+ pass "$gdb_test_name (skipping locals test)"
+ return
+ }
}
- -re ".*$gdb_prompt " {
- fail "collect $msg: find tracepoint line (skipping locals test)"
- return
- }
- timeout {
- fail "collect $msg: find tracepoint line (skipping locals test)"
- return
- }
- }
- gdb_test "trace $testline" \
+ gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
- "collect $msg: set tracepoint"
- gdb_trace_setactions "collect $msg: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect $expr" "^$"
- # Begin the test.
- run_trace_experiment $msg $func
+ # Begin the test.
+ run_trace_experiment $func
- gdb_test "print $expr" \
+ gdb_test "print $expr" \
"\\$\[0-9\]+ = $val$cr" \
- "collect $msg: got expected value '$val'"
+ "got expected value '$val'"
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect $msg: cease trace debugging"
+ "cease trace debugging"
+ }
}
proc gdb_collect_globals_test { } {
global cr
global gdb_prompt
- prepare_for_trace_test
-
- # Find the comment-identified line for setting this tracepoint.
- set testline 0
- gdb_test_multiple "list globals_test_func, +30" "collect globals: find tracepoint line" {
- -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
- set testline $expect_out(1,string)
- pass "collect globals: find tracepoint line"
- }
- -re ".*$gdb_prompt " {
- fail "collect globals: find tracepoint line (skipping global test)"
- return
+ with_test_prefix "collect globals" {
+ prepare_for_trace_test
+
+ # Find the comment-identified line for setting this tracepoint.
+ set testline 0
+ gdb_test_multiple "list globals_test_func, +30" "find tracepoint line" {
+ -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
+ set testline $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ -re ".*$gdb_prompt " {
+ fail "$gdb_test_name (skipping global test)"
+ return
+ }
+ timeout {
+ fail "$gdb_test_name (skipping global test)"
+ return
+ }
}
- timeout {
- fail "collect globals: find tracepoint line (skipping global test)"
- return
- }
- }
- # Use use this to test collecting overlapping memory ranges
- # (making use of UNOP_MEMVAL, as objects don't usually overlap
- # other objects). Note that globalarr2 should not be collected in
- # any other way so that a regression test below can be effective.
-
- set globalarr2_addr ""
- set test "get address of globalarr2"
- gdb_test_multiple "p /x &globalarr2" $test {
- -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
- set globalarr2_addr $expect_out(1,string)
- pass $test
+ # Use use this to test collecting overlapping memory ranges
+ # (making use of UNOP_MEMVAL, as objects don't usually overlap
+ # other objects). Note that globalarr2 should not be collected in
+ # any other way so that a regression test below can be effective.
+
+ set globalarr2_addr ""
+ set test "get address of globalarr2"
+ gdb_test_multiple "p /x &globalarr2" $test {
+ -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
+ set globalarr2_addr $expect_out(1,string)
+ pass $test
+ }
}
- }
- gdb_test "trace $testline" \
+ gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
- "collect globals: set tracepoint"
- gdb_trace_setactions "collect globals: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect globalc, globali, globalf, globald" "^$" \
"collect globalstruct, globalp, globalarr" "^$" \
"collect \{int \[2\]\}$globalarr2_addr" "^$" \
"collect \{int \[4\]\}globalarr3" "^$"
- # Begin the test.
- run_trace_experiment "globals" globals_test_func
+ # Begin the test.
+ run_trace_experiment globals_test_func
- gdb_test "print globalc" \
+ gdb_test "print globalc" \
"\\$\[0-9\]+ = 71 'G'$cr" \
- "collect globals: collected global char"
- gdb_test "print globali" \
+ "collected global char"
+ gdb_test "print globali" \
"\\$\[0-9\]+ = 72$cr" \
- "collect globals: collected global int"
- gdb_test "print globalf" \
+ "collected global int"
+ gdb_test "print globalf" \
"\\$\[0-9\]+ = 73.\[23\]\[0-9\]*$cr" \
- "collect globals: collected global float"
- gdb_test "print globald" \
+ "collected global float"
+ gdb_test "print globald" \
"\\$\[0-9\]+ = 74.\[34\]\[0-9\]*$cr" \
- "collect globals: collected global double"
+ "collected global double"
- gdb_test "print globalstruct.memberc" \
+ gdb_test "print globalstruct.memberc" \
"\\$\[0-9\]+ = 81 'Q'$cr" \
- "collect globals: collected struct char member"
- gdb_test "print globalstruct.memberi" \
+ "collected struct char member"
+ gdb_test "print globalstruct.memberi" \
"\\$\[0-9\]+ = 82$cr" \
- "collect globals: collected struct member int"
- gdb_test "print globalstruct.memberf" \
+ "collected struct member int"
+ gdb_test "print globalstruct.memberf" \
"\\$\[0-9\]+ = 83.\[23\]\[0-9\]*$cr" \
- "collect globals: collected struct member float"
- gdb_test "print globalstruct.memberd" \
+ "collected struct member float"
+ gdb_test "print globalstruct.memberd" \
"\\$\[0-9\]+ = 84.\[34\]\[0-9\]*$cr" \
- "collect globals: collected struct member double"
+ "collected struct member double"
- gdb_test "print globalp == &globalstruct" \
+ gdb_test "print globalp == &globalstruct" \
"\\$\[0-9\]+ = 1$cr" \
- "collect globals: collected global pointer"
+ "collected global pointer"
- gdb_test "print globalarr\[1\]" \
+ gdb_test "print globalarr\[1\]" \
"\\$\[0-9\]+ = 1$cr" \
- "collect globals: collected global array element #1"
- gdb_test "print globalarr\[2\]" \
+ "collected global array element #1"
+ gdb_test "print globalarr\[2\]" \
"\\$\[0-9\]+ = 2$cr" \
- "collect globals: collected global array element #2"
- gdb_test "print globalarr\[3\]" \
+ "collected global array element #2"
+ gdb_test "print globalarr\[3\]" \
"\\$\[0-9\]+ = 3$cr" \
- "collect globals: collected global array element #3"
-
- # Check that we didn't mess up sort&merging memory ranges to
- # collect.
- gdb_test "print globalarr2" \
- "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \
- "collect globals: collected global array 2"
-
- # GDB would internal error collecting UNOP_MEMVAL's whose address
- # expression wasn't an rvalue (that's regtested in the
- # corresponding 'collect' action above). This just double checks
- # we actually did collect what we wanted.
- gdb_test "print globalarr3" \
- "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}$cr" \
- "collect globals: collected global array 3"
-
- gdb_test "tfind none" \
+ "collected global array element #3"
+
+ # Check that we didn't mess up sort&merging memory ranges to
+ # collect.
+ gdb_test "print globalarr2" \
+ "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \
+ "collected global array 2"
+
+ # GDB would internal error collecting UNOP_MEMVAL's whose address
+ # expression wasn't an rvalue (that's regtested in the
+ # corresponding 'collect' action above). This just double checks
+ # we actually did collect what we wanted.
+ gdb_test "print globalarr3" \
+ "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}$cr" \
+ "collect globals: collected global array 3"
+
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect globals: cease trace debugging"
+ "cease trace debugging"
+ }
}
# Test that when we've collected all fields of a structure
proc gdb_collect_global_in_pieces_test { } {
global gdb_prompt
- prepare_for_trace_test
+ with_test_prefix "collect global in pieces" {
+ prepare_for_trace_test
- # Find the comment-identified line for setting this tracepoint.
- set testline 0
- set msg "collect global in pieces: find tracepoint line"
- gdb_test_multiple "list globals_test_func, +30" "$msg" {
- -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
- set testline $expect_out(1,string)
- pass "$msg"
+ # Find the comment-identified line for setting this tracepoint.
+ set testline 0
+ gdb_test_multiple "list globals_test_func, +30" "find tracepoint line" {
+ -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
+ set testline $expect_out(1,string)
+ pass $gdb_test_name
+ }
}
- }
- if {$testline == 0} {
- return
- }
+ if {$testline == 0} {
+ return
+ }
- gdb_test "trace $testline" \
- "Tracepoint \[0-9\]+ at .*" \
- "collect global in pieces: set tracepoint"
- gdb_trace_setactions "collect global in pieces: define actions" \
+ gdb_test "trace $testline" \
+ "Tracepoint \[0-9\]+ at .*" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect global_pieces.a, global_pieces.b" \
"^$"
- # Begin the test.
- run_trace_experiment "global in pieces" globals_test_func
+ # Begin the test.
+ run_trace_experiment globals_test_func
- gdb_test "print /x global_pieces.a" " = 0x12345678" \
- "collect global in pieces: print piece a"
- gdb_test "print /x global_pieces.b" " = 0x87654321" \
- "collect global in pieces: print piece b"
+ gdb_test "print /x global_pieces.a" " = 0x12345678" \
+ "print piece a"
+ gdb_test "print /x global_pieces.b" " = 0x87654321" \
+ "print piece b"
- gdb_test "print /x global_pieces" " = \{a = 0x12345678, b = 0x87654321\}" \
- "collect global in pieces: print whole object"
+ gdb_test "print /x global_pieces" " = \{a = 0x12345678, b = 0x87654321\}" \
+ "print whole object"
- gdb_test "tfind none" "#0 end .*" \
- "collect global in pieces: cease trace debugging"
+ gdb_test "tfind none" "#0 end .*" \
+ "cease trace debugging"
+ }
}
proc gdb_collect_return_test { } {
global gdb_prompt
- prepare_for_trace_test
+ with_test_prefix "collect \$_ret" {
+ prepare_for_trace_test
- # We'll simply re-use the args_test_function for this test
- gdb_test "trace args_test_func" \
+ # We'll simply re-use the args_test_function for this test.
+ gdb_test "trace args_test_func" \
"Tracepoint \[0-9\]+ at .*" \
- "collect \$_ret: set tracepoint"
- gdb_trace_setactions "collect \$_ret: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect \$_ret" "^$"
- # Begin the test.
- run_trace_experiment \$_ret args_test_func
-
- # Since we can't guarantee that $_ret will give us the caller,
- # pass either way, but giving different messages.
- gdb_test_multiple "backtrace" "" {
- -re ".*#1 .* in main .*\r\n$gdb_prompt $" {
- pass "collect \$_ret: backtrace lists main"
- }
- -re ".*#1 .* in ?? .*\r\n$gdb_prompt $" {
- pass "collect \$_ret: backtrace not listing main"
+ # Begin the test.
+ run_trace_experiment args_test_func
+
+ # Since we can't guarantee that $_ret will give us the caller,
+ # pass either way, but giving different messages.
+ gdb_test_multiple "backtrace" "" {
+ -re ".*#1 .* in main .*\r\n$gdb_prompt $" {
+ pass "$gdb_test_name (lists main)"
+ }
+ -re ".*#1 .* in ?? .*\r\n$gdb_prompt $" {
+ pass "$gdb_test_name (not listing main)"
+ }
}
- }
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect \$_ret: cease trace debugging"
+ "cease trace debugging"
+ }
}
proc gdb_collect_strings_test { func mystr myrslt mylim msg } {
global cr
global gdb_prompt
- prepare_for_trace_test
-
- # Find the comment-identified line for setting this tracepoint.
- set testline 0
- gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" {
- -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
- set testline $expect_out(1,string)
- pass "collect $msg: find tracepoint line"
- }
- -re ".*$gdb_prompt " {
- fail "collect $msg: find tracepoint line (skipping strings test)"
- return
+ with_test_prefix "collect $msg" {
+ prepare_for_trace_test
+
+ # Find the comment-identified line for setting this tracepoint.
+ set testline 0
+ gdb_test_multiple "list $func, +30" "find tracepoint line" {
+ -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
+ set testline $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ -re ".*$gdb_prompt " {
+ pass "$gdb_test_name (skipping strings test)"
+ return
+ }
+ timeout {
+ pass "$gdb_test_name (skipping strings test)"
+ return
+ }
}
- timeout {
- fail "collect $msg: find tracepoint line (skipping strings test)"
- return
- }
- }
- gdb_test "trace $testline" \
+ gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
- "collect $msg: set tracepoint"
- gdb_trace_setactions "collect $msg: define actions" \
+ "set tracepoint"
+ gdb_trace_setactions "define actions" \
"" \
"collect/s$mylim $mystr" "^$"
- # Begin the test.
- run_trace_experiment $msg $func
+ # Begin the test.
+ run_trace_experiment $func
- gdb_test "print $mystr" \
- "\\$\[0-9\]+ = $hex \"$myrslt\".*$cr" \
- "collect $msg: collected local string"
+ gdb_test "print $mystr" \
+ "\\$\[0-9\]+ = $hex \"$myrslt\".*$cr" \
+ "collected local string"
- gdb_test "tfind none" \
+ gdb_test "tfind none" \
"#0 end .*" \
- "collect $msg: cease trace debugging"
+ "cease trace debugging"
+ }
}
proc gdb_trace_collection_test {} {
gdb_trace_collection_test
# Finished!
-gdb_test "tfind none" ".*" ""
+gdb_test "tfind none" ".*"
gdb_trace_setactions "collect on tracepoint 1" "1" \
"collect gdb_struct1_test" "^$"
gdb_run_cmd
-if {[gdb_test "" "Breakpoint ${decimal}, main.*"] != 0} {
+if {[gdb_test "" "Breakpoint ${decimal}, main.*" "run to main"] != 0} {
return -1
}
return -1
}
gdb_load $binfile
-gdb_test "tstop" ".*" ""
-gdb_test "tfind none" ".*" ""
runto_main
gdb_reinitialize_dir $srcdir/$subdir
"run trace experiment"
gdb_test "tstop" ".*" ""
-gdb_test "tfind none" ".*" ""
-if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" ""] {
- untested "skipping further tests due to print failure"
- return -1
+with_test_prefix "trace_frame -1" {
+ gdb_test "tfind none" ".*"
+ gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" \
+ "print \$trace_frame"
}
-gdb_test "tfind tracepoint $tdp2" ".*" ""
-if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" ""] {
- untested "skipping further tests due to print failure"
- return -1
+with_test_prefix "trace_frame 0" {
+ gdb_test "tfind tracepoint $tdp2" ".*"
+ gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" \
+ "print \$trace_frame"
}
-gdb_test "tfind tracepoint $tdp3" ".*" ""
-if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" ""] {
- untested "skipping further tests due to print failure"
- return -1
+with_test_prefix "trace_frame 1" {
+ gdb_test "tfind tracepoint $tdp3" ".*"
+ gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" \
+ "print \$trace_frame"
}
-gdb_test "tfind tracepoint $tdp4" ".*" ""
-if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" ""] {
- untested "skipping further tests due to print failure"
- return -1
+with_test_prefix "trace_frame 2" {
+ gdb_test "tfind tracepoint $tdp4" ".*"
+ gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" \
+ "print \$trace_frame"
}
-gdb_test "tfind tracepoint $tdp2" ".*" ""
-if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" ""] {
- untested "skipping further tests due to print failure"
- return -1
+with_test_prefix "trace_frame 3" {
+ gdb_test "tfind tracepoint $tdp2" ".*"
+ gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" \
+ "print \$trace_frame"
}
-gdb_test "tfind tracepoint $tdp3" ".*" ""
-if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" ""] {
- untested "skipping further tests due to print failure"
- return -1
+with_test_prefix "trace_frame 4" {
+ gdb_test "tfind tracepoint $tdp3" ".*"
+ gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" \
+ "print \$trace_frame"
}
## We should now be at the last frame, because this frame's passcount
gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test"
# Finished!
-gdb_test "tfind none" ".*" ""
+gdb_test "tfind none" ".*"
return -1
}
gdb_load $binfile
-gdb_test "tstop" ".*" ""
-gdb_test "tfind none" ".*" ""
runto_main
gdb_reinitialize_dir $srcdir/$subdir
return -1
}
gdb_load $binfile
-gdb_test "tstop" ".*" ""
-gdb_test "tfind none" ".*" ""
# 6.2 test help tstart
gdb_test "help tstart" \
gdb_test "print \$trace_line" "$testline4" \
"8.14: tfind 3 (line $testline4)"
-gdb_test_no_output "set \$test_pc = \$pc" ""
+gdb_test_no_output "set \$test_pc = \$pc" "8.14: set \$test_pc"
gdb_tfind_test "8.14: tfind none" "none" "-1"
gdb_tfind_test "8.14: tfind pc" "pc \$test_pc" "\$trace_frame != -1" "1"
gdb_test "print \$trace_line" "$testline4" \
gdb_tfind_test "8.15: tfind 3" "3" "3"
gdb_test "print \$trace_line" "$testline4" \
"8.15: tfind 3 (line $testline4)"
-gdb_test_no_output "set \$test_pc = \$pc" ""
+gdb_test_no_output "set \$test_pc = \$pc" "8.15: set \$test_pc"
gdb_tfind_test "8.15: tfind pc" "pc" "\$pc == \$test_pc" "1"
gdb_test "print \$trace_line" "$testline4" \
"8.15: tfind pc (line $testline4)"
"8.32: tfind with bad subcommand"
# Finished!
-gdb_tfind_test "8.17: tfind none" "none" "-1"
+gdb_tfind_test "tfind none" "none" "-1"
set testline [gdb_get_line_number "set pre-run breakpoint here"]
- gdb_test "break $testline" ".*" ""
+ gdb_test "break $testline" ".*" \
+ "break at pre-run"
set testline [gdb_get_line_number "set post-run breakpoint here"]
- gdb_test "break $testline" ".*" ""
+ gdb_test "break $testline" ".*" \
+ "break at post-run"
}
proc run_trace_experiment {} {
gdb_test "tstop" "" ""
}
-proc gdb_slow_trace_speed_test { } {
+proc_with_prefix gdb_slow_trace_speed_test { } {
gdb_delete_tracepoints
run_trace_experiment
}
-proc gdb_fast_trace_speed_test { } {
+proc_with_prefix gdb_fast_trace_speed_test { } {
global gdb_prompt
gdb_delete_tracepoints
return -1
}
gdb_load $binfile
-gdb_test "tstop" ".*" ""
-gdb_test "tfind none" ".*" ""
runto_main
gdb_reinitialize_dir $srcdir/$subdir
global gdb_prompt
global executable
- clean_restart $executable
+ with_test_prefix "$while_stepping" {
+ clean_restart $executable
- gdb_test "tstop" ".*" ""
- gdb_test "tfind none" ".*" ""
- runto_main
+ runto_main
- ## verify number of trace frames collected matches stepcount
+ ## verify number of trace frames collected matches stepcount
- gdb_delete_tracepoints
- gdb_test "trace gdb_c_test" \
- "Tracepoint $decimal at .*" \
- "$while_stepping: Set tracepoint at gdb_c_test"
+ gdb_delete_tracepoints
+ gdb_test "trace gdb_c_test" \
+ "Tracepoint $decimal at .*" \
+ "Set tracepoint at gdb_c_test"
- gdb_trace_setactions "5.12: define $while_stepping <stepcount>" \
- "" \
- "collect \$$fpreg" "^$" \
- "$while_stepping 5" "^$" \
- "collect p" "^$" \
- "end" "^$" \
- "end" ""
+ gdb_trace_setactions "define $while_stepping <stepcount>" \
+ "" \
+ "collect \$$fpreg" "^$" \
+ "$while_stepping 5" "^$" \
+ "collect p" "^$" \
+ "end" "^$" \
+ "end" ""
- gdb_test "tstart" ".*" ""
+ gdb_test "tstart" ".*"
- gdb_breakpoint "end" qualified
- gdb_test "continue" \
- "Continuing.*Breakpoint $decimal, end.*" \
- "$while_stepping: run trace experiment"
+ gdb_breakpoint "end" qualified
+ gdb_test "continue" \
+ "Continuing.*Breakpoint $decimal, end.*" \
+ "run trace experiment"
- gdb_test "tstop" ".*" ""
+ gdb_test "tstop" ".*"
- gdb_tfind_test "$while_stepping: frame 5 should be the last one collected" "5" "5"
+ gdb_tfind_test "frame 5 should be the last one collected" "5" "5"
- set test "$while_stepping: trace stopped after 5 stepping frames"
- gdb_test_multiple "tfind 6" "$test" {
- -re "failed to find.*$gdb_prompt $" {
- pass "$test"
- }
- -re ".*$gdb_prompt $" {
- fail "$test"
- }
- }
+ gdb_test "tfind 6" "failed to find.*" \
+ "trace stopped after 5 stepping frames"
- gdb_test "tfind none" ".*" ""
+ gdb_test "tfind none" ".*"
+ }
}
# Test all while-stepping aliases.
gdb_breakpoint "main"
gdb_run_cmd
-if {[gdb_test "" "Breakpoint .*"] != 0} {
+if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} {
return -1
}
}
# Force showing two commands.
- gdb_test_no_output "set max-completions 2" ""
+ gdb_test_no_output -nopass "set max-completions 2"
# TUI adds additional commands to the possible completions, so we
# need different patterns depending on whether or not it is enabled.
}
# Restore.
- gdb_test_no_output "set max-completions $max_completions" ""
+ gdb_test_no_output -nopass "set max-completions $max_completions"
}
# Define utilities in Guile to save needing (newline) all the time,
# and in the case of "print" add a prefix to help erroneous passes.
#
- # Pass the empty string as the test name here, this means we don't
- # get a pass/fail message for these tests, but also removes
- # duplicate tests if this proc ends up getting called multiple
- # times in a single test script.
- gdb_test_no_output "guile (define (print x) (format #t \"= ~A\" x) (newline))" ""
- gdb_test_no_output "guile (define (raw-print x) (format #t \"= ~S\" x) (newline))" ""
+ gdb_test_no_output -nopass \
+ "guile (define (print x) (format #t \"= ~A\" x) (newline))"
+ gdb_test_no_output -nopass \
+ "guile (define (raw-print x) (format #t \"= ~S\" x) (newline))"
}
# Install the gdb module.
proc gdb_install_guile_module { } {
- # Pass the empty string as the test name here, this means we don't
- # get a pass/fail message for these tests, but also removes
- # duplicate tests if this proc ends up getting called multiple
- # times in a single test script.
- gdb_test_no_output "guile (use-modules (gdb))" ""
+ gdb_test_no_output -nopass "guile (use-modules (gdb))"
}
# Wrapper around runto_main that installs the guile utils and module.
}
}
- gdb_test_no_output "set target-charset $target_charset" ""
+ gdb_test_no_output -nopass "set target-charset $target_charset"
set code [catch {uplevel 1 $body} result]
- gdb_test_no_output "set target-charset $saved" ""
+ gdb_test_no_output -nopass "set target-charset $saved"
if {$code == 1} {
global errorInfo errorCode
perror "Did not manage to set complaints"
} else {
# Set complaints.
- gdb_test_no_output "set complaints $n" ""
+ gdb_test_no_output -nopass "set complaints $n"
}
set code [catch {uplevel 1 $body} result]
# Restore saved setting of complaints.
if { $save != "" } {
- gdb_test_no_output "set complaints $save" ""
+ gdb_test_no_output -nopass "set complaints $save"
}
if {$code == 1} {
proc exec_cmd_expect_vCont_count { cmd exp_vCont_r } {
global gdb_prompt
- gdb_test_no_output "set debug remote 1" ""
+ gdb_test_no_output -nopass "set debug remote 1"
set test "${cmd}: vCont;r=${exp_vCont_r}"
set r_counter 0
}
}
- gdb_test_no_output "set debug remote 0" ""
+ gdb_test_no_output -nopass "set debug remote 0"
return $ret
}
}
set passfail "fail"
- gdb_test "tfind $tfind_arg" "" ""
+ gdb_test -nopass "tfind $tfind_arg" ""
send_gdb "printf \"x \%d x\\n\", $expr\n"
gdb_expect 10 {
-re "x (-*\[0-9\]+) x" {
global gdb_prompt
if { $tracepoint != "" } {
- gdb_test "trace $tracepoint" "" ""
+ gdb_test -nopass "trace $tracepoint"
}
return [gdb_readexpr "\$tpnum"]
}