[25/27] Use clean_restart in gdb.cp

Message ID 20230125224614.1006886-26-tom@tromey.com
State Committed
Headers
Series Many small testsuite cleanups |

Commit Message

Tom Tromey Jan. 25, 2023, 10:46 p.m. UTC
  Change gdb.cp to use clean_restart more consistently.
---
 gdb/testsuite/gdb.cp/cp-relocate.exp | 9 ++-------
 gdb/testsuite/gdb.cp/ref-params.exp  | 2 --
 2 files changed, 2 insertions(+), 9 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp
index 5e70f9d30d3..6c953c0543d 100644
--- a/gdb/testsuite/gdb.cp/cp-relocate.exp
+++ b/gdb/testsuite/gdb.cp/cp-relocate.exp
@@ -46,10 +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
-gdb_file_cmd ${binfile}
+clean_restart $binfile
 
 # Find the interesting functions.  We go to a little effort to find
 # the right function names here, to work around PR c++/40.
@@ -118,9 +115,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/ref-params.exp b/gdb/testsuite/gdb.cp/ref-params.exp
index 52bbb4d097a..c06fc202893 100644
--- a/gdb/testsuite/gdb.cp/ref-params.exp
+++ b/gdb/testsuite/gdb.cp/ref-params.exp
@@ -28,8 +28,6 @@  if {[build_executable $testfile.exp $testfile $srcfile {debug c++}] == -1} {
     return -1
 }
 
-gdb_exit
-
 proc gdb_start_again { text } {
     global binfile
     global srcfile