public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use clean_restart in gdb.trace
@ 2023-01-27 1:29 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-01-27 1:29 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a7e727aea73a6aef4b7fef4cf8fb958f3438d84d
commit a7e727aea73a6aef4b7fef4cf8fb958f3438d84d
Author: Tom Tromey <tom@tromey.com>
Date: Wed Jan 25 10:18:01 2023 -0700
Use clean_restart in gdb.trace
Change gdb.trace to use clean_restart more consistently.
Diff:
---
gdb/testsuite/gdb.trace/actions.exp | 17 +++--------------
gdb/testsuite/gdb.trace/ax.exp | 6 +-----
gdb/testsuite/gdb.trace/change-loc.exp | 4 +---
gdb/testsuite/gdb.trace/deltrace.exp | 9 +--------
gdb/testsuite/gdb.trace/entry-values.exp | 11 +----------
gdb/testsuite/gdb.trace/infotrace.exp | 8 +-------
gdb/testsuite/gdb.trace/packetlen.exp | 8 ++------
gdb/testsuite/gdb.trace/passc-dyn.exp | 7 ++-----
gdb/testsuite/gdb.trace/passcount.exp | 8 +-------
gdb/testsuite/gdb.trace/pending.exp | 4 +---
gdb/testsuite/gdb.trace/read-memory.exp | 4 +---
gdb/testsuite/gdb.trace/report.exp | 7 +------
gdb/testsuite/gdb.trace/save-trace.exp | 8 +-------
gdb/testsuite/gdb.trace/tfile.exp | 5 +----
gdb/testsuite/gdb.trace/tfind.exp | 8 ++------
gdb/testsuite/gdb.trace/tracecmd.exp | 8 +-------
gdb/testsuite/gdb.trace/tsv.exp | 6 ++----
gdb/testsuite/gdb.trace/unavailable.exp | 20 +++++---------------
gdb/testsuite/gdb.trace/while-dyn.exp | 8 ++------
gdb/testsuite/gdb.trace/while-stepping.exp | 17 +++--------------
20 files changed, 33 insertions(+), 140 deletions(-)
diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp
index cf7efbbd4fd..ffc3250577f 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 9dee743c8dd..9cc61d09182 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 4c4f54d89be..b77e283c0b4 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 cfcb81e8c91..a849d96f432 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 d7e5a89f281..9fbad50e3bd 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 1252b30c0f5..83660bed7a5 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 31686bcb3bb..df4badc35bd 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 c005c79053b..26a2cac4dd9 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 3f711496083..f2b70c3f3ad 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 76d28652820..da355bcdaee 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 9d82939ca74..f3a8d09d5f9 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 33bccaa1a6a..14db2511d40 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 71a094a25dc..501e171b186 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 68e951b1c83..c62f7e3e9e4 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 4579e85ed86..2dbc42bb631 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 7ce6f59e2c9..3fed8dad2ec 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 ea7ad55143a..2319444fab1 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 65fc56c3383..dfb1067d198 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 960a95926b7..797020e7674 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 64c0c9ed84f..995b5a083a4 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"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-27 1:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 1:29 [binutils-gdb] Use clean_restart in gdb.trace Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).