public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use clean_restart in gdb.base
@ 2023-01-27 1:31 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-01-27 1:31 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c95d486d35f87b4e32941f20bed56f57ebd58d8b
commit c95d486d35f87b4e32941f20bed56f57ebd58d8b
Author: Tom Tromey <tom@tromey.com>
Date: Wed Jan 25 14:55:12 2023 -0700
Use clean_restart in gdb.base
Change gdb.base to use clean_restart more consistently.
Diff:
---
gdb/testsuite/gdb.base/address_space_qualifier.exp | 4 +---
gdb/testsuite/gdb.base/alias.exp | 4 +---
gdb/testsuite/gdb.base/annota1.exp | 5 +----
gdb/testsuite/gdb.base/bitops.exp | 5 +----
gdb/testsuite/gdb.base/break-interp.exp | 8 ++------
gdb/testsuite/gdb.base/checkpoint.exp | 5 +----
gdb/testsuite/gdb.base/comprdebug.exp | 4 +---
gdb/testsuite/gdb.base/cursal.exp | 4 +---
gdb/testsuite/gdb.base/detach.exp | 6 +-----
gdb/testsuite/gdb.base/dfp-exprs.exp | 6 +-----
gdb/testsuite/gdb.base/display.exp | 5 +----
gdb/testsuite/gdb.base/dprintf-pending.exp | 8 ++------
gdb/testsuite/gdb.base/dump.exp | 9 ++-------
gdb/testsuite/gdb.base/fileio.exp | 7 +------
gdb/testsuite/gdb.base/fixsection.exp | 7 +------
gdb/testsuite/gdb.base/foll-exec.exp | 3 ---
gdb/testsuite/gdb.base/fullname.exp | 12 +++---------
gdb/testsuite/gdb.base/gcore.exp | 5 +----
gdb/testsuite/gdb.base/hashline2.exp | 5 +----
gdb/testsuite/gdb.base/hashline3.exp | 5 +----
gdb/testsuite/gdb.base/langs.exp | 5 +----
gdb/testsuite/gdb.base/list.exp | 6 +-----
gdb/testsuite/gdb.base/pending.exp | 12 ++----------
gdb/testsuite/gdb.base/permissions.exp | 4 +---
gdb/testsuite/gdb.base/print-symbol-loading.exp | 4 +---
gdb/testsuite/gdb.base/printcmds.exp | 6 +-----
gdb/testsuite/gdb.base/readline.exp | 4 +---
gdb/testsuite/gdb.base/relocate.exp | 12 +++---------
gdb/testsuite/gdb.base/sep.exp | 5 +----
gdb/testsuite/gdb.base/sepdebug.exp | 8 ++------
gdb/testsuite/gdb.base/solib-disc.exp | 5 +----
gdb/testsuite/gdb.base/solib-symbol.exp | 5 +----
gdb/testsuite/gdb.base/solib-weak.exp | 5 +----
gdb/testsuite/gdb.base/subst.exp | 4 +---
gdb/testsuite/gdb.base/unload.exp | 7 +------
gdb/testsuite/gdb.base/watchpoint-solib.exp | 7 +------
36 files changed, 44 insertions(+), 172 deletions(-)
diff --git a/gdb/testsuite/gdb.base/address_space_qualifier.exp b/gdb/testsuite/gdb.base/address_space_qualifier.exp
index ec8d3a33342..a8b8856a244 100644
--- a/gdb/testsuite/gdb.base/address_space_qualifier.exp
+++ b/gdb/testsuite/gdb.base/address_space_qualifier.exp
@@ -16,9 +16,7 @@
# Regression test for expression evaluation of address space qualifiers
# in C and C++.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test_no_output "set language c"
diff --git a/gdb/testsuite/gdb.base/alias.exp b/gdb/testsuite/gdb.base/alias.exp
index 7a1a95528c6..d3ddafabf70 100644
--- a/gdb/testsuite/gdb.base/alias.exp
+++ b/gdb/testsuite/gdb.base/alias.exp
@@ -14,9 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Helper to test the -a option to alias.
# Aliases that are abbreviations of commands (e.g. r -> run)
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 96698642675..90c03d0d385 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -495,10 +495,7 @@ proc thread_test {} {
if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${binfile}
+ clean_restart $binfile
if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/bitops.exp b/gdb/testsuite/gdb.base/bitops.exp
index c619b163769..fc575b9e49b 100644
--- a/gdb/testsuite/gdb.base/bitops.exp
+++ b/gdb/testsuite/gdb.base/bitops.exp
@@ -28,10 +28,7 @@
#
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
+clean_restart
gdb_test "print !1" ".\[0-9\]* = 0" "print value of !1"
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 6061c739d05..17a686e5716 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -393,11 +393,9 @@ proc test_ld {file ifmain trynosym displacement} {
# First test normal `file'-command loaded $FILE with symbols.
- gdb_exit
- gdb_start
+ clean_restart
# Clear it to never find any separate debug infos in $debug_root.
gdb_test_no_output "set debug-file-directory"
- gdb_reinitialize_dir $srcdir/$subdir
gdb_load $file
# Print the "PIE (Position Independent Executable) displacement" message.
@@ -479,11 +477,9 @@ proc test_ld {file ifmain trynosym displacement} {
# without symbols. SYMBOL_OBJFILE is not available and only
# EXEC_BFD must be used.
- gdb_exit
- gdb_start
+ clean_restart
# Clear it to never find any separate debug infos in $debug_root.
gdb_test_no_output "set debug-file-directory"
- gdb_reinitialize_dir $srcdir/$subdir
# Print the "PIE (Position Independent Executable)
# displacement" message.
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index afe2203c285..189a240979f 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -290,10 +290,7 @@ gdb_test "restart 10" "Not found.*" "no more checkpoint 10"
# Now let's try setting a large number of checkpoints (>600)
#
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
runto_main
gdb_breakpoint $break1_loc
diff --git a/gdb/testsuite/gdb.base/comprdebug.exp b/gdb/testsuite/gdb.base/comprdebug.exp
index 72b330cf5a6..3e0113ca415 100644
--- a/gdb/testsuite/gdb.base/comprdebug.exp
+++ b/gdb/testsuite/gdb.base/comprdebug.exp
@@ -34,9 +34,7 @@ if {$result == 1} {
return
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
set testname "file [file tail $ofile]"
if {[gdb_file_cmd $ofile] == 0} {
pass $testname
diff --git a/gdb/testsuite/gdb.base/cursal.exp b/gdb/testsuite/gdb.base/cursal.exp
index 59cb1a28adc..0d4371aab92 100644
--- a/gdb/testsuite/gdb.base/cursal.exp
+++ b/gdb/testsuite/gdb.base/cursal.exp
@@ -21,9 +21,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_file_cmd ${binfile}
gdb_test_no_output "set listsize 1"
diff --git a/gdb/testsuite/gdb.base/detach.exp b/gdb/testsuite/gdb.base/detach.exp
index d4427c13087..56ea9322a6d 100644
--- a/gdb/testsuite/gdb.base/detach.exp
+++ b/gdb/testsuite/gdb.base/detach.exp
@@ -42,11 +42,7 @@ proc do_detach_tests {} {
gdb_test "detach" "Detaching from program: .*$escapedbinfile, .*" "detach, $pass"
}
-# Start with a fresh gdb
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
global pass
set pass "one"
diff --git a/gdb/testsuite/gdb.base/dfp-exprs.exp b/gdb/testsuite/gdb.base/dfp-exprs.exp
index 9794d3e59c9..512d2ec4596 100644
--- a/gdb/testsuite/gdb.base/dfp-exprs.exp
+++ b/gdb/testsuite/gdb.base/dfp-exprs.exp
@@ -191,11 +191,7 @@ proc test_dfp_conversions {} {
gdb_test "p (_Decimal32) 4" " = 4"
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
test_dfp_literals_accepted
test_dfp_arithmetic_expressions
diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
index a349fc8a97d..79ef4d894e8 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -52,10 +52,7 @@ if !$use_gdb_stub {
gdb_test "kill" ".*" "kill again"
gdb_test "detach" ".*" "detach again"
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${binfile}
+ clean_restart $binfile
}
# Ok, on to real life
diff --git a/gdb/testsuite/gdb.base/dprintf-pending.exp b/gdb/testsuite/gdb.base/dprintf-pending.exp
index 79abd69cd62..f80ca3b60c4 100644
--- a/gdb/testsuite/gdb.base/dprintf-pending.exp
+++ b/gdb/testsuite/gdb.base/dprintf-pending.exp
@@ -31,18 +31,14 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
}
with_test_prefix "without format" {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_test "dprintf pendfunc" "Format string required" "missing ,FMT"
gdb_test "dprintf pendfunc," "Format string required" "missing FMT"
}
with_test_prefix "without symbols" {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_test \
"dprintf pendfunc1, \"x=%d\\n\", x" \
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index 2a722808c46..bc0ab4a8805 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -52,11 +52,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${op
return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart $binfile
gdb_test "dump mem /dev/null 0x10 0x20" "Cannot access memory at address 0x10" \
"inaccessible memory is reported"
@@ -479,8 +475,7 @@ foreach_with_prefix format $formats {
# Now start a fresh gdb session, and reload the saved value files.
-gdb_exit
-gdb_start
+clean_restart
gdb_file_cmd ${binfile}
# Now fix the endianness at the correct state.
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
index fd2eab5c6fc..09ca29eebee 100644
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -45,12 +45,7 @@ system "rm -rf [standard_output_file *.fileio.test]"
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set width 0"
diff --git a/gdb/testsuite/gdb.base/fixsection.exp b/gdb/testsuite/gdb.base/fixsection.exp
index b998a151fce..8b6f86a868b 100644
--- a/gdb/testsuite/gdb.base/fixsection.exp
+++ b/gdb/testsuite/gdb.base/fixsection.exp
@@ -32,12 +32,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
gdb_load_shlib ${lib_sl}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 83ccb54e60e..0092fcceacc 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -379,9 +379,6 @@ proc do_exec_tests {} {
}
}
-# Start with a fresh gdb
-
-gdb_exit
clean_restart $binfile
do_exec_tests
diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp
index 51ccb012688..3e25f8de58b 100644
--- a/gdb/testsuite/gdb.base/fullname.exp
+++ b/gdb/testsuite/gdb.base/fullname.exp
@@ -45,9 +45,7 @@ set line [gdb_get_line_number "set breakpoint 1 here"]
# Initialize GDB after getting the line number, to make sure
# symbols aren't loaded.
-gdb_exit
-gdb_start
-gdb_load ${binfile}
+clean_restart $binfile
set msg "set breakpoint by full path before loading symbols - built absolute"
if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
@@ -72,9 +70,7 @@ if { [gdb_compile [relative_filename [pwd] [standard_output_file tmp-${srcfile}
return -1
}
-gdb_exit
-gdb_start
-gdb_load ${binfile}
+clean_restart $binfile
set msg "set breakpoint by full path before loading symbols - built relative"
if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
@@ -103,9 +99,7 @@ with_cwd [standard_output_file {}] {
}
}
-gdb_exit
-gdb_start
-gdb_load ${binfile}
+clean_restart $binfile
set msg "set breakpoint by full path before loading symbols - built other"
if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp
index bd5dcd250ea..1e88d5334ba 100644
--- a/gdb/testsuite/gdb.base/gcore.exp
+++ b/gdb/testsuite/gdb.base/gcore.exp
@@ -57,10 +57,7 @@ if {!$core_supported} {
}
# Now restart gdb and load the corefile.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
set core_loaded [gdb_core_cmd "$corefile" "re-load generated corefile"]
if { $core_loaded == -1 } {
diff --git a/gdb/testsuite/gdb.base/hashline2.exp b/gdb/testsuite/gdb.base/hashline2.exp
index 6b270d839f3..7916f0cbe1f 100644
--- a/gdb/testsuite/gdb.base/hashline2.exp
+++ b/gdb/testsuite/gdb.base/hashline2.exp
@@ -34,10 +34,7 @@ if { [gdb_compile $new_srcfile "${binfile}" executable {debug}] != "" } {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
set bp_location [gdb_get_line_number "set breakpoint here" ${new_srcfile}]
diff --git a/gdb/testsuite/gdb.base/hashline3.exp b/gdb/testsuite/gdb.base/hashline3.exp
index e0b1656223e..abc5f629978 100644
--- a/gdb/testsuite/gdb.base/hashline3.exp
+++ b/gdb/testsuite/gdb.base/hashline3.exp
@@ -35,10 +35,7 @@ if { [gdb_compile $new_srcfile "${binfile}" executable {debug}] != "" } {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
set bp_location [gdb_get_line_number "set breakpoint here" $new_srcfile]
diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
index 19830dc422d..44da0a9c175 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -93,10 +93,7 @@ if {[runto csub]} {
gdb_continue_to_end "first session"
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+clean_restart $binfile
# Try exercising the "minimal" language a bit...
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index 4fbf5352c7b..18ecd13ac0f 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -400,11 +400,7 @@ proc test_list_invalid_args {} {
"second use of \"list +INVALID\""
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_file_cmd ${binfile}
gdb_test_no_output "set width 0"
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index c3e6bb4d58a..be54fb1ce08 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -35,11 +35,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
-re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
@@ -68,11 +64,7 @@ gdb_test "" \
".*Breakpoint.*pendfunc1.*at.*pendshr.c:$pendfunc1_loc.*y = x \\+ 4.*" \
"run to resolved breakpoint 1 (without symbols)"
-# Restart with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
with_test_prefix "second load" {
gdb_load ${binfile}
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 7bbe8f0ff16..a78b40a6dce 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -26,9 +26,7 @@ if {[build_executable $testfile.exp $testfile \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
with_test_prefix "observer mode off" {
diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp
index c8d1ee763bf..bdea0982dea 100644
--- a/gdb/testsuite/gdb.base/print-symbol-loading.exp
+++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp
@@ -49,9 +49,7 @@ if {![gdb_gcore_cmd $gcorefile "save a corefile"]} {
proc test_load_core { print_symbol_loading } {
global binfile binfile_lib gcorefile srcdir subdir
with_test_prefix "core ${print_symbol_loading}" {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_test_no_output "set print symbol-loading $print_symbol_loading"
if { ${print_symbol_loading} != "off" } {
gdb_test "file $binfile" "Reading symbols from.*" "file"
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index c1adc787e33..21a2cad458c 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -1087,11 +1087,7 @@ proc test_printf_convenience_var {prefix} {
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test "print \$pc" "No registers\\."
diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp
index d46db245a38..73c10f8000f 100644
--- a/gdb/testsuite/gdb.base/readline.exp
+++ b/gdb/testsuite/gdb.base/readline.exp
@@ -199,9 +199,7 @@ save_vars { env(TERM) } {
set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
set env(GDBHISTSIZE) "10"
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
operate_and_get_next "Simple operate-and-get-next, two" \
"p 7" ".* = 7" \
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index add323b53f8..4c09090b7c0 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -25,9 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
#Check that invalid options are rejected.
foreach x {"-raednow" "readnow" "foo" "-readnow s"} {
@@ -194,9 +192,7 @@ if { "${function_foo_addr}" == "${function_bar_addr}" } {
# Now use a variable as an offset to add-symbol-file, and check that
# the functions' addresses change.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test_no_output "set \$offset = 0x10000"
@@ -317,9 +313,7 @@ with_test_prefix "global vars, 3rd" {
# Now try loading the object as an exec-file; we should be able to print
# the values of variables after we do this.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_file_cmd ${binfile}
# Check the values of the variables.
diff --git a/gdb/testsuite/gdb.base/sep.exp b/gdb/testsuite/gdb.base/sep.exp
index 500c2c1ce12..29901af34a5 100644
--- a/gdb/testsuite/gdb.base/sep.exp
+++ b/gdb/testsuite/gdb.base/sep.exp
@@ -45,10 +45,7 @@ gdb_test "list sep-proc.c:$location" \
# Try the same, but this time with a breakpoint. We need to exit
# GDB to make sure that we havn't loaded the full symbols yet when
# we test the breakpoint insertion.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
set test "breakpoint inside included file"
gdb_test_multiple "break sep-proc.c:$location" "$test" {
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 7daf3388f77..6a0c1035552 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -561,9 +561,7 @@ proc test_different_dir {type test_different_dir xfail} {
global srcdir subdir binfile srcfile timeout gdb_prompt
global bp_location6 decimal hex
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_test_no_output "set debug-file-directory ${test_different_dir}" \
"set separate debug location"
gdb_load ${binfile}
@@ -656,9 +654,7 @@ if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
remote_exec build "cp ${debugfile} [standard_output_file sepdebug2.debug]"
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
set escapedobjdirsubdir [string_to_regexp [standard_output_file {}]]
diff --git a/gdb/testsuite/gdb.base/solib-disc.exp b/gdb/testsuite/gdb.base/solib-disc.exp
index 46b11dc768b..c397f6b3d72 100644
--- a/gdb/testsuite/gdb.base/solib-disc.exp
+++ b/gdb/testsuite/gdb.base/solib-disc.exp
@@ -44,10 +44,7 @@ if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
gdb_load_shlib $libobj
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
index 302981a64ad..f1d3c3a5c5a 100644
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -34,10 +34,7 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
gdb_load_shlib $binfile_lib
# Set a breakpoint in the binary.
diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp
index 9a140c1d9ac..dc99be71648 100644
--- a/gdb/testsuite/gdb.base/solib-weak.exp
+++ b/gdb/testsuite/gdb.base/solib-weak.exp
@@ -84,10 +84,7 @@ proc do_test { lib1opts lib2opts lib1first } {
}
with_test_prefix $testopts {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${binfile}
+ clean_restart $binfile
gdb_load_shlib $lib1
gdb_load_shlib $lib2
diff --git a/gdb/testsuite/gdb.base/subst.exp b/gdb/testsuite/gdb.base/subst.exp
index ad5ebb3e864..6f3d57e8df4 100644
--- a/gdb/testsuite/gdb.base/subst.exp
+++ b/gdb/testsuite/gdb.base/subst.exp
@@ -13,9 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Do a bunch of testing of the set/unset/show substitute-path
# commands that do not require the presence of an executable.
diff --git a/gdb/testsuite/gdb.base/unload.exp b/gdb/testsuite/gdb.base/unload.exp
index 3e340e9fada..76b061cacc2 100644
--- a/gdb/testsuite/gdb.base/unload.exp
+++ b/gdb/testsuite/gdb.base/unload.exp
@@ -50,12 +50,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
gdb_load_shlib $lib_sl
gdb_load_shlib $lib_sl2
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.exp b/gdb/testsuite/gdb.base/watchpoint-solib.exp
index 142680c58cb..b648a017438 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-solib.exp
@@ -49,12 +49,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
gdb_load_shlib $lib_sl
runto_main
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-27 1:31 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:31 [binutils-gdb] Use clean_restart in gdb.base 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).