+2019-10-03 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.base/break-interp.exp: Reduce test name duplication.
+ * gdb.base/call-sc.exp: Likewise.
+ * gdb.base/callfuncs.exp: Likewise.
+ * gdb.base/charset.exp: Likewise.
+ * gdb.base/dump.exp: Likewise.
+ * gdb.base/ena-dis-br.exp: Likewise.
+ * gdb.base/relational.exp: Likewise.
+ * gdb.base/step-over-syscall.exp: Likewise.
+ * gdb.base/structs.exp: Likewise.
+
2019-10-03 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.linespec/explicit.exp: Make test names unique.
# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
-proc reach {func command displacement} {
- with_test_prefix "reach-$func" {
+#
+# The optional ITERATION parameter is used in order to make unique
+# test prefixes, when calling this proc with the same FUNC name
+# provide a unique ITERATION value for each call.
+proc reach {func command displacement {iteration 1}} {
+ set prefix "reach-$func"
+ if { $iteration > 1 } {
+ set prefix "$prefix-$iteration"
+ }
+ with_test_prefix $prefix {
reach_1 $func $command $displacement
}
}
"set args OBJDIR/${subdir}/$binfile_test"
}
- reach $solib_bp "run" $displacement
+ reach $solib_bp "run" $displacement 1
gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt"
# Try re-run if the new PIE displacement takes effect.
gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
- reach $solib_bp "run" $displacement
+ reach $solib_bp "run" $displacement 2
if $ifmain {
test_core $file $displacement
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
if $ifmain {
- reach $solib_bp run $displacement
+ reach $solib_bp run $displacement 3
# Use two separate gdb_test_multiple statements to avoid timeouts due
# to slow processing of wildcard capturing long output
file delete "${interp}.debug"
}
- if ![prelink$ldprelink $interp] {
+ if ![prelink$ldprelink $interp "$interp, second time"] {
continue
}
+
if {$ldprelink == "NO"} {
set displacement "NONZERO"
} else {
if {[prelink$binprelink $relink_args [file tail $exec]]
&& [file_copy $interp_saved $interp]} {
- if {$binpie != "ATTACH"} {
- test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
- } else {
- # If the file has been randomly prelinked it must be
- # "NONZERO". We could see "ZERO" only if it was unprelinked
- # and it is now running at the same address - which is 0 but
- # executable can never run at address 0.
-
- set displacement "NONZERO"
- test_attach $exec $displacement $relink_args
-
- # ATTACH means that executables and libraries have been
- # modified after they have been run. They cannot be reused
- # for problem reproducibility after the testcase ends in
- # the ATTACH case. Therefore they are rather deleted not
- # to confuse after the run finishes.
- set exec_debug [system_debug_get $exec]
- if {$exec_debug != ""} {
- # `file delete [glob "${exec_debug}*"]' does not work.
- foreach f [glob "${exec_debug}*"] {
+ # In order to make test names unique wrap the core of this if block
+ # with a test prefix. Some of the tests performed in the if
+ # condition are repeated within this body.
+ with_test_prefix "INNER" {
+ if {$binpie != "ATTACH"} {
+ test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
+ } else {
+ # If the file has been randomly prelinked it must be
+ # "NONZERO". We could see "ZERO" only if it was unprelinked
+ # and it is now running at the same address - which is 0 but
+ # executable can never run at address 0.
+
+ set displacement "NONZERO"
+ test_attach $exec $displacement $relink_args
+
+ # ATTACH means that executables and libraries have been
+ # modified after they have been run. They cannot be reused
+ # for problem reproducibility after the testcase ends in
+ # the ATTACH case. Therefore they are rather deleted not
+ # to confuse after the run finishes.
+ set exec_debug [system_debug_get $exec]
+ if {$exec_debug != ""} {
+ # `file delete [glob "${exec_debug}*"]' does not work.
+ foreach f [glob "${exec_debug}*"] {
+ file delete $f
+ }
+ }
+ file delete -force $dir
+ # `file delete [glob "${exec}*"]' does not work.
+ foreach f [glob "${exec}*"] {
file delete $f
}
}
- file delete -force $dir
- # `file delete [glob "${exec}*"]' does not work.
- foreach f [glob "${exec}*"] {
- file delete $f
- }
}
}
}
gdb_load ${binfile}
# Make certain that the output is consistent
- gdb_test_no_output "set print sevenbit-strings"
- gdb_test_no_output "set print address off"
- gdb_test_no_output "set width 0"
+ with_test_prefix "testfile=$testfile" {
+ gdb_test_no_output "set print sevenbit-strings"
+ gdb_test_no_output "set print address off"
+ gdb_test_no_output "set width 0"
+ }
# Advance to main
if { ![runto_main] } then {
#
# This happens on ppc64 GNU/Linux with gcc 3.4.1 and a buggy GDB
- set test "return foo; synchronize pc to main()"
+ set test "return foo; synchronize pc to main() for '${testfile}'"
for {set loop_count 0} {$loop_count < 2} {incr loop_count} {
gdb_test_multiple "backtrace 1" $test {
-re "#0.*main \\(\\).*${gdb_prompt} $" {
return $all_registers_lines
}
+# Global used by RERUN_AND_PREPARE to make test names unique.
+set rerun_count 0
+
proc rerun_and_prepare {} {
- if { ![runto_main] } {
- gdb_suppress_tests
- }
+ global rerun_count
+
+ incr rerun_count
+ with_test_prefix "rerun number ${rerun_count}" {
- gdb_test_no_output "set language c"
+ if { ![runto_main] } {
+ gdb_suppress_tests
+ }
+
+ gdb_test_no_output "set language c"
- get_debug_format
+ get_debug_format
- # Make sure that malloc gets called and that the floating point unit
- # is initialized via a call to t_double_values.
- gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*" \
- "next to t_double_values"
- gdb_test "next" "t_structs_c\\(struct_val1\\);.*" \
- "next to t_structs_c"
+ # Make sure that malloc gets called and that the floating
+ # point unit is initialized via a call to t_double_values.
+ gdb_test "next" \
+ "t_double_values\\(double_val1, double_val2\\);.*" \
+ "next to t_double_values"
+ gdb_test "next" "t_structs_c\\(struct_val1\\);.*" \
+ "next to t_structs_c"
+ }
}
proc perform_all_tests {prototypes} {
rerun_and_prepare
# Save all register contents.
- set old_reg_content [fetch_all_registers "retrieve original register contents"]
+ set old_reg_content \
+ [fetch_all_registers "retrieve original register contents 1"]
# Perform function calls.
do_function_calls $prototypes
rerun_and_prepare
# Save all register contents.
- set old_reg_content [fetch_all_registers "retrieve original register contents"]
+ set old_reg_content \
+ [fetch_all_registers "retrieve original register contents 2"]
# Set breakpoint at a function we will call from gdb.
gdb_breakpoint add
# Set breakpoint at a function we will call from gdb.
gdb_breakpoint add
# Save all register contents.
- set old_reg_content [fetch_all_registers "retrieve original register contents"]
+ set old_reg_content \
+ [fetch_all_registers "retrieve original register contents 3"]
# Call function (causing a breakpoint hit in the call dummy) and do a finish,
# make sure we are back at main and still have the same register contents.
# Set breakpoint at a function we will call from gdb.
gdb_breakpoint add
# Save all register contents.
- set old_reg_content [fetch_all_registers "retrieve original register contents"]
+ set old_reg_content \
+ [fetch_all_registers "retrieve original register contents 4"]
# Call function (causing a breakpoint hit in the call dummy) and do a return
# with a value, make sure we are back at main with the same register contents.
rerun_and_prepare
# Set breakpoint at a function we will call from gdb.
gdb_breakpoint add
- set old_reg_content [fetch_all_registers "retrieve original register contents"]
+ set old_reg_content \
+ [fetch_all_registers "retrieve original register contents 5"]
# Call function (causing a breakpoint hit in the call dummy), and
# call another function from the call dummy frame (thereby setting up
# We don't want to test all the charset names here, since that would
# be too many combinations. We we pick a subset.
set charset_subset {ASCII ISO-8859-1 EBCDIC-US IBM1047}
-foreach host_charset $charset_subset {
+foreach_with_prefix host_charset $charset_subset {
if {[valid_host_charset $host_charset]} {
set testname "try `set host-charset $host_charset'"
proc string_display { var_name set_prefix x_size x_type} {
- gdb_test_no_output "set ${var_name} = ${set_prefix}\"Test String\\0with zeroes\"" "assign ${var_name} with prefix ${set_prefix}"
- gdb_test "x /2${x_size}s ${var_name}" ".*\t${x_type}\"Test String\"\[\r\n\]+.*\t${x_type}\"with zeroes\"" "display String ${var_name} with x/${x_size}s"
+ with_test_prefix "set_prefix=$set_prefix" {
+ gdb_test_no_output "set ${var_name} = ${set_prefix}\"Test String\\0with zeroes\""\
+ "assign ${var_name} with prefix ${set_prefix}"
+ gdb_test "x /2${x_size}s ${var_name}" ".*\t${x_type}\"Test String\"\[\r\n\]+.*\t${x_type}\"with zeroes\"" \
+ "display String ${var_name} with x/${x_size}s"
+ }
}
if {$ucs2_ok} {
lappend options "additional_flags=-Wl,-taso"
}
+# Runs the command 'print zero_all ()'. Uses the PRINT_ZERO_ALL_COUNT
+# global to ensure the test names are unique.
+set print_zero_all_count 0
+proc print_zero_all { } {
+ global print_zero_all_count
+
+ incr print_zero_all_count
+ gdb_test "print zero_all ()" " = void" \
+ "call ${print_zero_all_count} to zero_all function"
+}
+
# Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled as
# this causes addresses to be out of range for IHEX.
lappend options {nopie}
if ![string compare $is64bitonly "no"] then {
- gdb_test "print zero_all ()" ".*"
test_restore_saved_value "[set intarr1.srec]" "array as value, srec" \
$array_val "intarray"
test_restore_saved_value "[set intstr1.srec]" "struct as value, srec" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" "void" "zero all"
+ print_zero_all
test_restore_saved_value "[set intarr2.srec]" "array as memory, srec" \
$array_val "intarray"
test_restore_saved_value "[set intstr2.srec]" "struct as memory, srec" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.ihex]" "array as value, ihex" \
$array_val "intarray"
test_restore_saved_value "[set intstr1.ihex]" "struct as value, ihex" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr2.ihex]" "array as memory, ihex" \
$array_val "intarray"
test_restore_saved_value "[set intstr2.ihex]" "struct as memory, ihex" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.tekhex]" "array as value, tekhex" \
$array_val "intarray"
test_restore_saved_value "[set intstr1.tekhex]" "struct as value, tekhex" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr2.tekhex]" "array as memory, tekhex" \
$array_val "intarray"
$struct_val "intstruct"
}
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value "[set intarr1.bin] binary $array_start" \
"array as value, binary" \
"struct as value, binary" \
$struct_val "intstruct"
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value "[set intarr2.bin] binary $array_start" \
"array as memory, binary" \
set struct2_offset \
[capture_value "(char *) &intstruct2 - (char *) &intstruct"]
-gdb_test "print zero_all ()" ".*"
+print_zero_all
if ![string compare $is64bitonly "no"] then {
"struct copy, srec" \
$struct_val "intstruct2"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.ihex] $array2_offset" \
"array copy, ihex" \
"struct copy, ihex" \
$struct_val "intstruct2"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.tekhex] $array2_offset" \
"array copy, tekhex" \
$struct_val "intstruct2"
}
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value "[set intarr1.bin] binary $array2_start" \
"array copy, binary" \
[capture_value "/x (char *) &intarray\[4\] - (char *) &intarray\[0\]"]
if ![string compare $is64bitonly "no"] then {
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.srec] 0 $element3_start $element4_start" \
"array partial, srec" 4 "intarray\[3\]"
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 1"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 1"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.ihex] 0 $element3_start $element4_start" \
"array partial, ihex" 4 "intarray\[3\]"
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 2"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 2"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.tekhex] 0 $element3_start $element4_start" \
"array partial, tekhex" 4 "intarray\[3\]"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 3"
}
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value \
"[set intarr1.bin] binary $array_start $element3_offset $element4_offset" \
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 4"
if ![string compare $is64bitonly "no"] then {
- gdb_test "print zero_all ()" ".*" ""
+ print_zero_all
# restore with expressions
test_restore_saved_value \
gdb_test "info break $bp" \
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*" \
- "info break marker1"
+ "info break marker1 before hitting breakpoint"
# See the comments in condbreak.exp for "run until breakpoint at
# marker1" for an explanation of the xfail below.
gdb_test "info break $bp" \
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+y.*" \
- "info auto-disabled break marker2"
+ "info auto-disabled break marker2 before hitting breakpoint"
# See the comments in condbreak.exp for "run until breakpoint at
# marker1" for an explanation of the xfail below.
gdb_test "info break $bp" \
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+n.*" \
- "info auto-disabled break marker2"
+ "info auto-disabled break marker2 after hitting breakpoint"
# Verify that we don't stop at a disabled breakpoint.
gdb_continue_to_end "no stop"
gdb_test "ignore $bp 1" \
"Will ignore next crossing of breakpoint \[0-9\]*.*" \
- "ignore break marker1"
+ "ignore break marker1 1"
gdb_test "info break $bp" \
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*ignore next 1 hits.*" \
gdb_test "info break $bp" \
"\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*ignore next 1 hits.*" \
- "info break marker1"
+ "info break marker1 after hitting breakpoint"
gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
rerun_to_main
gdb_test "ignore $bp 10" \
"Will ignore next 10 crossings of breakpoint \[0-9\]*.*" \
- "ignore break marker1"
+ "ignore break marker1 10"
gdb_test_no_output "disable $bp" "disable break marker1"
# test expressions with "int" types
#
-gdb_test_no_output "set variable x=14" "set variable x=14"
-gdb_test_no_output "set variable y=2" "set variable y=2"
-gdb_test_no_output "set variable z=2" "set variable z=2"
-gdb_test_no_output "set variable w=3" "set variable w=3"
+with_test_prefix "int types" {
-gdb_test "print x" " = 14" "print value of x"
+ gdb_test_no_output "set variable x=14" "set variable x=14"
+ gdb_test_no_output "set variable y=2" "set variable y=2"
+ gdb_test_no_output "set variable z=2" "set variable z=2"
+ gdb_test_no_output "set variable w=3" "set variable w=3"
-gdb_test "print y" " = 2" "print value of y"
+ gdb_test "print x" " = 14" "print value of x"
-gdb_test "print z" " = 2" "print value of z"
+ gdb_test "print y" " = 2" "print value of y"
-gdb_test "print w" " = 3" "print value of w"
+ gdb_test "print z" " = 2" "print value of z"
-gdb_test "print x < y" "$false" "print value of x<y"
+ gdb_test "print w" " = 3" "print value of w"
-gdb_test "print x <= y" "$false" "print value of x<=y"
+ gdb_test "print x < y" "$false" "print value of x<y"
-gdb_test "print x > y" "$true" "print value of x>y"
+ gdb_test "print x <= y" "$false" "print value of x<=y"
-gdb_test "print x >= y" "$true" "print value of x>=y"
+ gdb_test "print x > y" "$true" "print value of x>y"
-gdb_test "print x == y" "$false" "print value of x==y"
+ gdb_test "print x >= y" "$true" "print value of x>=y"
-gdb_test "print x != y" "$true" "print value of x!=y"
+ gdb_test "print x == y" "$false" "print value of x==y"
+ gdb_test "print x != y" "$true" "print value of x!=y"
+}
# Test associativity of <, >, <=, >=, ==, !=
+with_test_prefix "basic associativity" {
-gdb_test_no_output "set variable x=3" "set variable x"
-gdb_test_no_output "set variable y=5" "set variable y"
-gdb_test_no_output "set variable z=2" "set variable z"
-
-gdb_test "print x < y < z" "$true" "print value of x<y<z"
-
-gdb_test "print x <= y <= z" "$true" "print value of x<=y<=z"
-
-gdb_test "print x > y > z" "$false" "print value of x>y>z"
-
-gdb_test "print x >= y >= z" "$false" "print value of x>=y>=z"
+ gdb_test_no_output "set variable x=3" "set variable x=3"
+ gdb_test_no_output "set variable y=5" "set variable y=5"
+ gdb_test_no_output "set variable z=2" "set variable z=2"
-gdb_test_no_output "set variable x=2" "set variable x"
-gdb_test_no_output "set variable y=2" "set variable y"
-gdb_test_no_output "set variable z=1" "set variable z"
+ gdb_test "print x < y < z" "$true" "print value of x<y<z"
-gdb_test "print x == y == z" "$true" "print value of x==y==z"
+ gdb_test "print x <= y <= z" "$true" "print value of x<=y<=z"
-gdb_test_no_output "set variable z=0" "set variable z"
+ gdb_test "print x > y > z" "$false" "print value of x>y>z"
-gdb_test "print x != y != z" "$false" "print value of x!=y!=z"
+ gdb_test "print x >= y >= z" "$false" "print value of x>=y>=z"
-# test precedence rules on pairs of relational operators
+ gdb_test_no_output "set variable x=2" "set variable x=2"
+ gdb_test_no_output "set variable y=2" "set variable y=2"
+ gdb_test_no_output "set variable z=1" "set variable z=1"
-gdb_test_no_output "set variable x=0" "set variable x"
-gdb_test_no_output "set variable y=2" "set variable y"
-gdb_test_no_output "set variable z=2" "set variable z"
+ gdb_test "print x == y == z" "$true" "print value of x==y==z"
-gdb_test "print x < y == z" "$false" "print value of x<y==z"
+ gdb_test_no_output "set variable z=0" "set variable z"
-# 0 2 2
-gdb_test "print x < y != z" "$true" "print value of x<y!=z"
+ gdb_test "print x != y != z" "$false" "print value of x!=y!=z"
+}
-gdb_test_no_output "set variable x=2" "set variable x"
-gdb_test_no_output "set variable y=3" "set variable y"
-gdb_test_no_output "set variable z=1" "set variable z"
+# Test precedence rules on pairs of relational operators. The use of
+# with_test_prefix with keys 1, 2, 3, etc is only to ensure that the
+# test names are unique. Each nested group of tests starts at a
+# location where we are setting a variable to a value it has had in
+# the past, which would result in a test name repeating.
+with_test_prefix "pair associativity" {
+ with_test_prefix "1" {
+ gdb_test_no_output "set variable x=0" "set variable x=0"
+ gdb_test_no_output "set variable y=2" "set variable y=2"
+ gdb_test_no_output "set variable z=2" "set variable z=2"
+ gdb_test "print x < y == z" "$false" "print value of x<y==z"
-# 2 3 1
-gdb_test "print x < y <= z" "$true" "print value of x<y<=z"
+ # 0 2 2
+ gdb_test "print x < y != z" "$true" "print value of x<y!=z"
-# 2 3 1
-gdb_test "print x < y >= z" "$true" "print value of x<y>=z"
+ gdb_test_no_output "set variable x=2" "set variable x=2"
+ gdb_test_no_output "set variable y=3" "set variable y=3"
+ gdb_test_no_output "set variable z=1" "set variable z=1"
-gdb_test_no_output "set variable z=0" " set variable z"
+ # 2 3 1
+ gdb_test "print x < y <= z" "$true" "print value of x<y<=z"
-# 2 3 0
-gdb_test "print x < y > z" "$true" "print value of x<y>z"
+ # 2 3 1
+ gdb_test "print x < y >= z" "$true" "print value of x<y>=z"
-gdb_test_no_output "set variable x=1" " set variable x"
+ gdb_test_no_output "set variable z=0" " set variable z=0"
-# 1 3 0
-gdb_test "print x > y >= z" "$true" "print value of x>y>=z"
+ # 2 3 0
+ gdb_test "print x < y > z" "$true" "print value of x<y>z"
-gdb_test_no_output "set variable z=2" " set variable z"
+ gdb_test_no_output "set variable x=1" " set variable x=1"
-# 1 3 2
-gdb_test "print x > y == z" "$false" "print value of x>y==z"
+ # 1 3 0
+ gdb_test "print x > y >= z" "$true" "print value of x>y>=z"
+ }
-gdb_test_no_output "set variable x=2" " set variable x"
-gdb_test_no_output "set variable z=0" " set variable z"
+ with_test_prefix "2" {
+ gdb_test_no_output "set variable z=2" " set variable z=2"
-# 2 3 0
-gdb_test "print x > y != z" "$false" "print value of x>y!=z"
+ # 1 3 2
+ gdb_test "print x > y == z" "$false" "print value of x>y==z"
-gdb_test_no_output "set variable x=4" "set x to 4"
+ gdb_test_no_output "set variable x=2" " set variable x=2"
+ gdb_test_no_output "set variable z=0" " set variable z=0"
-# 4 3 0
-gdb_test "print x > y <= z" "$false" "print value of x>y<=z"
+ # 2 3 0
+ gdb_test "print x > y != z" "$false" "print value of x>y!=z"
-# 4 3 0
-gdb_test "print x >= y == z" "$false" "print value of x>=y==z"
+ gdb_test_no_output "set variable x=4" "set variable x=4"
-gdb_test_no_output "set variable x=2" " set variable x"
+ # 4 3 0
+ gdb_test "print x > y <= z" "$false" "print value of x>y<=z"
-# 2 3 0
-gdb_test "print x >= y != z" "$false" "print value of x>=y!=z"
+ # 4 3 0
+ gdb_test "print x >= y == z" "$false" "print value of x>=y==z"
+ }
-gdb_test_no_output "set variable x=0" " set variable x"
-gdb_test_no_output "set variable z=4" " set variable z"
+ with_test_prefix "3" {
+ gdb_test_no_output "set variable x=2" " set variable x=2"
-# 0 3 4
-gdb_test "print x >= y <= z" "$true" "print value of x>=y<=z"
+ # 2 3 0
+ gdb_test "print x >= y != z" "$false" "print value of x>=y!=z"
-# 0 3 4
-gdb_test "print x <= y == z" "$false" "print value of x<=y==z"
+ gdb_test_no_output "set variable x=0" " set variable x=0"
+ gdb_test_no_output "set variable z=4" " set variable z=4"
-gdb_test_no_output "set variable x=2" " set variable x"
+ # 0 3 4
+ gdb_test "print x >= y <= z" "$true" "print value of x>=y<=z"
-# 2 3 4
-gdb_test "print x <= y != z" "$true" "print value of x<=y!=z"
+ # 0 3 4
+ gdb_test "print x <= y == z" "$false" "print value of x<=y==z"
+ }
-# 2 3 4
-gdb_test "print x == y != z" "$true" "print value of x==y!=z"
+ with_test_prefix "4" {
+ gdb_test_no_output "set variable x=2" " set variable x=2"
+ # 2 3 4
+ gdb_test "print x <= y != z" "$true" "print value of x<=y!=z"
+ # 2 3 4
+ gdb_test "print x == y != z" "$true" "print value of x==y!=z"
+ }
+}
# test use of parenthesis to enforce different order of evaluation
+with_test_prefix "with parenthesis" {
+ gdb_test_no_output "set variable z=0" " set variable z=0"
-gdb_test_no_output "set variable z=0" " set variable z"
+ # 2 3 0
+ gdb_test "print x >= (y < z)" "$true" "print value of x>=(y<z)"
-# 2 3 0
-gdb_test "print x >= (y < z)" "$true" "print value of x>=(y<z)"
+ # 2 3 0
+ gdb_test "print x >= (y != z)" "$true" "print value of x>=(y!=z)"
-# 2 3 0
-gdb_test "print x >= (y != z)" "$true" "print value of x>=(y!=z)"
+ # 2 3 0
+ gdb_test "print x == (y == z)" "$false" "print value of x==(y==z)"
-# 2 3 0
-gdb_test "print x == (y == z)" "$false" "print value of x==(y==z)"
+ gdb_test_no_output "set variable x=1" " set variable x=1"
+ gdb_test_no_output "set variable z=4" " set variable z=4"
-gdb_test_no_output "set variable x=1" " set variable x"
-gdb_test_no_output "set variable z=4" " set variable z"
-
-# 1 3 4
-gdb_test "print (x == y) < z" "$true" "print value of (x==y)<z"
+ # 1 3 4
+ gdb_test "print (x == y) < z" "$true" "print value of (x==y)<z"
+}
return -1
}
-proc check_pc_after_cross_syscall { syscall syscall_insn_next_addr } {
+proc_with_prefix check_pc_after_cross_syscall { syscall syscall_insn_next_addr } {
set syscall_insn_next_addr_found [get_hexadecimal_valueof "\$pc" "0"]
set test "single step over $syscall final pc"
# Delete the breakpoint on main.
gdb_test_no_output "delete break 1"
- gdb_test_no_output "set displaced-stepping off"
+ gdb_test_no_output "set displaced-stepping off" \
+ "set displaced-stepping off during test setup"
gdb_test "break $syscall" "Breakpoint \[0-9\]* at .*"
return { -1, -1 }
}
- set syscall_insn_addr [get_hexadecimal_valueof "\$pc" "0"]
+ set syscall_insn_addr [get_hexadecimal_valueof "\$pc" "0" \
+ "pc before stepi"]
if {[gdb_test "stepi" "x/i .*=>.*" "stepi $syscall insn"] != 0} {
return { -1, -1 }
}
- return [list $syscall_insn_addr [get_hexadecimal_valueof "\$pc" "0"]]
+ return [list $syscall_insn_addr [get_hexadecimal_valueof "\$pc" \
+ "0" "pc after stepi"]]
}
proc step_over_syscall { syscall } {
gdb_load ${binfile}
# Make certain that the output is consistent
- gdb_test_no_output "set print sevenbit-strings"
- gdb_test_no_output "set print address off"
- gdb_test_no_output "set width 0"
- gdb_test_no_output "set print elements 300"
+ with_test_prefix "types=$types" {
+ gdb_test_no_output "set print sevenbit-strings"
+ gdb_test_no_output "set print address off"
+ gdb_test_no_output "set width 0"
+ gdb_test_no_output "set print elements 300"
+ }
# Advance to main
if { ![runto_main] } then {