aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/attach-pie-misread.exp8
-rw-r--r--gdb/testsuite/gdb.base/break-interp.exp36
-rw-r--r--gdb/testsuite/gdb.base/catch-load.exp12
-rw-r--r--gdb/testsuite/gdb.base/disp-step-syscall.exp11
-rw-r--r--gdb/testsuite/gdb.base/jit-so.exp10
-rw-r--r--gdb/testsuite/gdb.base/jit.exp12
-rw-r--r--gdb/testsuite/gdb.base/return-nodebug.exp2
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.exp9
-rw-r--r--gdb/testsuite/gdb.base/solib-display.exp9
-rw-r--r--gdb/testsuite/gdb.base/solib-overlap.exp9
-rw-r--r--gdb/testsuite/gdb.base/watch-cond-infcall.exp12
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.exp10
12 files changed, 38 insertions, 102 deletions
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index 65477a9..de1055e 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -152,9 +152,7 @@ gdb_expect {
}
# Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
-foreach align_mult {1 2} {
- set old_ldprefix $pf_prefix
- lappend pf_prefix "shift-by-$align_mult:"
+foreach align_mult {1 2} { with_test_prefix " shift-by-$align_mult:" {
# FIXME: We believe there is enough room under FIRST_OFFSET.
set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
@@ -198,8 +196,6 @@ foreach align_mult {1 2} {
}
gdb_test "detach" "Detaching from program: .*"
-
- set pf_prefix $old_ldprefix
-}
+}}
remote_exec host "kill -9 $pid"
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 575e8f0..d6267ac 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -185,16 +185,12 @@ proc reach_1 {func command displacement} {
# 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} {
- global pf_prefix
- set old_ldprefix $pf_prefix
- lappend pf_prefix "reach-$func:"
-
- reach_1 $func $command $displacement
-
- set pf_prefix $old_ldprefix
+ with_test_prefix " reach-$func:" {
+ reach_1 $func $command $displacement
+ }
}
-proc test_core {file displacement} {
+proc test_core {file displacement} { with_test_prefix " core:" {
global srcdir subdir gdb_prompt expect_out
set corefile [core_find $file {} "segv"]
@@ -202,10 +198,6 @@ proc test_core {file displacement} {
return
}
- global pf_prefix
- set old_ldprefix $pf_prefix
- lappend pf_prefix "core:"
-
gdb_exit
gdb_start
# Clear it to never find any separate debug infos in $debug_root.
@@ -245,17 +237,11 @@ proc test_core {file displacement} {
}
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
+}}
- set pf_prefix $old_ldprefix
-}
-
-proc test_attach_gdb {file pid displacement prefix} {
+proc test_attach_gdb {file pid displacement prefix} { with_test_prefix " $prefix:" {
global gdb_prompt expect_out
- global pf_prefix
- set old_ldprefix $pf_prefix
- lappend pf_prefix "$prefix:"
-
gdb_exit
gdb_start
@@ -300,9 +286,7 @@ proc test_attach_gdb {file pid displacement prefix} {
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
gdb_exit
-
- set pf_prefix $old_ldprefix
-}
+}}
proc test_attach {file displacement {relink_args ""}} {
global board_info
@@ -429,7 +413,7 @@ proc test_ld {file ifmain trynosym displacement} {
global pf_prefix
set old_ldprefix $pf_prefix
- lappend pf_prefix "symbol-less:"
+ append pf_prefix " symbol-less:"
# Test also `exec-file'-command loaded $FILE - therefore without symbols.
# SYMBOL_OBJFILE is not available and only EXEC_BFD must be used.
@@ -544,7 +528,7 @@ foreach ldprelink {NO YES} {
set interp_saved ${interp}-saved
set pf_prefix $old_ldprefix
- lappend pf_prefix "$ldname:"
+ append pf_prefix " $ldname:"
if {$ldsepdebug == "NO"} {
file_copy $interp_system $interp
@@ -626,7 +610,7 @@ foreach ldprelink {NO YES} {
set exec $binprefix-$binname
set pf_prefix $old_binprefix
- lappend pf_prefix "$binname:"
+ append pf_prefix " $binname:"
set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]"
if {$binsepdebug != "NO"} {
diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
index 2b3112f..e17a563 100644
--- a/gdb/testsuite/gdb.base/catch-load.exp
+++ b/gdb/testsuite/gdb.base/catch-load.exp
@@ -46,20 +46,16 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
# names.
# KIND is passed to the "catch" command.
# MATCH is a boolean saying whether we expect the catchpoint to be hit.
-proc one_catch_load_test {scenario kind match sostop} {
+proc one_catch_load_test {scenario kind match sostop} { with_test_prefix "${scenario}:" {
global verbose testfile testfile2 binfile2_dlopen
- global pf_prefix srcfile
+ global srcfile
global decimal gdb_prompt
- set saved_prefix $pf_prefix
- append pf_prefix "${scenario}:"
-
clean_restart $testfile
gdb_load_shlibs $binfile2_dlopen
if {![runto_main]} {
fail "can't run to main"
- set pf_prefix $saved_prefix
return
}
@@ -97,9 +93,7 @@ proc one_catch_load_test {scenario kind match sostop} {
fail "continue"
}
}
-
- set pf_prefix $saved_prefix
-}
+}}
one_catch_load_test "plain load" "load" 1 0
one_catch_load_test "plain load with stop-on-solib-events" "load" 1 1
diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp
index 1f23399..61de211 100644
--- a/gdb/testsuite/gdb.base/disp-step-syscall.exp
+++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp
@@ -30,10 +30,9 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
return -1
}
-proc disp_step_cross_syscall { syscall } {
+proc disp_step_cross_syscall { syscall } { with_test_prefix " $syscall:" {
global syscall_insn
global gdb_prompt
- global pf_prefix
set testfile "disp-step-$syscall"
@@ -47,9 +46,6 @@ proc disp_step_cross_syscall { syscall } {
return
}
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$syscall:"
-
# Delete the breakpoint on main.
gdb_test_no_output "delete break 1"
@@ -94,7 +90,6 @@ proc disp_step_cross_syscall { syscall } {
if {$see_syscall_insn == 0} then {
fail "find syscall insn in $syscall"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -130,9 +125,7 @@ proc disp_step_cross_syscall { syscall } {
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker \\(\\) at.*" \
"continue to marker ($syscall)"
-
- set pf_prefix $old_pf_prefix
-}
+}}
disp_step_cross_syscall "fork"
disp_step_cross_syscall "vfork"
diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp
index b28f903..b595774 100644
--- a/gdb/testsuite/gdb.base/jit-so.exp
+++ b/gdb/testsuite/gdb.base/jit-so.exp
@@ -63,11 +63,8 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} {
- global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "one_jit_test-$count:"
+proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+ global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
gdb_load_shlibs $binfile2
@@ -114,8 +111,7 @@ proc one_jit_test {count match_str} {
# All jit librares must have been unregistered
gdb_test "info function jit_function" \
"All functions matching regular expression \"jit_function\":"
- set pf_prefix $old_pf_prefix
-}
+}}
one_jit_test 1 "${hex} jit_function_0000"
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp
index a1aa351..4b8059f 100644
--- a/gdb/testsuite/gdb.base/jit.exp
+++ b/gdb/testsuite/gdb.base/jit.exp
@@ -51,11 +51,8 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} {
- global verbose testfile solib_binfile_target solib_binfile_test_msg pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "one_jit_test-$count:"
+proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+ global verbose testfile solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
@@ -93,9 +90,8 @@ proc one_jit_test {count match_str} {
gdb_continue_to_breakpoint "break here 2"
# All jit librares must have been unregistered
gdb_test "info function jit_function" \
- "All functions matching regular expression \"jit_function\":"
- set pf_prefix $old_pf_prefix
-}
+ "All functions matching regular expression \"jit_function\":"
+}}
one_jit_test 1 "${hex} jit_function_0000"
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
diff --git a/gdb/testsuite/gdb.base/return-nodebug.exp b/gdb/testsuite/gdb.base/return-nodebug.exp
index 1058088..44b415b 100644
--- a/gdb/testsuite/gdb.base/return-nodebug.exp
+++ b/gdb/testsuite/gdb.base/return-nodebug.exp
@@ -18,7 +18,7 @@ proc do_test {type} {
global pf_prefix
set old_prefix $pf_prefix
- lappend pf_prefix "$typenospace:"
+ append pf_prefix " $typenospace:"
if {[runto "func"]} {
# Verify that we do not crash when using "return" from a function with
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 4010d33..cb1bd00 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -650,14 +650,10 @@ test_next_with_recursion
#********
-proc test_different_dir {type test_different_dir xfail} {
+proc test_different_dir {type test_different_dir xfail} { with_test_prefix " $type:" {
global srcdir subdir objdir binfile srcfile timeout gdb_prompt
- global pf_prefix
global bp_location6 decimal hex
- set old_pf_prefix $pf_prefix
- append pf_prefix " $type:"
-
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
@@ -747,9 +743,8 @@ proc test_different_dir {type test_different_dir xfail} {
gdb_test_no_output "set args main"
}
- set pf_prefix $old_pf_prefix
# proc test_different_dir
-}
+}}
# now move the .debug file to a different location so that we can test
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index c1a653d..6886e04 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -48,12 +48,8 @@ if [get_compiler_info ${binfile}] {
return -1
}
-set save_pf_prefix $pf_prefix
# SEP must be last for the possible `unsupported' error path.
-foreach libsepdebug {NO IN SEP} {
-
- set pf_prefix $save_pf_prefix
- lappend pf_prefix "$libsepdebug:"
+foreach libsepdebug {NO IN SEP} { with_test_prefix " $libsepdebug:" {
set sep_lib_flags $lib_flags
if {$libsepdebug != "NO"} {
@@ -135,5 +131,4 @@ foreach libsepdebug {NO IN SEP} {
gdb_test "break [gdb_get_line_number "break here" ${testfile}.c]" \
".*Breakpoint.* at .*"
gdb_test "continue" "6: a_static = 46\\r\\n5: a_local = 45\\r\\n4: main_global = 44\\r\\n.*"
-}
-set pf_prefix $save_pf_prefix
+}}
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index b83a99c..048e6cf 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -52,12 +52,9 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c
# false PASS.
# Prelink first lib1 at 0x40000000 and lib2 at 0x41000000.
# During second pass try lib1 at 0x50000000 and lib2 at 0x51000000.
-foreach prelink_lib1 {0x40000000 0x50000000} {
+foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix " $prelink_lib1:" {
set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]]
- set old_prefix $pf_prefix
- lappend pf_prefix "$prelink_lib1:"
-
# Library file.
set binfile_lib1 ${objdir}/${subdir}/${libname}1-${prelink_lib1}.so
set binfile_lib1_test_msg OBJDIR/${subdir}/${libname}1-${prelink_lib1}.so
@@ -137,6 +134,4 @@ foreach prelink_lib1 {0x40000000 0x50000000} {
sleep 5
remote_exec build "kill -9 ${testpid}"
-
- set pf_prefix $old_prefix
-}
+}}
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.exp b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
index 8b81453..383ce89 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.exp
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
@@ -25,12 +25,8 @@ if { [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
return -1
}
-proc test_watchpoint { hw teststr } {
+proc test_watchpoint { hw } {
global testfile
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$teststr:"
clean_restart ${testfile}
@@ -50,12 +46,10 @@ proc test_watchpoint { hw teststr } {
gdb_test "continue" \
"atchpoint \[0-9\]+: var\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*watchpoint-stop.*" \
"continue"
-
- set pf_prefix $old_pf_prefix
}
if { ![target_info exists gdb,no_hardware_watchpoints] } {
- test_watchpoint 1 "hw"
+ with_test_prefix " hw:" { test_watchpoint 1 }
}
-test_watchpoint 0 "sw"
+with_test_prefix " sw:" { test_watchpoint 0 }
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 381c26e..7a252bb 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -894,12 +894,10 @@ proc do_tests {} {
do_tests
if ![target_info exists gdb,no_hardware_watchpoints] {
- set save_pf_prefix $pf_prefix
- lappend pf_prefix "no-hw:"
-
- set no_hw 1
- do_tests
- set pf_prefix $save_pf_prefix
+ with_test_prefix " no-hw:" {
+ set no_hw 1
+ do_tests
+ }
}
# Restore old timeout