aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-25 10:18:01 -0700
committerTom Tromey <tom@tromey.com>2023-01-26 18:28:31 -0700
commita7e727aea73a6aef4b7fef4cf8fb958f3438d84d (patch)
tree16a5ab7669c756ffd80c14519fda90432702f9ef /gdb
parent49e118b61f07812235faec67cc783a0e866c3ff8 (diff)
downloadgdb-a7e727aea73a6aef4b7fef4cf8fb958f3438d84d.zip
gdb-a7e727aea73a6aef4b7fef4cf8fb958f3438d84d.tar.gz
gdb-a7e727aea73a6aef4b7fef4cf8fb958f3438d84d.tar.bz2
Use clean_restart in gdb.trace
Change gdb.trace to use clean_restart more consistently.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.trace/actions.exp17
-rw-r--r--gdb/testsuite/gdb.trace/ax.exp6
-rw-r--r--gdb/testsuite/gdb.trace/change-loc.exp4
-rw-r--r--gdb/testsuite/gdb.trace/deltrace.exp9
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.exp11
-rw-r--r--gdb/testsuite/gdb.trace/infotrace.exp8
-rw-r--r--gdb/testsuite/gdb.trace/packetlen.exp8
-rw-r--r--gdb/testsuite/gdb.trace/passc-dyn.exp7
-rw-r--r--gdb/testsuite/gdb.trace/passcount.exp8
-rw-r--r--gdb/testsuite/gdb.trace/pending.exp4
-rw-r--r--gdb/testsuite/gdb.trace/read-memory.exp4
-rw-r--r--gdb/testsuite/gdb.trace/report.exp7
-rw-r--r--gdb/testsuite/gdb.trace/save-trace.exp8
-rw-r--r--gdb/testsuite/gdb.trace/tfile.exp5
-rw-r--r--gdb/testsuite/gdb.trace/tfind.exp8
-rw-r--r--gdb/testsuite/gdb.trace/tracecmd.exp8
-rw-r--r--gdb/testsuite/gdb.trace/tsv.exp6
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.exp20
-rw-r--r--gdb/testsuite/gdb.trace/while-dyn.exp8
-rw-r--r--gdb/testsuite/gdb.trace/while-stepping.exp17
20 files changed, 33 insertions, 140 deletions
diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp
index cf7efbb..ffc3250 100644
--- a/gdb/testsuite/gdb.trace/actions.exp
+++ b/gdb/testsuite/gdb.trace/actions.exp
@@ -17,10 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
-
standard_testfile
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -28,11 +24,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_reinitialize_dir $srcdir/$subdir
-
-# If testing on a remote host, download the source file.
-# remote_download host $srcdir/$subdir/$srcfile
+clean_restart
gdb_file_cmd $binfile
# define relative source line numbers:
@@ -325,9 +318,7 @@ gdb_test "tsave -ctf ${tracefile}.ctf" \
"save ctf trace file"
# Restart GDB and read the trace data in tfile target.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_file_cmd $binfile
gdb_test "target tfile ${tracefile}.tf" ".*" \
"change to tfile target"
@@ -345,9 +336,7 @@ gdb_test_multiple "target ctf" "" {
}
if { $gdb_can_read_ctf_data } {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ctf ${tracefile}.ctf" ".*" \
"change to ctf target"
diff --git a/gdb/testsuite/gdb.trace/ax.exp b/gdb/testsuite/gdb.trace/ax.exp
index 9dee743..9cc61d0 100644
--- a/gdb/testsuite/gdb.trace/ax.exp
+++ b/gdb/testsuite/gdb.trace/ax.exp
@@ -20,9 +20,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
standard_testfile actions.c
require gdb_trace_common_supports_arch
@@ -33,9 +30,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
return -1
}
-gdb_load $binfile
+clean_restart $binfile
runto_main
-gdb_reinitialize_dir $srcdir/$subdir
gdb_test "maint agent 12" ".*const8 12.*pop.*end.*"
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 4c4f54d..b77e283 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -175,9 +175,7 @@ proc tracepoint_change_loc_2 { trace_type } {
global binfile
global gdb_prompt
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_test_multiple "${trace_type} set_tracepoint" "set pending tracepoint" {
-re ".*Make \(|fast \)tracepoint pending.*y or \\\[n\\\]. $" {
diff --git a/gdb/testsuite/gdb.trace/deltrace.exp b/gdb/testsuite/gdb.trace/deltrace.exp
index cfcb81e..a849d96 100644
--- a/gdb/testsuite/gdb.trace/deltrace.exp
+++ b/gdb/testsuite/gdb.trace/deltrace.exp
@@ -17,10 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
-
standard_testfile actions.c
require gdb_trace_common_supports_arch
@@ -30,11 +26,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_reinitialize_dir $srcdir/$subdir
-
-# If testing on a remote host, download the source file.
-# remote_download host $srcdir/$subdir/$srcfile
+clean_restart
gdb_file_cmd $binfile
# define relative source line numbers:
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index d7e5a89..9fbad50 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -29,14 +29,7 @@ if {[gdb_compile [list ${binfile}1.o] \
return -1
}
-# Start GDB and load executable file, compute the offset of the
-# instruction in bar returned from foo. It is needed in the Dwarf
-# Assembler.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}1
+clean_restart ${binfile}1
set returned_from_foo ""
@@ -83,8 +76,6 @@ if { [string equal $returned_from_foo ""] } {
return -1
}
-gdb_exit
-
# Make some DWARF for the test.
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp
index 1252b30..83660be 100644
--- a/gdb/testsuite/gdb.trace/infotrace.exp
+++ b/gdb/testsuite/gdb.trace/infotrace.exp
@@ -18,9 +18,6 @@
load_lib "trace-support.exp"
-gdb_exit
-gdb_start
-
standard_testfile actions.c
require gdb_trace_common_supports_arch
@@ -30,11 +27,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_reinitialize_dir $srcdir/$subdir
-
-# If testing on a remote host, download the source file.
-# remote_download host $srcdir/$subdir/$srcfile
+clean_restart
gdb_file_cmd $binfile
#
diff --git a/gdb/testsuite/gdb.trace/packetlen.exp b/gdb/testsuite/gdb.trace/packetlen.exp
index 31686bc..df4badc 100644
--- a/gdb/testsuite/gdb.trace/packetlen.exp
+++ b/gdb/testsuite/gdb.trace/packetlen.exp
@@ -17,10 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
-
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -28,11 +24,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_load $binfile
+
+clean_restart $binfile
gdb_test "tstop" ".*" ""
gdb_test "tfind none" ".*" ""
runto_main
-gdb_reinitialize_dir $srcdir/$subdir
if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
diff --git a/gdb/testsuite/gdb.trace/passc-dyn.exp b/gdb/testsuite/gdb.trace/passc-dyn.exp
index c005c79..26a2cac 100644
--- a/gdb/testsuite/gdb.trace/passc-dyn.exp
+++ b/gdb/testsuite/gdb.trace/passc-dyn.exp
@@ -17,9 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -27,9 +24,9 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_load $binfile
+
+clean_restart $binfile
runto_main
-gdb_reinitialize_dir $srcdir/$subdir
if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
diff --git a/gdb/testsuite/gdb.trace/passcount.exp b/gdb/testsuite/gdb.trace/passcount.exp
index 3f71149..f2b70c3 100644
--- a/gdb/testsuite/gdb.trace/passcount.exp
+++ b/gdb/testsuite/gdb.trace/passcount.exp
@@ -17,9 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -27,11 +24,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_reinitialize_dir $srcdir/$subdir
-
-# If testing on a remote host, download the source file.
-# remote_download host $srcdir/$subdir/$srcfile
+clean_restart
gdb_file_cmd $binfile
# define relative source line numbers:
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 76d2865..da355bc 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -66,9 +66,7 @@ proc pending_tracepoint_resolved { trace_type } {
global lib_sl1
# Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
-re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
diff --git a/gdb/testsuite/gdb.trace/read-memory.exp b/gdb/testsuite/gdb.trace/read-memory.exp
index 9d82939..f3a8d09 100644
--- a/gdb/testsuite/gdb.trace/read-memory.exp
+++ b/gdb/testsuite/gdb.trace/read-memory.exp
@@ -127,9 +127,7 @@ proc teset_from_exec { target } {
global tracefile
# Restart GDB and read the trace data in ${target} target.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ${target} ${tracefile}.${target}" ".*" \
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
index 33bccaa..14db251 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -17,10 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
-
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -28,9 +24,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_load $binfile
+clean_restart $binfile
runto_main
-gdb_reinitialize_dir $srcdir/$subdir
if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp
index 71a094a..501e171 100644
--- a/gdb/testsuite/gdb.trace/save-trace.exp
+++ b/gdb/testsuite/gdb.trace/save-trace.exp
@@ -18,9 +18,6 @@
load_lib "trace-support.exp"
-gdb_exit
-gdb_start
-
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -28,11 +25,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_reinitialize_dir $srcdir/$subdir
-
-# If testing on a remote host, download the source file.
-# remote_download host $srcdir/$subdir/$srcfile
+clean_restart
gdb_file_cmd $binfile
# define relative source line numbers:
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index 68e951b..c62f7e3 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -121,10 +121,7 @@ gdb_test "info registers" "The program has no registers now\." \
# Now start afresh, using only a trace file.
-gdb_exit
-gdb_start
-
-gdb_load $binfile
+clean_restart $binfile
gdb_test "target tfile $tfile_error" "Created tracepoint.*" \
"target tfile [file tail $tfile_error]"
diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp
index 4579e85..2dbc42b 100644
--- a/gdb/testsuite/gdb.trace/tfind.exp
+++ b/gdb/testsuite/gdb.trace/tfind.exp
@@ -17,10 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
-
standard_testfile actions.c
require gdb_trace_common_supports_arch
@@ -30,7 +26,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \
untested "failed to compile"
return -1
}
-gdb_load $binfile
+
+clean_restart $binfile
# 6.2 test help tstart
gdb_test "help tstart" \
@@ -60,7 +57,6 @@ gdb_test "help tfind trace" "Select a trace frame by tracepoint number.*" \
"8.38: help tfind tracepoint"
runto_main
-gdb_reinitialize_dir $srcdir/$subdir
if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp
index 7ce6f59..3fed8da 100644
--- a/gdb/testsuite/gdb.trace/tracecmd.exp
+++ b/gdb/testsuite/gdb.trace/tracecmd.exp
@@ -17,9 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -27,11 +24,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_reinitialize_dir $srcdir/$subdir
-
-# If testing on a remote host, download the source file.
-# remote_download host $srcdir/$subdir/$srcfile
+clean_restart
gdb_file_cmd $binfile
# define relative source line numbers:
diff --git a/gdb/testsuite/gdb.trace/tsv.exp b/gdb/testsuite/gdb.trace/tsv.exp
index ea7ad55..2319444 100644
--- a/gdb/testsuite/gdb.trace/tsv.exp
+++ b/gdb/testsuite/gdb.trace/tsv.exp
@@ -15,9 +15,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -25,7 +22,8 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_load $binfile
+
+clean_restart $binfile
# PR gdb/21352: Command tsave does not support -r argument
gdb_test "tsave -r" "Argument required \\\(file in which to save trace data\\\)\." \
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 65fc56c..dfb1067 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -202,9 +202,7 @@ proc gdb_collect_args_test {} {
foreach target_name ${trace_file_targets} {
# Restart GDB and read the trace data in ${TARGET_NAME} target.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ${target_name} ${tracefile}.args.${target_name}" ".*" \
"change to ${target_name} target"
@@ -286,9 +284,7 @@ proc gdb_collect_locals_test { func msg } {
foreach target_name ${trace_file_targets} {
# Restart GDB and read the trace data in ${TARGET_NAME} target.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ${target_name} ${tracefile}.locals.${target_name}" ".*" \
"change to ${target_name} target"
@@ -369,9 +365,7 @@ proc gdb_unavailable_registers_test { } {
foreach target_name ${trace_file_targets} {
# Restart GDB and read the trace data in ${TARGET_NAME} target.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ${target_name} ${tracefile}.registers.${target_name}" ".*" \
"change to ${target_name} target"
@@ -433,9 +427,7 @@ proc gdb_unavailable_floats { } {
foreach target_name ${trace_file_targets} {
# Restart GDB and read the trace data in ${TARGET_NAME} target.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ${target_name} ${tracefile}.floats.${target_name}" ".*" \
"change to ${target_name} target"
@@ -701,9 +693,7 @@ proc gdb_collect_globals_test { } {
foreach target_name ${trace_file_targets} {
# Restart GDB and read the trace data in ${TARGET_NAME} target.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ${target_name} ${tracefile}.globals.${target_name}" ".*" \
"change to ${target_name} target"
diff --git a/gdb/testsuite/gdb.trace/while-dyn.exp b/gdb/testsuite/gdb.trace/while-dyn.exp
index 960a959..797020e 100644
--- a/gdb/testsuite/gdb.trace/while-dyn.exp
+++ b/gdb/testsuite/gdb.trace/while-dyn.exp
@@ -17,10 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
-
standard_testfile actions.c
set executable $testfile
require gdb_trace_common_supports_arch
@@ -29,9 +25,9 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-gdb_load $binfile
+
+clean_restart $binfile
runto_main
-gdb_reinitialize_dir $srcdir/$subdir
if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp
index 64c0c9e..995b5a0 100644
--- a/gdb/testsuite/gdb.trace/while-stepping.exp
+++ b/gdb/testsuite/gdb.trace/while-stepping.exp
@@ -17,10 +17,6 @@
load_lib "trace-support.exp"
-
-gdb_exit
-gdb_start
-
standard_testfile actions.c
require gdb_trace_common_supports_arch
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
@@ -28,11 +24,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
untested "failed to compile"
return -1
}
-gdb_reinitialize_dir $srcdir/$subdir
-
-# If testing on a remote host, download the source file.
-# remote_download host $srcdir/$subdir/$srcfile
+clean_restart
gdb_file_cmd $binfile
#
@@ -151,9 +144,7 @@ gdb_test "tsave -ctf ${tracefile}.ctf" \
"save ctf trace file"
# Restart GDB and read the trace data in tfile target.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_file_cmd $binfile
gdb_test "target tfile ${tracefile}.tf" ".*" \
"change to tfile target"
@@ -171,9 +162,7 @@ gdb_test_multiple "target ctf" "" {
}
if { $gdb_can_read_ctf_data } {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_file_cmd $binfile
gdb_test "target ctf ${tracefile}.ctf" ".*" \
"change to ctf target"