* [PATCH][gdb/testsuite] Use clean_restart where possible
2020-11-10 19:21 ` Simon Marchi
@ 2020-11-11 9:18 ` Tom de Vries
2020-11-11 15:49 ` Simon Marchi
0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2020-11-11 9:18 UTC (permalink / raw)
To: Simon Marchi, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
[ was: Re: [PATCH][gdb/testsuite] Add
gdb.dwarf2/fission-multi-cu-clang.exp ]
On 11/10/20 8:21 PM, Simon Marchi wrote:
>> +gdb_exit
>> +gdb_start
>> +gdb_reinitialize_dir $srcdir/$subdir
>
> clean_restart?
Hmm yes, that's one of those things I just pick up by starting a
test-case using a copy of another test-case.
So, let's fix this in those other test-cases as well.
FWIW, I'm open to suggestions to do this in an easier way than using awk.
Thanks,
- Tom
[-- Attachment #2: 0001-gdb-testsuite-Use-clean_restart-where-possible.patch --]
[-- Type: text/x-patch, Size: 89455 bytes --]
[gdb/testsuite] Use clean_restart where possible
A command series:
...
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load <file>
...
can be replaced with the shorter:
...
clean_restart <file>
...
Likewise, if the gdb_load is not present, a command series:
...
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
...
can be replaced with the shorter:
...
clean_restart
...
Do this replacement using replace.awk:
...
BEGINFILE {
var=0
}
/^[ \t]*gdb_exit$/ {
match($0, /(^[ \t]*)/, m)
prefix=m[1]
if (var == 0) {
var=1
line=$0
next
}
}
/^[ \t]*gdb_start$/ {
match($0, /(^[ \t]*)/, m)
if (var == 1 && m[1] == prefix) {
var=2
line=line "\n" $0
next
}
}
/^[ \t]*gdb_reinitialize_dir \$srcdir\/\$subdir$/ {
match($0, /(^[ \t]*)/, m)
if (var == 2 && m[1] == prefix) {
var=3
line=prefix "clean_restart"
next
}
}
/^[ \t]*gdb_load [^ \t]*$/ {
match($0, /(^[ \t]*)/, m)
if (var == 3 && m[1] == prefix) {
var=0
match($0, /gdb_load ([^ \t]*$)/, m)
file=m[1]
print prefix "clean_restart " file
next
}
}
// {
if (var >= 1) { var=0 ; print line }
print $0
}
ENDFILE {
if (var >= 1) { var=0 ; print line }
}
...
and:
...
$ for f in $(find gdb/testsuite/ -name *.exp); do \
awk -i inplace -f replace.awk $f \
done
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-11-11 Tom de Vries <tdevries@suse.de>
* gdb.ada/assign_1.exp: Use clean_restart where possible.
* gdb.ada/boolean_expr.exp: Same.
* gdb.ada/ptype_arith_binop.exp: Same.
* gdb.arch/alpha-step.exp: Same.
* gdb.arch/altivec-abi.exp: Same.
* gdb.arch/e500-prologue.exp: Same.
* gdb.arch/e500-regs.exp: Same.
* gdb.arch/gdb1291.exp: Same.
* gdb.arch/gdb1431.exp: Same.
* gdb.arch/gdb1558.exp: Same.
* gdb.arch/i386-biarch-core.exp: Same.
* gdb.arch/i386-bp_permanent.exp: Same.
* gdb.arch/i386-gnu-cfi.exp: Same.
* gdb.arch/i386-prologue.exp: Same.
* gdb.arch/i386-signal.exp: Same.
* gdb.arch/i386-size-overlap.exp: Same.
* gdb.arch/i386-size.exp: Same.
* gdb.arch/i386-unwind.exp: Same.
* gdb.arch/ia64-breakpoint-shadow.exp: Same.
* gdb.arch/mips-octeon-bbit.exp: Same.
* gdb.arch/pa-nullify.exp: Same.
* gdb.arch/powerpc-aix-prologue.exp: Same.
* gdb.arch/powerpc-d128-regs.exp: Same.
* gdb.arch/powerpc-prologue.exp: Same.
* gdb.arch/ppc-dfp.exp: Same.
* gdb.arch/ppc-fp.exp: Same.
* gdb.arch/ppc64-symtab-cordic.exp: Same.
* gdb.arch/pr25124.exp: Same.
* gdb.arch/thumb-prologue.exp: Same.
* gdb.arch/thumb2-it.exp: Same.
* gdb.arch/vsx-regs.exp: Same.
* gdb.base/alias.exp: Same.
* gdb.base/annota1.exp: Same.
* gdb.base/bitops.exp: Same.
* gdb.base/checkpoint.exp: Same.
* gdb.base/comprdebug.exp: Same.
* gdb.base/cursal.exp: Same.
* gdb.base/detach.exp: Same.
* gdb.base/dfp-exprs.exp: Same.
* gdb.base/display.exp: Same.
* gdb.base/dprintf-pending.exp: Same.
* gdb.base/dump.exp: Same.
* gdb.base/fileio.exp: Same.
* gdb.base/fixsection.exp: Same.
* gdb.base/gcore.exp: Same.
* gdb.base/hashline2.exp: Same.
* gdb.base/hashline3.exp: Same.
* gdb.base/langs.exp: Same.
* gdb.base/list.exp: Same.
* gdb.base/pending.exp: Same.
* gdb.base/permissions.exp: Same.
* gdb.base/print-symbol-loading.exp: Same.
* gdb.base/printcmds.exp: Same.
* gdb.base/readline.exp: Same.
* gdb.base/relocate.exp: Same.
* gdb.base/sect-cmd.exp: Same.
* gdb.base/sep.exp: Same.
* gdb.base/sepdebug.exp: Same.
* gdb.base/shlib-call.exp: Same.
* gdb.base/solib-disc.exp: Same.
* gdb.base/solib-symbol.exp: Same.
* gdb.base/solib-weak.exp: Same.
* gdb.base/subst.exp: Same.
* gdb.base/unload.exp: Same.
* gdb.base/watchpoint-solib.exp: Same.
* gdb.cp/cp-relocate.exp: Same.
* gdb.cp/nsusing.exp: Same.
* gdb.disasm/am33.exp: Same.
* gdb.disasm/h8300s.exp: Same.
* gdb.disasm/hppa.exp: Same.
* gdb.disasm/mn10300.exp: Same.
* gdb.disasm/sh3.exp: Same.
* gdb.dwarf2/dw2-error.exp: Same.
* gdb.dwarf2/dw2-stack-boundary.exp: Same.
* gdb.dwarf2/dwp-symlink.exp: Same.
* gdb.dwarf2/dwzbuildid.exp: Same.
* gdb.dwarf2/fission-base.exp: Same.
* gdb.dwarf2/fission-loclists-pie.exp: Same.
* gdb.dwarf2/fission-loclists.exp: Same.
* gdb.dwarf2/fission-multi-cu.exp: Same.
* gdb.dwarf2/fission-reread.exp: Same.
* gdb.dwarf2/member-ptr-forwardref.exp: Same.
* gdb.fortran/exprs.exp: Same.
* gdb.fortran/subarray.exp: Same.
* gdb.fortran/types.exp: Same.
* gdb.go/basic-types.exp: Same.
* gdb.go/print.exp: Same.
* gdb.guile/guile.exp: Same.
* gdb.guile/scm-parameter.exp: Same.
* gdb.guile/scm-pretty-print.exp: Same.
* gdb.guile/scm-progspace.exp: Same.
* gdb.guile/scm-section-script.exp: Same.
* gdb.guile/scm-symbol.exp: Same.
* gdb.guile/scm-type.exp: Same.
* gdb.objc/basicclass.exp: Same.
* gdb.objc/nondebug.exp: Same.
* gdb.objc/objcdecode.exp: Same.
* gdb.objc/print.exp: Same.
* gdb.pascal/print.exp: Same.
* gdb.pascal/types.exp: Same.
* gdb.perf/disassemble.exp: Same.
* gdb.python/py-format-string.exp: Same.
* gdb.python/py-function.exp: Same.
* gdb.python/py-lookup-type.exp: Same.
* gdb.python/py-parameter.exp: Same.
* gdb.python/py-prettyprint.exp: Same.
* gdb.python/py-progspace.exp: Same.
* gdb.python/py-prompt.exp: Same.
* gdb.python/py-section-script.exp: Same.
* gdb.python/py-sync-interp.exp: Same.
* gdb.python/py-template.exp: Same.
* gdb.python/py-type.exp: Same.
* gdb.python/python.exp: Same.
* gdb.reverse/sigall-precsave.exp: Same.
* gdb.reverse/sigall-reverse.exp: Same.
* gdb.server/solib-list.exp: Same.
* gdb.stabs/weird.exp: Same.
* gdb.threads/attach-stopped.exp: Same.
* gdb.threads/fork-thread-pending.exp: Same.
* gdb.threads/schedlock.exp: Same.
* gdb.threads/watchthreads.exp: Same.
* gdb.trace/actions.exp: Same.
* gdb.trace/change-loc.exp: Same.
* gdb.trace/entry-values.exp: Same.
* gdb.trace/pending.exp: Same.
* gdb.trace/read-memory.exp: Same.
* gdb.trace/unavailable.exp: Same.
* gdb.trace/while-stepping.exp: Same.
* lib/gdb.exp: Same.
---
gdb/testsuite/gdb.ada/assign_1.exp | 4 +--
gdb/testsuite/gdb.ada/boolean_expr.exp | 4 +--
gdb/testsuite/gdb.ada/ptype_arith_binop.exp | 4 +--
gdb/testsuite/gdb.arch/alpha-step.exp | 5 +--
gdb/testsuite/gdb.arch/altivec-abi.exp | 5 +--
gdb/testsuite/gdb.arch/e500-prologue.exp | 5 +--
gdb/testsuite/gdb.arch/e500-regs.exp | 5 +--
gdb/testsuite/gdb.arch/gdb1291.exp | 5 +--
gdb/testsuite/gdb.arch/gdb1431.exp | 5 +--
gdb/testsuite/gdb.arch/gdb1558.exp | 5 +--
gdb/testsuite/gdb.arch/i386-biarch-core.exp | 4 +--
gdb/testsuite/gdb.arch/i386-bp_permanent.exp | 5 +--
gdb/testsuite/gdb.arch/i386-gnu-cfi.exp | 5 +--
gdb/testsuite/gdb.arch/i386-prologue.exp | 5 +--
gdb/testsuite/gdb.arch/i386-signal.exp | 5 +--
gdb/testsuite/gdb.arch/i386-size-overlap.exp | 5 +--
gdb/testsuite/gdb.arch/i386-size.exp | 5 +--
gdb/testsuite/gdb.arch/i386-unwind.exp | 5 +--
gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp | 5 +--
gdb/testsuite/gdb.arch/mips-octeon-bbit.exp | 5 +--
gdb/testsuite/gdb.arch/pa-nullify.exp | 5 +--
gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp | 5 +--
gdb/testsuite/gdb.arch/powerpc-d128-regs.exp | 5 +--
gdb/testsuite/gdb.arch/powerpc-prologue.exp | 5 +--
gdb/testsuite/gdb.arch/ppc-dfp.exp | 5 +--
gdb/testsuite/gdb.arch/ppc-fp.exp | 5 +--
gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp | 4 +--
gdb/testsuite/gdb.arch/pr25124.exp | 4 +--
gdb/testsuite/gdb.arch/thumb-prologue.exp | 5 +--
gdb/testsuite/gdb.arch/thumb2-it.exp | 5 +--
gdb/testsuite/gdb.arch/vsx-regs.exp | 5 +--
gdb/testsuite/gdb.base/alias.exp | 4 +--
gdb/testsuite/gdb.base/annota1.exp | 5 +--
gdb/testsuite/gdb.base/bitops.exp | 4 +--
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 | 5 +--
gdb/testsuite/gdb.base/dfp-exprs.exp | 4 +--
gdb/testsuite/gdb.base/display.exp | 5 +--
gdb/testsuite/gdb.base/dprintf-pending.exp | 8 ++---
gdb/testsuite/gdb.base/dump.exp | 4 +--
gdb/testsuite/gdb.base/fileio.exp | 5 +--
gdb/testsuite/gdb.base/fixsection.exp | 5 +--
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 | 4 +--
gdb/testsuite/gdb.base/pending.exp | 8 ++---
gdb/testsuite/gdb.base/permissions.exp | 4 +--
gdb/testsuite/gdb.base/print-symbol-loading.exp | 4 +--
gdb/testsuite/gdb.base/printcmds.exp | 4 +--
gdb/testsuite/gdb.base/readline.exp | 4 +--
gdb/testsuite/gdb.base/relocate.exp | 12 ++-----
gdb/testsuite/gdb.base/sect-cmd.exp | 5 +--
gdb/testsuite/gdb.base/sep.exp | 5 +--
gdb/testsuite/gdb.base/sepdebug.exp | 8 ++---
gdb/testsuite/gdb.base/shlib-call.exp | 5 +--
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 | 5 +--
gdb/testsuite/gdb.base/watchpoint-solib.exp | 5 +--
gdb/testsuite/gdb.cp/cp-relocate.exp | 8 ++---
gdb/testsuite/gdb.cp/nsusing.exp | 20 +++--------
gdb/testsuite/gdb.disasm/am33.exp | 5 +--
gdb/testsuite/gdb.disasm/h8300s.exp | 4 +--
gdb/testsuite/gdb.disasm/hppa.exp | 5 +--
gdb/testsuite/gdb.disasm/mn10300.exp | 5 +--
gdb/testsuite/gdb.disasm/sh3.exp | 5 +--
gdb/testsuite/gdb.dwarf2/dw2-error.exp | 4 +--
gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp | 4 +--
gdb/testsuite/gdb.dwarf2/dwp-symlink.exp | 4 +--
gdb/testsuite/gdb.dwarf2/dwzbuildid.exp | 4 +--
gdb/testsuite/gdb.dwarf2/fission-base.exp | 4 +--
gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp | 4 +--
gdb/testsuite/gdb.dwarf2/fission-loclists.exp | 4 +--
gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp | 4 +--
gdb/testsuite/gdb.dwarf2/fission-reread.exp | 4 +--
gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp | 4 +--
gdb/testsuite/gdb.fortran/exprs.exp | 4 +--
gdb/testsuite/gdb.fortran/subarray.exp | 5 +--
gdb/testsuite/gdb.fortran/types.exp | 4 +--
gdb/testsuite/gdb.go/basic-types.exp | 4 +--
gdb/testsuite/gdb.go/print.exp | 4 +--
gdb/testsuite/gdb.guile/guile.exp | 4 +--
gdb/testsuite/gdb.guile/scm-parameter.exp | 4 +--
gdb/testsuite/gdb.guile/scm-pretty-print.exp | 10 ++----
gdb/testsuite/gdb.guile/scm-progspace.exp | 4 +--
gdb/testsuite/gdb.guile/scm-section-script.exp | 4 +--
gdb/testsuite/gdb.guile/scm-symbol.exp | 5 +--
gdb/testsuite/gdb.guile/scm-type.exp | 5 +--
gdb/testsuite/gdb.objc/basicclass.exp | 5 +--
gdb/testsuite/gdb.objc/nondebug.exp | 5 +--
gdb/testsuite/gdb.objc/objcdecode.exp | 5 +--
gdb/testsuite/gdb.objc/print.exp | 4 +--
gdb/testsuite/gdb.pascal/print.exp | 4 +--
gdb/testsuite/gdb.pascal/types.exp | 4 +--
gdb/testsuite/gdb.perf/disassemble.exp | 4 +--
gdb/testsuite/gdb.python/py-format-string.exp | 5 +--
gdb/testsuite/gdb.python/py-function.exp | 4 +--
gdb/testsuite/gdb.python/py-lookup-type.exp | 4 +--
gdb/testsuite/gdb.python/py-parameter.exp | 4 +--
gdb/testsuite/gdb.python/py-prettyprint.exp | 10 ++----
gdb/testsuite/gdb.python/py-progspace.exp | 4 +--
gdb/testsuite/gdb.python/py-prompt.exp | 4 +--
gdb/testsuite/gdb.python/py-section-script.exp | 4 +--
gdb/testsuite/gdb.python/py-sync-interp.exp | 4 +--
gdb/testsuite/gdb.python/py-template.exp | 4 +--
gdb/testsuite/gdb.python/py-type.exp | 5 +--
gdb/testsuite/gdb.python/python.exp | 4 +--
gdb/testsuite/gdb.reverse/sigall-precsave.exp | 4 +--
gdb/testsuite/gdb.reverse/sigall-reverse.exp | 4 +--
gdb/testsuite/gdb.server/solib-list.exp | 4 +--
gdb/testsuite/gdb.stabs/weird.exp | 4 +--
gdb/testsuite/gdb.threads/attach-stopped.exp | 5 +--
gdb/testsuite/gdb.threads/fork-thread-pending.exp | 4 +--
gdb/testsuite/gdb.threads/schedlock.exp | 4 +--
gdb/testsuite/gdb.threads/watchthreads.exp | 5 +--
gdb/testsuite/gdb.trace/actions.exp | 8 ++---
gdb/testsuite/gdb.trace/change-loc.exp | 4 +--
gdb/testsuite/gdb.trace/entry-values.exp | 5 +--
gdb/testsuite/gdb.trace/pending.exp | 4 +--
gdb/testsuite/gdb.trace/read-memory.exp | 4 +--
gdb/testsuite/gdb.trace/unavailable.exp | 20 +++--------
gdb/testsuite/gdb.trace/while-stepping.exp | 8 ++---
gdb/testsuite/lib/gdb.exp | 40 +++++-----------------
129 files changed, 153 insertions(+), 533 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/assign_1.exp b/gdb/testsuite/gdb.ada/assign_1.exp
index abbfd6d7925..5f5ecaa7ef9 100644
--- a/gdb/testsuite/gdb.ada/assign_1.exp
+++ b/gdb/testsuite/gdb.ada/assign_1.exp
@@ -17,9 +17,7 @@ load_lib "ada.exp"
if { [skip_ada_tests] } { return -1 }
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Force the language to Ada, as this will not happen automatically
# in this case (no test program).
diff --git a/gdb/testsuite/gdb.ada/boolean_expr.exp b/gdb/testsuite/gdb.ada/boolean_expr.exp
index 9d363cfe8eb..a9ec5e17da4 100644
--- a/gdb/testsuite/gdb.ada/boolean_expr.exp
+++ b/gdb/testsuite/gdb.ada/boolean_expr.exp
@@ -17,9 +17,7 @@ load_lib "ada.exp"
if { [skip_ada_tests] } { return -1 }
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
set any_nb "\[0-9\]+"
set any_addr "0x\[0-9a-zA-Z\]+"
diff --git a/gdb/testsuite/gdb.ada/ptype_arith_binop.exp b/gdb/testsuite/gdb.ada/ptype_arith_binop.exp
index 9812eb9c0d8..e214900fc9f 100644
--- a/gdb/testsuite/gdb.ada/ptype_arith_binop.exp
+++ b/gdb/testsuite/gdb.ada/ptype_arith_binop.exp
@@ -15,9 +15,7 @@
if { [skip_ada_tests] } { return -1 }
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test_no_output "set lang ada" \
"set lang ada"
diff --git a/gdb/testsuite/gdb.arch/alpha-step.exp b/gdb/testsuite/gdb.arch/alpha-step.exp
index 6eeb44a3e99..e9d722ec1c1 100644
--- a/gdb/testsuite/gdb.arch/alpha-step.exp
+++ b/gdb/testsuite/gdb.arch/alpha-step.exp
@@ -28,10 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
proc test_stepi {function } {
# Restart the program from scratch. If GDB got confused during one
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 32530011a39..5cb2692eb8d 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -55,10 +55,7 @@ proc altivec_abi_tests { extra_flags force_abi } {
}
}
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${binfile}
+ clean_restart ${binfile}
# Run to `main' where we begin our tests.
if ![runto_main] then {
diff --git a/gdb/testsuite/gdb.arch/e500-prologue.exp b/gdb/testsuite/gdb.arch/e500-prologue.exp
index a90027f06d1..fc61fa931fb 100644
--- a/gdb/testsuite/gdb.arch/e500-prologue.exp
+++ b/gdb/testsuite/gdb.arch/e500-prologue.exp
@@ -31,10 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Insert a breakpoint in FUNCTION and verifies that the breakpoint was
# inserted at the expected location. EXPECTED_LOCATION should be an
diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp
index fa8e590e027..a6af1dbe324 100644
--- a/gdb/testsuite/gdb.arch/e500-regs.exp
+++ b/gdb/testsuite/gdb.arch/e500-regs.exp
@@ -141,10 +141,7 @@ gdb_expect_list "info vector" ".*$gdb_prompt $" {
# We must restart everything, because we have set important registers to
# some unusual values.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
fail "can't run to main"
return 0
diff --git a/gdb/testsuite/gdb.arch/gdb1291.exp b/gdb/testsuite/gdb.arch/gdb1291.exp
index 26c2125a94c..35086d17c8c 100644
--- a/gdb/testsuite/gdb.arch/gdb1291.exp
+++ b/gdb/testsuite/gdb.arch/gdb1291.exp
@@ -37,10 +37,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] !
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/gdb1431.exp b/gdb/testsuite/gdb.arch/gdb1431.exp
index 119f87d03ce..327bbb5e234 100644
--- a/gdb/testsuite/gdb.arch/gdb1431.exp
+++ b/gdb/testsuite/gdb.arch/gdb1431.exp
@@ -39,10 +39,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] !
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/gdb1558.exp b/gdb/testsuite/gdb.arch/gdb1558.exp
index 9748e2e9b39..dd1ad716df8 100644
--- a/gdb/testsuite/gdb.arch/gdb1558.exp
+++ b/gdb/testsuite/gdb.arch/gdb1558.exp
@@ -36,10 +36,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"add
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_test "b -q main" "Breakpoint 1.*" "set breakpoint at main"
gdb_test "b -q sub1" "Breakpoint 2.*" "set breakpoint at sub1"
diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
index 43b668aa1b6..06b84556e81 100644
--- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp
+++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
@@ -23,9 +23,7 @@
standard_testfile
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
set test "complete set gnutarget"
gdb_test_multiple "complete set gnutarget " $test {
diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
index 21c4449fb76..a79cf9f34d7 100644
--- a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
+++ b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
@@ -36,10 +36,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp b/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
index fa965c3c215..1b75b766425 100644
--- a/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
+++ b/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
@@ -43,10 +43,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfilec} ${srcdir}/${subdir}/${srcfile
# Get things started.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# We should stop in abort(3).
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.exp b/gdb/testsuite/gdb.arch/i386-prologue.exp
index 4edcf566d6b..28c40f3d620 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue.exp
@@ -56,10 +56,7 @@ proc skip_breakpoint { msg } {
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp
index 4a26589c7be..149dd83ee53 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
@@ -28,10 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
runto func
gdb_test "backtrace 10" \
diff --git a/gdb/testsuite/gdb.arch/i386-size-overlap.exp b/gdb/testsuite/gdb.arch/i386-size-overlap.exp
index e025412a8fd..1ee7d61e014 100644
--- a/gdb/testsuite/gdb.arch/i386-size-overlap.exp
+++ b/gdb/testsuite/gdb.arch/i386-size-overlap.exp
@@ -33,10 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# We use gdb_run_cmd so this stands a chance to work for remote
# targets too.
diff --git a/gdb/testsuite/gdb.arch/i386-size.exp b/gdb/testsuite/gdb.arch/i386-size.exp
index b0f844e0028..694c638bcfc 100644
--- a/gdb/testsuite/gdb.arch/i386-size.exp
+++ b/gdb/testsuite/gdb.arch/i386-size.exp
@@ -38,10 +38,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# We use gdb_run_cmd so this stands a chance to work for remote
# targets too.
diff --git a/gdb/testsuite/gdb.arch/i386-unwind.exp b/gdb/testsuite/gdb.arch/i386-unwind.exp
index 1a5111f1d33..c3957058efb 100644
--- a/gdb/testsuite/gdb.arch/i386-unwind.exp
+++ b/gdb/testsuite/gdb.arch/i386-unwind.exp
@@ -36,10 +36,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Testcase for backtrace/1435.
diff --git a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
index 7387a50bc03..1813d2f6d77 100644
--- a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
+++ b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
@@ -26,10 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# We need to start the inferior to place the breakpoints in the memory at all.
if ![runto_main] {
diff --git a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
index d1487972729..d85564e938c 100644
--- a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
+++ b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
@@ -88,10 +88,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
pass "compilation"
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Native needs run.
runto_main
diff --git a/gdb/testsuite/gdb.arch/pa-nullify.exp b/gdb/testsuite/gdb.arch/pa-nullify.exp
index c8d0a650e2b..09009c5e173 100644
--- a/gdb/testsuite/gdb.arch/pa-nullify.exp
+++ b/gdb/testsuite/gdb.arch/pa-nullify.exp
@@ -40,10 +40,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# In the first test, we do a "step" on a function whose last instruction
# contains a branch-with-nullify. The instruction in the delay slot belongs
diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
index d896b9202de..019f299bdc7 100644
--- a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
@@ -31,10 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Insert a breakpoint in FUNCTION and verifies that the breakpoint was
# inserted at the expected location. EXPECTED_LOCATION should be an
diff --git a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
index cccf9e703eb..76c35eac4d7 100644
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
@@ -34,10 +34,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {qui
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if { ![runto_main] } then {
fail "run to main"
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
index 1e1dafe0a56..542c09aa052 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
@@ -34,10 +34,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
index 3f3d0d6f5fb..cad48c6f572 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -41,10 +41,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quie
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_breakpoint [gdb_get_line_number "Set DFP rounding mode."]
diff --git a/gdb/testsuite/gdb.arch/ppc-fp.exp b/gdb/testsuite/gdb.arch/ppc-fp.exp
index bf080416db0..b4e81292614 100644
--- a/gdb/testsuite/gdb.arch/ppc-fp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-fp.exp
@@ -41,10 +41,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quie
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_breakpoint [gdb_get_line_number "Invalid operation."]
gdb_breakpoint [gdb_get_line_number "Division by zero."]
diff --git a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
index a1fa5ffabee..e57acced4e2 100644
--- a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
@@ -34,9 +34,7 @@ if {[catch "system \"bzip2 -dc ${kodebugbz2file} >${kodebugfile}\""] != 0} {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# This test won't work properly if system debuginfo is installed.
# Test message is suppressed by "" as otherwise we could print PASS+UNTESTED
diff --git a/gdb/testsuite/gdb.arch/pr25124.exp b/gdb/testsuite/gdb.arch/pr25124.exp
index e83fd3427dc..33655bc466d 100644
--- a/gdb/testsuite/gdb.arch/pr25124.exp
+++ b/gdb/testsuite/gdb.arch/pr25124.exp
@@ -28,9 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Load the symbol file the first time.
gdb_load ${binfile}
diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.exp b/gdb/testsuite/gdb.arch/thumb-prologue.exp
index 0c6de8a7ce9..788a24066dc 100644
--- a/gdb/testsuite/gdb.arch/thumb-prologue.exp
+++ b/gdb/testsuite/gdb.arch/thumb-prologue.exp
@@ -30,10 +30,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"add
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/thumb2-it.exp b/gdb/testsuite/gdb.arch/thumb2-it.exp
index 01d5ed88648..b77b10f0bb6 100644
--- a/gdb/testsuite/gdb.arch/thumb2-it.exp
+++ b/gdb/testsuite/gdb.arch/thumb2-it.exp
@@ -27,10 +27,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
untested "could not run to main"
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
index 4ce01e3d01a..ccbb61f7461 100644
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -181,10 +181,7 @@ if {!$core_supported} {
return -1
}
-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/alias.exp b/gdb/testsuite/gdb.base/alias.exp
index 03c440dfd7b..d113d0be167 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 f3c99667acd..07d075dce22 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -455,10 +455,7 @@ proc thread_test {} {
if { ![get_compiler_info] && [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] } then {
fail "run to main"
return
diff --git a/gdb/testsuite/gdb.base/bitops.exp b/gdb/testsuite/gdb.base/bitops.exp
index 26b56625d1c..91c01d457c8 100644
--- a/gdb/testsuite/gdb.base/bitops.exp
+++ b/gdb/testsuite/gdb.base/bitops.exp
@@ -28,9 +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/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index 86b098aa1b5..e1f6bd3756d 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -291,10 +291,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 e78b8a3ce1e..1dce4a08b0c 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 ef48d7287a7..247a9445d0b 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 426ca6fcd7b..d42e6215310 100644
--- a/gdb/testsuite/gdb.base/detach.exp
+++ b/gdb/testsuite/gdb.base/detach.exp
@@ -43,10 +43,7 @@ proc do_detach_tests {} {
}
# 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 a4d27b847fe..ea2f48a5a1a 100644
--- a/gdb/testsuite/gdb.base/dfp-exprs.exp
+++ b/gdb/testsuite/gdb.base/dfp-exprs.exp
@@ -173,9 +173,7 @@ proc test_dfp_conversions {} {
# 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 242e13bc291..979183ec2e1 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -43,10 +43,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 a13c8a4ae46..38a3bc83139 100644
--- a/gdb/testsuite/gdb.base/dprintf-pending.exp
+++ b/gdb/testsuite/gdb.base/dprintf-pending.exp
@@ -37,18 +37,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 23071ef0ed2..83663075e77 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -52,9 +52,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${op
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test "dump mem /dev/null 0x10 0x20" "Cannot access memory at address 0x10" \
"inaccessible memory is reported"
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
index 9735869e519..fddc59db14e 100644
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -54,10 +54,7 @@ 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 92a1b81eecb..6cad6dfc7c3 100644
--- a/gdb/testsuite/gdb.base/fixsection.exp
+++ b/gdb/testsuite/gdb.base/fixsection.exp
@@ -40,10 +40,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
# 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] then {
diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp
index 66e16a54fb6..594981d2476 100644
--- a/gdb/testsuite/gdb.base/gcore.exp
+++ b/gdb/testsuite/gdb.base/gcore.exp
@@ -58,10 +58,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 bdfc0e8ca85..a785d0340c4 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 068f58f6490..e534ceb1e94 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 f1fb2b56f07..0049012c254 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -98,10 +98,7 @@ if [runto csub] then {
gdb_continue_to_end "langs.exp"
}
-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 b7d0e98978d..17a112d5016 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -548,9 +548,7 @@ proc test_list_invalid_args {} {
# 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 cb9e4f2158e..6c8f6104981 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -43,9 +43,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
# 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\\\]. $" {
@@ -74,9 +72,7 @@ gdb_test "" \
# Restart with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_load ${binfile}
gdb_load_shlib $lib_sl
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 6cc6f70eb96..b6eb2aeec63 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -30,9 +30,7 @@ if [get_compiler_info] {
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 f29faa758f0..bafba62b247 100644
--- a/gdb/testsuite/gdb.base/print-symbol-loading.exp
+++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp
@@ -51,9 +51,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 08a09613031..3f534ad0108 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -988,9 +988,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 64a40a89ad4..b90e20d794d 100644
--- a/gdb/testsuite/gdb.base/readline.exp
+++ b/gdb/testsuite/gdb.base/readline.exp
@@ -189,9 +189,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" \
"p 7" ".* = 7" \
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 8ed23987b1d..a9a7b755688 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/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp
index 16d39916219..4c93caad823 100644
--- a/gdb/testsuite/gdb.base/sect-cmd.exp
+++ b/gdb/testsuite/gdb.base/sect-cmd.exp
@@ -46,10 +46,7 @@ if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug n
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then { fail "section command tests suppressed" }
diff --git a/gdb/testsuite/gdb.base/sep.exp b/gdb/testsuite/gdb.base/sep.exp
index 484f78f385c..a3ada6418ce 100644
--- a/gdb/testsuite/gdb.base/sep.exp
+++ b/gdb/testsuite/gdb.base/sep.exp
@@ -41,10 +41,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 502c664d95c..78ff14f69bd 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -556,9 +556,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}
@@ -651,9 +649,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/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index 97e04cdbb5e..b1962206db2 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -162,10 +162,7 @@ gdb_test "step" "mainshr1 \\(g=4\\) at.*return 2.g;" \
# 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/solib-disc.exp b/gdb/testsuite/gdb.base/solib-disc.exp
index a7454721b84..62f58fc9021 100644
--- a/gdb/testsuite/gdb.base/solib-disc.exp
+++ b/gdb/testsuite/gdb.base/solib-disc.exp
@@ -49,10 +49,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] then {
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
index 81c05722f99..d87c7d96bbc 100644
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -40,10 +40,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 426b57097f9..3577ef72334 100644
--- a/gdb/testsuite/gdb.base/solib-weak.exp
+++ b/gdb/testsuite/gdb.base/solib-weak.exp
@@ -90,10 +90,7 @@ proc do_test { lib1opts lib2opts lib1first } {
return -1
}
- 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 c56ae880b4a..0f00bf74a48 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 dfd12fcfcea..2e1a320cf4c 100644
--- a/gdb/testsuite/gdb.base/unload.exp
+++ b/gdb/testsuite/gdb.base/unload.exp
@@ -58,10 +58,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
# 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 bffb0713c18..80466f90705 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-solib.exp
@@ -48,10 +48,7 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
# 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
diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp
index 2b2598b5700..05c59f19247 100644
--- a/gdb/testsuite/gdb.cp/cp-relocate.exp
+++ b/gdb/testsuite/gdb.cp/cp-relocate.exp
@@ -46,9 +46,7 @@ proc get_func_address { func } {
# Load the file as an executable; GDB should assign non-overlapping
# section offsets.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_file_cmd ${binfile}
# Find the interesting functions. We go to a little effort to find
@@ -118,9 +116,7 @@ if { $func1_sec == $func2_sec } {
}
# Now start a clean GDB, for add-symbol-file tests.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x10000 -s ${func2_sec} 0x20000" \
"Reading symbols from .*${testfile}\\.o\\.\\.\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)" \
diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp
index 04a9a7e88c9..11b5f66b4f5 100644
--- a/gdb/testsuite/gdb.cp/nsusing.exp
+++ b/gdb/testsuite/gdb.cp/nsusing.exp
@@ -47,10 +47,7 @@ gdb_continue_to_breakpoint "marker3"
gdb_test "print _a" "No symbol \"_a\" in current context." \
"Print _a without import"
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
############################################
@@ -68,10 +65,7 @@ gdb_continue_to_breakpoint "marker1 stop"
gdb_test "print _a" "= 1" "print _a in a nested scope"
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
############################################
# test printing of namespace imported into
@@ -85,10 +79,7 @@ if ![runto marker5] then {
gdb_test "print cc" "= 3"
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
############################################
@@ -107,10 +98,7 @@ gdb_test "print _a" "No symbol \"_a\" in current context." \
gdb_test "print x" "No symbol \"x\" in current context." \
"print x in namespace alias scope"
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
############################################
diff --git a/gdb/testsuite/gdb.disasm/am33.exp b/gdb/testsuite/gdb.disasm/am33.exp
index 33810154a20..1c1dd0ce674 100644
--- a/gdb/testsuite/gdb.disasm/am33.exp
+++ b/gdb/testsuite/gdb.disasm/am33.exp
@@ -800,10 +800,7 @@ proc dsp_autoincrement_tests { } {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+clean_restart $binfile
call_tests
movm_tests
diff --git a/gdb/testsuite/gdb.disasm/h8300s.exp b/gdb/testsuite/gdb.disasm/h8300s.exp
index ff82caf76f8..fca95f52264 100644
--- a/gdb/testsuite/gdb.disasm/h8300s.exp
+++ b/gdb/testsuite/gdb.disasm/h8300s.exp
@@ -643,9 +643,7 @@ proc all_block_data_transfer_tests { } {
}
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
all_set_machine_h8300s
gdb_load $binfile
diff --git a/gdb/testsuite/gdb.disasm/hppa.exp b/gdb/testsuite/gdb.disasm/hppa.exp
index bbe2e7b1cd0..88cd87fd7e4 100644
--- a/gdb/testsuite/gdb.disasm/hppa.exp
+++ b/gdb/testsuite/gdb.disasm/hppa.exp
@@ -1372,10 +1372,7 @@ proc fmemLRbug_tests { } {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+clean_restart $binfile
all_integer_memory_tests
all_immediate_tests
diff --git a/gdb/testsuite/gdb.disasm/mn10300.exp b/gdb/testsuite/gdb.disasm/mn10300.exp
index 828aeec4923..e03674fe293 100644
--- a/gdb/testsuite/gdb.disasm/mn10300.exp
+++ b/gdb/testsuite/gdb.disasm/mn10300.exp
@@ -534,10 +534,7 @@ proc sub_tests { } {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+clean_restart $binfile
add_tests
bcc_tests
diff --git a/gdb/testsuite/gdb.disasm/sh3.exp b/gdb/testsuite/gdb.disasm/sh3.exp
index f2199263256..485f4c6905c 100644
--- a/gdb/testsuite/gdb.disasm/sh3.exp
+++ b/gdb/testsuite/gdb.disasm/sh3.exp
@@ -103,10 +103,7 @@ proc all_fp_misc_tests { } {
}
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+clean_restart $binfile
all_fp_move_and_load_tests
all_fp_arithmetic_tests
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
index 345cc117093..0b4c8e83050 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
@@ -33,9 +33,7 @@ if {[build_executable $testfile.exp $testfile $srcfile {nodebug quiet}]} {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test_no_output "set breakpoint pending off"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
index d946679e548..d1061855061 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
@@ -25,9 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != ""
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# From gdb_file_cmd:
if [is_remote host] {
diff --git a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
index 7b52dad3828..cd4fcaa5b87 100644
--- a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
@@ -75,9 +75,7 @@ gdb_test "ptype main" {type = int \(int, char \*\*\)} "binary symlink, dwp at sy
# a relative path for the program.
# This is clean_restart, but specifying a relative path to the binary.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test "cd [file dirname [standard_output_file ${thelink}]]" \
"Working directory .*"
gdb_load "./${thelink}"
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
index 10ad10ae40e..292e541b9d2 100644
--- a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
@@ -150,9 +150,7 @@ if {[gdb_compile [list ${binfile}1.o ${binfile}6.o] ${binfile}-fallback \
foreach testname {ok mismatch fallback} {
with_test_prefix $testname {
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_test_no_output "set debug-file-directory $debugdir" \
"set debug-file-directory"
diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.exp b/gdb/testsuite/gdb.dwarf2/fission-base.exp
index 41e30a73fbf..cb290de781e 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-base.exp
@@ -37,9 +37,7 @@ if [build_executable_from_fission_assembler \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Make sure we can find the .dwo file, regardless of whether we're
# running in parallel mode.
gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
index 519d4aa5dc5..fd882622eea 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
@@ -43,9 +43,7 @@ if [build_executable_from_fission_assembler \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Make sure we can find the .dwo file, regardless of whether we're
# running in parallel mode.
gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
index d80ec2ba63e..feb425ccc33 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
@@ -37,9 +37,7 @@ if [build_executable_from_fission_assembler \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Make sure we can find the .dwo file, regardless of whether we're
# running in parallel mode.
gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \
diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
index f2be5b91d63..4e90eeacef4 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
@@ -37,9 +37,7 @@ if [build_executable_from_fission_assembler \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Make sure we can find the .dwo file, regardless of whether we're
# running in parallel mode.
gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
index 1994ad7a599..d90c949a8fd 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
@@ -36,9 +36,7 @@ if [build_executable_from_fission_assembler \
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Make sure we can find the .dwo file, regardless of whether we're
# running in parallel mode.
gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \
diff --git a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
index f32cbb7b9ca..6353dc6f62f 100644
--- a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
+++ b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
@@ -28,9 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} object {debug}] !=
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Be sure to set cp-abi before ${binfile} gets loaded
gdb_test "set cp-abi gnu-v3"
diff --git a/gdb/testsuite/gdb.fortran/exprs.exp b/gdb/testsuite/gdb.fortran/exprs.exp
index 3cef73b2757..a65dacdf230 100644
--- a/gdb/testsuite/gdb.fortran/exprs.exp
+++ b/gdb/testsuite/gdb.fortran/exprs.exp
@@ -243,9 +243,7 @@ proc test_arithmetic_expressions {} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test "set print sevenbit-strings" ""
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
index 9ee5a9b3cb1..e601285dfae 100644
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -27,10 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![fortran_runto_main] then {
perror "couldn't run to main"
diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp
index 8c1ca5cece8..88cfc3234cb 100644
--- a/gdb/testsuite/gdb.fortran/types.exp
+++ b/gdb/testsuite/gdb.fortran/types.exp
@@ -73,9 +73,7 @@ proc test_float_literal_types_accepted {} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test "set print sevenbit-strings" ""
diff --git a/gdb/testsuite/gdb.go/basic-types.exp b/gdb/testsuite/gdb.go/basic-types.exp
index dd0d92fd04d..6538a50044b 100644
--- a/gdb/testsuite/gdb.go/basic-types.exp
+++ b/gdb/testsuite/gdb.go/basic-types.exp
@@ -102,9 +102,7 @@ proc test_complex_literal_types_accepted {} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
if [set_lang_go] {
test_integer_literal_types_accepted
diff --git a/gdb/testsuite/gdb.go/print.exp b/gdb/testsuite/gdb.go/print.exp
index 33af0312ef4..469b6845462 100644
--- a/gdb/testsuite/gdb.go/print.exp
+++ b/gdb/testsuite/gdb.go/print.exp
@@ -58,9 +58,7 @@ proc test_float_rejected {} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
if [set_lang_go] {
test_float_accepted
diff --git a/gdb/testsuite/gdb.guile/guile.exp b/gdb/testsuite/gdb.guile/guile.exp
index 1f80c8a2384..478c19d4b44 100644
--- a/gdb/testsuite/gdb.guile/guile.exp
+++ b/gdb/testsuite/gdb.guile/guile.exp
@@ -19,9 +19,7 @@
load_lib gdb-guile.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Do this instead of the skip_guile_check.
# We want to do some tests when Guile is not present.
diff --git a/gdb/testsuite/gdb.guile/scm-parameter.exp b/gdb/testsuite/gdb.guile/scm-parameter.exp
index d1e67af1cc1..fb35da1b083 100644
--- a/gdb/testsuite/gdb.guile/scm-parameter.exp
+++ b/gdb/testsuite/gdb.guile/scm-parameter.exp
@@ -19,9 +19,7 @@
load_lib gdb-guile.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Guile scripting is not enabled.
if { [skip_guile_tests] } { continue }
diff --git a/gdb/testsuite/gdb.guile/scm-pretty-print.exp b/gdb/testsuite/gdb.guile/scm-pretty-print.exp
index a63e32c16c7..9d7b0e79516 100644
--- a/gdb/testsuite/gdb.guile/scm-pretty-print.exp
+++ b/gdb/testsuite/gdb.guile/scm-pretty-print.exp
@@ -37,10 +37,7 @@ proc run_lang_tests {exefile lang} {
set nl "\[\r\n\]+"
# Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart ${exefile}
if ![gdb_guile_runto_main] {
return
@@ -113,10 +110,7 @@ run_lang_tests "${binfile}-cxx" "c++"
# Run various other tests.
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![gdb_guile_runto_main] {
return
diff --git a/gdb/testsuite/gdb.guile/scm-progspace.exp b/gdb/testsuite/gdb.guile/scm-progspace.exp
index 91a78e2ab8f..193ecaa1d20 100644
--- a/gdb/testsuite/gdb.guile/scm-progspace.exp
+++ b/gdb/testsuite/gdb.guile/scm-progspace.exp
@@ -26,9 +26,7 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Guile scripting is not enabled.
if { [skip_guile_tests] } { continue }
diff --git a/gdb/testsuite/gdb.guile/scm-section-script.exp b/gdb/testsuite/gdb.guile/scm-section-script.exp
index 2198692eae8..ca6861cd792 100644
--- a/gdb/testsuite/gdb.guile/scm-section-script.exp
+++ b/gdb/testsuite/gdb.guile/scm-section-script.exp
@@ -73,9 +73,7 @@ gdb_test_multiple "info auto-load guile-scripts" "$test_name" {
# Try again with a working safe-path.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test_no_output "set auto-load safe-path ${remote_guile_file}:${binfile}" \
"set auto-load safe-path"
diff --git a/gdb/testsuite/gdb.guile/scm-symbol.exp b/gdb/testsuite/gdb.guile/scm-symbol.exp
index 486fc8fcfdb..afb44b32179 100644
--- a/gdb/testsuite/gdb.guile/scm-symbol.exp
+++ b/gdb/testsuite/gdb.guile/scm-symbol.exp
@@ -143,10 +143,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" executable "
}
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}-cxx
+clean_restart ${binfile}-cxx
if ![gdb_guile_runto_main] {
return
diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp
index 0f666a3046d..b4c354289a1 100644
--- a/gdb/testsuite/gdb.guile/scm-type.exp
+++ b/gdb/testsuite/gdb.guile/scm-type.exp
@@ -42,10 +42,7 @@ proc build_inferior {exefile lang} {
proc restart_gdb {exefile} {
global srcdir subdir
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart ${exefile}
if { [skip_guile_tests] } {
return 0
diff --git a/gdb/testsuite/gdb.objc/basicclass.exp b/gdb/testsuite/gdb.objc/basicclass.exp
index d17b21dc98d..c01bc53b8ee 100644
--- a/gdb/testsuite/gdb.objc/basicclass.exp
+++ b/gdb/testsuite/gdb.objc/basicclass.exp
@@ -78,10 +78,7 @@ proc do_objc_tests {} {
# Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $binfile
+ clean_restart $binfile
deduce_language_of_main
}
diff --git a/gdb/testsuite/gdb.objc/nondebug.exp b/gdb/testsuite/gdb.objc/nondebug.exp
index 300075a9cc6..7f81c891abd 100644
--- a/gdb/testsuite/gdb.objc/nondebug.exp
+++ b/gdb/testsuite/gdb.objc/nondebug.exp
@@ -36,10 +36,7 @@ proc do_objc_tests {} {
# Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $binfile
+ clean_restart $binfile
}
diff --git a/gdb/testsuite/gdb.objc/objcdecode.exp b/gdb/testsuite/gdb.objc/objcdecode.exp
index 8b80c4f2610..03b7b30f7cd 100644
--- a/gdb/testsuite/gdb.objc/objcdecode.exp
+++ b/gdb/testsuite/gdb.objc/objcdecode.exp
@@ -36,10 +36,7 @@ proc do_objc_tests {} {
# Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $binfile
+ clean_restart $binfile
}
diff --git a/gdb/testsuite/gdb.objc/print.exp b/gdb/testsuite/gdb.objc/print.exp
index 99b26c7ef6a..c26258a101e 100644
--- a/gdb/testsuite/gdb.objc/print.exp
+++ b/gdb/testsuite/gdb.objc/print.exp
@@ -59,9 +59,7 @@ proc test_float_rejected {} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
if [set_lang_objc] {
test_float_accepted
diff --git a/gdb/testsuite/gdb.pascal/print.exp b/gdb/testsuite/gdb.pascal/print.exp
index d9c15be730c..7f36968eac2 100644
--- a/gdb/testsuite/gdb.pascal/print.exp
+++ b/gdb/testsuite/gdb.pascal/print.exp
@@ -59,9 +59,7 @@ proc test_float_rejected {} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
if [set_lang_pascal] {
test_float_accepted
diff --git a/gdb/testsuite/gdb.pascal/types.exp b/gdb/testsuite/gdb.pascal/types.exp
index 3c5a98cd0f4..e5909510ffd 100644
--- a/gdb/testsuite/gdb.pascal/types.exp
+++ b/gdb/testsuite/gdb.pascal/types.exp
@@ -70,9 +70,7 @@ proc test_float_literal_types_accepted {} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
if [set_lang_pascal] then {
test_integer_literal_types_accepted
diff --git a/gdb/testsuite/gdb.perf/disassemble.exp b/gdb/testsuite/gdb.perf/disassemble.exp
index 948602d3869..05930100951 100644
--- a/gdb/testsuite/gdb.perf/disassemble.exp
+++ b/gdb/testsuite/gdb.perf/disassemble.exp
@@ -34,9 +34,7 @@ PerfTest::assemble {
global srcdir subdir
global binfile
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
# When GDB is debugging GDB, the prompt is changed to "(top-gdb) ".
# In order to avoid the confusion of pattern matching, set the
diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index b7acc242ed3..cf92609cb53 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -45,10 +45,7 @@ proc build_inferior {exefile lang} {
proc prepare_gdb {exefile} {
global srcdir subdir srcfile testfile hex
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart ${exefile}
if ![runto_main] then {
perror "couldn't run to breakpoint"
diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp
index d98f2ac210c..dd98b621c98 100644
--- a/gdb/testsuite/gdb.python/py-function.exp
+++ b/gdb/testsuite/gdb.python/py-function.exp
@@ -20,9 +20,7 @@ load_lib gdb-python.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.python/py-lookup-type.exp b/gdb/testsuite/gdb.python/py-lookup-type.exp
index 361f8097ecd..53040be73e1 100644
--- a/gdb/testsuite/gdb.python/py-lookup-type.exp
+++ b/gdb/testsuite/gdb.python/py-lookup-type.exp
@@ -23,9 +23,7 @@ load_lib gdb-python.exp
# created by each language since GDB. So, we must start GDB without
# loading any symbol in.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp
index 98434d4f455..859cceed8d5 100644
--- a/gdb/testsuite/gdb.python/py-parameter.exp
+++ b/gdb/testsuite/gdb.python/py-parameter.exp
@@ -19,9 +19,7 @@
load_lib gdb-python.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 65e8489bf87..f1c79f639f5 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -37,10 +37,7 @@ proc run_lang_tests {exefile lang} {
set nl "\[\r\n\]+"
# Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart ${exefile}
if ![runto_main ] then {
perror "couldn't run to breakpoint"
@@ -164,10 +161,7 @@ with_test_prefix c++ {
# Run various other tests.
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main ] then {
perror "couldn't run to breakpoint"
diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp
index 54d010f0397..178c692fe08 100644
--- a/gdb/testsuite/gdb.python/py-progspace.exp
+++ b/gdb/testsuite/gdb.python/py-progspace.exp
@@ -26,9 +26,7 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.python/py-prompt.exp b/gdb/testsuite/gdb.python/py-prompt.exp
index 34332770aa6..3d4eb6a0efa 100644
--- a/gdb/testsuite/gdb.python/py-prompt.exp
+++ b/gdb/testsuite/gdb.python/py-prompt.exp
@@ -23,9 +23,7 @@ load_lib prompt.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index f4106117a4e..eb1e78d9380 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -73,9 +73,7 @@ gdb_test_multiple "info auto-load python-scripts" "$test_name" {
# Try again with a working safe-path.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Get the name of the binfile on the host; on a remote host this means
# stripping off any directory prefix.
diff --git a/gdb/testsuite/gdb.python/py-sync-interp.exp b/gdb/testsuite/gdb.python/py-sync-interp.exp
index aa73e1fc03b..432b35cae11 100644
--- a/gdb/testsuite/gdb.python/py-sync-interp.exp
+++ b/gdb/testsuite/gdb.python/py-sync-interp.exp
@@ -28,9 +28,7 @@ load_lib gdb-python.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp
index b5dc044ed4d..4bf35eca9d1 100644
--- a/gdb/testsuite/gdb.python/py-template.exp
+++ b/gdb/testsuite/gdb.python/py-template.exp
@@ -27,9 +27,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index c01442c3887..1ac1ab84c2a 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -40,10 +40,7 @@ proc build_inferior {exefile lang} {
proc restart_gdb {exefile} {
global srcdir subdir srcfile testfile hex
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart ${exefile}
if ![runto_main ] then {
perror "couldn't run to breakpoint"
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 017f33afe52..fdc0311e5a8 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -26,9 +26,7 @@ if {[build_executable $testfile.exp $testfile \
}
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
set remote_source2_py [gdb_remote_download host \
${srcdir}/${subdir}/source2.py]
diff --git a/gdb/testsuite/gdb.reverse/sigall-precsave.exp b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
index 5169a5f15dd..2e3d142bf33 100644
--- a/gdb/testsuite/gdb.reverse/sigall-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
@@ -23,9 +23,7 @@ if ![supports_reverse] {
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
standard_testfile sigall-reverse.c
set precsave [standard_output_file sigall.precsave]
diff --git a/gdb/testsuite/gdb.reverse/sigall-reverse.exp b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
index 659cbc20a02..c7d2934f94c 100644
--- a/gdb/testsuite/gdb.reverse/sigall-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
@@ -23,9 +23,7 @@ if ![supports_reverse] {
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
standard_testfile
diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp
index a326f940ad8..6ceb8c7fcbf 100644
--- a/gdb/testsuite/gdb.server/solib-list.exp
+++ b/gdb/testsuite/gdb.server/solib-list.exp
@@ -45,9 +45,7 @@ foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" {
# clean_restart assumes ${objdir}/${subdir}/ which is not applicable
# for ${interp_system}.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+ clean_restart
gdb_load_shlib ${binlibfile}
set remote_binfile [gdb_remote_download target $binfile]
diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp
index 111b38446af..bde04c3136a 100644
--- a/gdb/testsuite/gdb.stabs/weird.exp
+++ b/gdb/testsuite/gdb.stabs/weird.exp
@@ -278,9 +278,7 @@ if { [gdb_compile "${srcfile}" "${binfile}" object ""] != "" } {
remote_file build delete ${srcfile}
# Start with a fresh gdb
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
set binfile [gdb_remote_download host ${binfile} \
[standard_output_file object.o]]
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 324360973c3..2b62a287018 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -51,10 +51,7 @@ proc corefunc { threadtype } {
remote_exec build "kill -s STOP ${testpid}"
# Start with clean gdb
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${binfile}
+ clean_restart ${binfile}
# Verify that we can attach to the stopped process.
diff --git a/gdb/testsuite/gdb.threads/fork-thread-pending.exp b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
index ab8cc7f83fa..00cfaad39a5 100644
--- a/gdb/testsuite/gdb.threads/fork-thread-pending.exp
+++ b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
@@ -80,9 +80,7 @@ gdb_test_multiple "info threads" "$test" {
# Start over, but this time, don't switch away from the fork event thread.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_load ${binfile}
if ![runto_main] then {
diff --git a/gdb/testsuite/gdb.threads/schedlock.exp b/gdb/testsuite/gdb.threads/schedlock.exp
index 5daa857d564..5cf0caa3135 100644
--- a/gdb/testsuite/gdb.threads/schedlock.exp
+++ b/gdb/testsuite/gdb.threads/schedlock.exp
@@ -148,9 +148,7 @@ proc step_ten_loops { cmd } {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# We'll need this when we send_gdb a ^C to GDB. Need to do it before we
# run the program and gdb starts saving and restoring tty states.
diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp
index 21a8adc51b2..54445d28969 100644
--- a/gdb/testsuite/gdb.threads/watchthreads.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads.exp
@@ -33,10 +33,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp
index 912ca5b5871..90bed624ed4 100644
--- a/gdb/testsuite/gdb.trace/actions.exp
+++ b/gdb/testsuite/gdb.trace/actions.exp
@@ -329,9 +329,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"
@@ -349,9 +347,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/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 8cb8cc66af8..e44ed63d611 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -186,9 +186,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/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index d03626a0e8a..b032d5338b0 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -35,10 +35,7 @@ if {[gdb_compile [list ${binfile}1.o] \
# 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 ""
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index c817bafff30..7cbee47855b 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -72,9 +72,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 8485a139741..9f1d9c561df 100644
--- a/gdb/testsuite/gdb.trace/read-memory.exp
+++ b/gdb/testsuite/gdb.trace/read-memory.exp
@@ -129,9 +129,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/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 1ed24b2ed07..206a3c23539 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-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp
index 89990d82cf5..7df2cc4a802 100644
--- a/gdb/testsuite/gdb.trace/while-stepping.exp
+++ b/gdb/testsuite/gdb.trace/while-stepping.exp
@@ -155,9 +155,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"
@@ -175,9 +173,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/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 55154db6a50..10fbf37068c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2957,10 +2957,7 @@ gdb_caching_proc skip_altivec_tests {
# Compilation succeeded so now run it via gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load "$obj"
+ clean_restart "$obj"
gdb_run_cmd
gdb_expect {
-re ".*Illegal instruction.*${gdb_prompt} $" {
@@ -3030,10 +3027,7 @@ gdb_caching_proc skip_vsx_tests {
# No error message, compilation succeeded so now run it via gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load "$obj"
+ clean_restart "$obj"
gdb_run_cmd
gdb_expect {
-re ".*Illegal instruction.*${gdb_prompt} $" {
@@ -3079,10 +3073,7 @@ gdb_caching_proc skip_tsx_tests {
# No error message, compilation succeeded so now run it via gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load "$obj"
+ clean_restart "$obj"
gdb_run_cmd
gdb_expect {
-re ".*Illegal instruction.*${gdb_prompt} $" {
@@ -3130,10 +3121,7 @@ gdb_caching_proc skip_avx512bf16_tests {
# No error message, compilation succeeded so now run it via gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load "$obj"
+ clean_restart "$obj"
gdb_run_cmd
gdb_expect {
-re ".*Illegal instruction.*${gdb_prompt} $" {
@@ -3176,10 +3164,7 @@ gdb_caching_proc skip_btrace_tests {
# No error message, compilation succeeded so now run it via gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $obj
+ clean_restart $obj
if ![runto_main] {
return 1
}
@@ -3227,10 +3212,7 @@ gdb_caching_proc skip_btrace_pt_tests {
# No error message, compilation succeeded so now run it via gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $obj
+ clean_restart $obj
if ![runto_main] {
return 1
}
@@ -5900,10 +5882,7 @@ gdb_caching_proc gdb_skip_float_test {
for {set i 0} {$i < 5} {incr i} {
global gdb_prompt srcdir subdir
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load "$exe"
+ clean_restart "$exe"
runto_main
gdb_test "break *break_here"
@@ -5994,10 +5973,7 @@ gdb_caching_proc gdb_has_argv0 {
global srcdir subdir
global gdb_prompt hex
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load "$exe"
+ clean_restart "$exe"
# Set breakpoint on main.
gdb_test_multiple "break -q main" "break -q main" {
^ permalink raw reply [flat|nested] 4+ messages in thread