@@ -57,15 +57,10 @@ gdb_test_multiple "catch exception" $msg {
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
# And finally, the meat of the testcase... Insert an Ada exception
# catchpoint that uses both conditions and exception name.
@@ -26,15 +26,10 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
# This test won't work properly if system debuginfo is installed.
mi_gdb_test "-gdb-set debug-file-directory \"\"" ".*"
@@ -26,15 +26,10 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
####################################
# 1. Try catching all exceptions. #
####################################
@@ -168,20 +168,13 @@ proc do_mi_test {} {
set MIFLAGS "-i=mi"
global mi_gdb_prompt
- global srcdir
- global subdir
global binfile
with_test_prefix "mi" {
- gdb_exit
- if {[mi_gdb_start]} {
- return -1
+ if {[mi_clean_restart $binfile]} {
+ return
}
- mi_delete_breakpoints
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load $binfile
-
# This causes GDB to dereference a pointer-to-structure when doing
# -var-create.
mi_gdb_test "-gdb-set print object on" ".*" "set print object on"
@@ -32,14 +32,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $objsfile object {}] != ""
return -1
}
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
if [mi_runto func_nofb_marker] {
# First try referencing DW_AT_frame_base which is not defined.
mi_gdb_test "300-stack-list-locals --thread 1 --frame 1 --all-values" \
@@ -48,13 +44,9 @@ if [mi_runto func_nofb_marker] {
}
# GDB could have crashed.
-mi_gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
# And now try referencing DW_AT_frame_base defined using a self-reference
# (DW_OP_fbreg).
@@ -20,8 +20,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
@@ -21,8 +21,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
@@ -35,12 +35,10 @@ proc test_async_run {} {
set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""]
- gdb_exit
- if [mi_gdb_start] {
+ if {[mi_clean_restart $binfile]} {
return
}
- mi_gdb_load ${binfile}
mi_run_cmd
mi_gdb_test "123-exec-interrupt --all" "123\\^done" "send interrupt command"
mi_expect_interrupt "expect interrupt"
@@ -35,11 +35,6 @@ set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""]
load_lib mi-support.exp
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile basics.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -47,9 +42,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
# mi_gdb_test cannot be used for asynchronous commands because there are
# two prompts involved and this can lead to a race condition.
@@ -93,14 +93,8 @@ proc test_break_qualified {} {
"delete temp breakpoints"
}
-mi_gdb_exit
-
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
test_break_qualified
@@ -165,12 +165,9 @@ proc test_pending_resolved { } {
global lib_sl1 lib_sl2
global mi_gdb_prompt
- gdb_exit
- if [mi_gdb_start] {
+ if {[mi_clean_restart $binfile]} {
return
}
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
mi_load_shlibs $lib_sl1 $lib_sl2
# Create a pending breakpoint on pendfunc1
@@ -46,14 +46,10 @@ proc restart_for_test {} {
global srcdir subdir binfile srcfile
global main_lineno
- if {[mi_gdb_start]} {
+ if {[mi_clean_restart $binfile]} {
return
}
- mi_delete_breakpoints
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
-
mi_runto_main
mi_create_breakpoint \
@@ -25,8 +25,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
@@ -40,11 +40,6 @@ proc test { variant } {
global mi_gdb_prompt async
with_test_prefix "$variant" {
- gdb_exit
- if [mi_gdb_start] {
- return
- }
-
set options {debug}
if {$variant == "mt" } {
lappend options "pthreads"
@@ -64,10 +59,9 @@ proc test { variant } {
return -1
}
- mi_delete_breakpoints
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
+ if {[mi_clean_restart $binfile]} {
+ return
+ }
mi_runto test
@@ -46,11 +46,6 @@ proc semihosted_string { string } {
return [join $semihosted_list ""]
}
-gdb_exit
-if [mi_gdb_start separate-inferior-tty] {
- return
-}
-
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -58,8 +53,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
+
mi_runto_main
# The output we get from the target depends on how it is hosted. If
@@ -39,11 +39,10 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""}
return -1
}
-# Start with a fresh gdb.
-gdb_exit
-mi_gdb_start
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
+
mi_load_shlibs $lib_sl1
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
@@ -23,8 +23,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if {[mi_gdb_start]} {
+if {[mi_clean_restart]} {
return
}
@@ -25,11 +25,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile basics.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -37,10 +32,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
set line_callee4_head [gdb_get_line_number "callee4 ("]
set line_callee4_body [expr $line_callee4_head + 2]
@@ -29,13 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_file_cmd ${binfile}
proc mi_gdbserver_run { } {
mi_gdb_test "kill" ".*" ""
@@ -18,11 +18,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile basics.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -30,9 +25,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_file_cmd ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
proc test_file_list_exec_source_file {} {
global srcfile
@@ -16,11 +16,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile
set srcfileabs [standard_output_file $srcfile]
@@ -63,8 +58,9 @@ if { [gdb_compile "$srcfileabs" "${binfile}" executable {debug}] != "" } {
file delete -- $srcfileabs
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_gdb_test "-interpreter-exec console \"set substitute-path ${initdir} ${initdir}subst\"" {\^done} "set substitute-path"
@@ -19,8 +19,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
@@ -16,8 +16,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
@@ -25,20 +25,17 @@ if {![istarget *-*-linux*]} {
# Support for XML-output is needed to run this test.
require allow_xml_test
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile basics.c
if [build_executable "Failed to build $testfile" $testfile $srcfile \
debug] {
return -1;
}
-if {[mi_gdb_load $binfile] < 0} {
- return -1
+
+if {[mi_clean_restart $binfile]} {
+ return
}
+
# When testing a cross configuration, we need to be sure to first
# connect to the target. If we didn't do that, GDB would try running
# the command against the default run target. The usual way to do
@@ -18,11 +18,6 @@ require allow_cplus_tests
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile .cc
if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
@@ -30,10 +25,13 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""
return -1
}
+if {[mi_clean_restart $binfile]} {
+ return
+}
+
# Test that children of derived classes are given the proper
# path by -var-info-path-expression
-mi_gdb_load ${binfile}
mi_runto C::testLocation
mi_create_varobj "var1" "this" "create var for THIS"
@@ -16,8 +16,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
@@ -22,11 +22,9 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
load_lib mi-support.exp
-if [mi_gdb_start] {
+if {[mi_clean_restart $binfile]} {
return
}
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
mi_gdb_test "-break-insert -t ${srcfile}:[gdb_get_line_number "C = A + B"]" \
"\\^done,bkpt=\{number=\"1\".*" \
@@ -45,10 +45,9 @@ if { [gdb_compile_pthreads $srcdir/$subdir/$srcfile $binfile executable $exec_op
}
# Start with a fresh gdb.
-gdb_exit
-mi_gdb_start
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_load_shlibs $lib_sl1
mi_load_shlibs $lib_sl2
@@ -22,11 +22,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if {[mi_gdb_start]} {
- return
-}
-
# This procedure tests the various thread commands in MI.
proc check_mi_thread_command_set {} {
@@ -68,8 +63,9 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
return -1
}
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load $binfile
+if {[mi_clean_restart $binfile]} {
+ return
+}
check_mi_thread_command_set
@@ -24,11 +24,6 @@ if {![istarget "x86_64-*-*"] || ![is_lp64_target]} {
return 0
}
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile .S
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nopie}] != "" } {
@@ -36,10 +31,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
if ![mi_runto stop_frame] {
perror "Failed to stop in stop_frame"
@@ -24,11 +24,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile basics.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -36,11 +31,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
+if {[mi_clean_restart $binfile]} {
+ return
+}
proc test_return_simple {} {
global mi_gdb_prompt
@@ -27,11 +27,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile basics.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -39,10 +34,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
proc test_breakpoints_creation_and_listing {} {
global srcfile
@@ -18,11 +18,6 @@ set MIFLAGS "-i=mi2"
require allow_shlib_tests
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile solib-main.c solib-lib.c
set libname "solib-lib"
@@ -39,9 +34,9 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_load_shlibs $binfile_lib
@@ -25,11 +25,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -37,10 +32,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
proc test_stack_frame_listing {} {
global mi_gdb_prompt
@@ -21,11 +21,6 @@ set MIFLAGS "-i=mi"
# then there is no point in running this testcase...
require !use_gdb_stub
-gdb_exit
-if [mi_gdb_start] {
- continue
-}
-
standard_testfile mi-start.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -33,10 +28,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
# First, verify that the debugger correctly advertises support
# for the --start option of the -exec-run command.
@@ -36,14 +36,10 @@ proc test_continue_interrupt { } {
global binfile
global async
- gdb_exit
- if {[mi_gdb_start]} {
+ if {[mi_clean_restart $binfile]} {
return
}
- # Load the binary in gdb...
- mi_gdb_load $binfile
-
# ... and run it.
#
# Note this test relies on mi_runto deleting the breakpoint.
@@ -16,12 +16,10 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
-
# First, verify that the debugger correctly advertises support
# for the "undefined-command" error code...
mi_gdb_test "-list-features" \
@@ -24,11 +24,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile until.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -36,10 +31,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
proc test_running_to_foo {} {
set line [gdb_get_line_number "in-loop"]
@@ -22,11 +22,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile var-cmd.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -34,9 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_runto do_block_tests
@@ -21,11 +21,6 @@ load_lib "fortran.exp"
require allow_fortran_tests
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile array.f90
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
@@ -33,8 +28,9 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
# Avoid shared lib symbols.
mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
@@ -22,11 +22,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -34,9 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_runto do_children_tests
@@ -22,11 +22,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile var-cmd.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -34,10 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
+if {[mi_clean_restart $binfile]} {
+ return
+}
##### #####
# #
@@ -18,11 +18,6 @@ require allow_cplus_tests
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile .cc
if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
@@ -30,7 +25,9 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""
return -1
}
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_prepare_inline_tests $srcfile
@@ -22,11 +22,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile var-cmd.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -34,9 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
set line_dct_end [gdb_get_line_number "{int a = 0;}"]
@@ -23,11 +23,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile var-cmd.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -49,9 +44,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {d
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
# Desc: Create global variable.
mi_create_varobj global_simple global_simple "create global variable"
@@ -19,11 +19,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -31,9 +26,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
set line_invalid_pointer_value [gdb_get_line_number "p_outer set to invalid value"]
set line_valid_pointer_value [gdb_get_line_number "p_outer set to valid value"]
@@ -18,11 +18,6 @@ require allow_cplus_tests
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile .cc
set opts {debug c++}
@@ -30,7 +25,9 @@ if [build_executable $testfile.exp $testfile $srcfile $opts] {
return -1
}
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_prepare_inline_tests $srcfile
@@ -21,11 +21,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile vla.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" \
@@ -34,9 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" \
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
set bp_lineno [gdb_get_line_number "vla-filled"]
@@ -22,11 +22,6 @@ load_lib mi-support.exp
load_lib fortran.exp
set MIFLAGS "-i=mi"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile vla.f90
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
@@ -39,9 +34,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
# the type names can be printed differently.
set real [fortran_real4]
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
set bp_lineno [gdb_get_line_number "vla1-not-allocated"]
mi_create_breakpoint "-t vla.f90:$bp_lineno" \
@@ -31,8 +31,6 @@ set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests]
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-gdb_exit
-
standard_testfile basics.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -16,11 +16,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi2"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile .s
set opts {}
@@ -32,14 +27,13 @@ if [info exists COMPILE] {
require {istarget x86_64-*-*} is_lp64_target
}
-set executable ${testfile}
-
-if [build_executable ${testfile}.exp ${executable} ${srcfile} $opts] {
+if [build_executable ${testfile}.exp ${binfile} ${srcfile} $opts] {
return -1
}
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
foreach name {different breakhere_different breakhere_validity breakhere_invalid} {
mi_create_breakpoint $name "break $name"
@@ -18,10 +18,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi2"
-if {[mi_gdb_start]} {
- return
-}
-
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -29,9 +25,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_runto do_tests
@@ -16,8 +16,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi2"
-gdb_exit
-if [mi_gdb_start] {
+if {[mi_clean_restart]} {
return
}
@@ -22,11 +22,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi2"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile var-cmd.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -34,9 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
mi_runto do_children_tests
@@ -20,11 +20,6 @@ load_lib gdb-python.exp
set MIFLAGS "-i=mi2"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile py-framefilter-mi.c
set pyfile py-framefilter.py
@@ -33,9 +28,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
if {[lsearch -exact [mi_get_features] python] < 0} {
unsupported "python support is disabled"
@@ -20,12 +20,8 @@ set MIFLAGS "-i=mi2"
require allow_python_tests
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile
+
set pyfile ${testfile}-gdb.py
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -35,8 +31,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
+if {[mi_clean_restart]} {
+ return
+}
+
mi_gdb_test "set auto-load safe-path ${remote_python_file}" \
{.*\^done} \
"set safe-path"
@@ -20,11 +20,6 @@ set MIFLAGS "-i=mi2"
require allow_python_tests
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile
set pyfile ${testfile}-gdb.py
@@ -38,8 +33,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# gdb will find it.
set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
+if {[mi_clean_restart $binfile]} {
+ return
+}
+
mi_gdb_test "set auto-load safe-path ${remote_python_file}" \
{.*\^done} \
"set safe-path"
@@ -19,11 +19,6 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi2"
-gdb_exit
-if [mi_gdb_start] {
- return
-}
-
standard_testfile py-prettyprint.c
set pyfile py-prettyprint.py
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DMI}] != "" } {
@@ -31,9 +26,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+if {[mi_clean_restart $binfile]} {
+ return
+}
if {[lsearch -exact [mi_get_features] python] < 0} {
unsupported "python support is disabled"
@@ -347,12 +342,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" \
return -1
}
-if [mi_gdb_start] {
+if {[mi_clean_restart ${binfile}-cxx]} {
return
}
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}-cxx
if {[lsearch -exact [mi_get_features] python] < 0} {
unsupported "python support is disabled"
@@ -89,19 +89,12 @@ proc test_reconnect { } {
}
}
- gdb_exit
+ global binfile
- if [mi_gdb_start] {
+ if {[mi_clean_restart $binfile]} {
return
}
- global srcdir
- global subdir
- global binfile
-
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
-
global gdbserver_protocol
global gdbserver_gdbport
@@ -162,19 +155,13 @@ proc test_pending_resolved { } {
with_test_prefix "pending resolved" {
global decimal hex
global executable
- global srcdir
- global subdir
global binfile
global lib_sl1 lib_sl2
global mi_gdb_prompt
- gdb_exit
- if [mi_gdb_start] {
+ if {[mi_clean_restart $binfile]} {
return
}
-
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
mi_load_shlibs $lib_sl1 $lib_sl2
# Create a pending tracepoint on pendfunc2
@@ -76,13 +76,11 @@ proc test_create_delete_modify_tsv { } {
return -1
}
gdb_exit
- if [mi_gdb_start] {
+
+ if {[mi_clean_restart $binfile]} {
return
}
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
-
mi_gdb_test "tvariable \$tvar3 = 3" \
".*=tsv-created,name=\"tvar3\",initial=\"3\".*\\^done" \
"tvariable \$tvar3 modified"
@@ -177,19 +175,11 @@ proc test_upload_tsv { } {
}
}
- gdb_exit
-
- if [mi_gdb_start] {
+ global binfile
+ if {[mi_clean_restart $binfile]} {
return
}
- global srcdir
- global subdir
- global binfile
-
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
-
global gdbserver_protocol
global gdbserver_gdbport