diff options
author | Tom Tromey <tom@tromey.com> | 2023-01-25 10:01:57 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-01-26 18:28:31 -0700 |
commit | 3ad2b4af38e38e10166906f5238db098c886e1f9 (patch) | |
tree | aa55aee7360c36a19d55494eca86288b12108a5a | |
parent | d6acf25c03f8c507e134f7438bd4360464ce111e (diff) | |
download | binutils-3ad2b4af38e38e10166906f5238db098c886e1f9.zip binutils-3ad2b4af38e38e10166906f5238db098c886e1f9.tar.gz binutils-3ad2b4af38e38e10166906f5238db098c886e1f9.tar.bz2 |
Use mi_clean_restart more
This changes a number of MI tests to use mi_clean_restart rather than
separate calls. This reduces the number of lines, which is nice, and
also provides a nicer model to copy for future tests.
60 files changed, 147 insertions, 401 deletions
diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond.exp b/gdb/testsuite/gdb.ada/mi_ex_cond.exp index 6fba4da..f41b633 100644 --- a/gdb/testsuite/gdb.ada/mi_ex_cond.exp +++ b/gdb/testsuite/gdb.ada/mi_ex_cond.exp @@ -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. diff --git a/gdb/testsuite/gdb.ada/mi_task_arg.exp b/gdb/testsuite/gdb.ada/mi_task_arg.exp index 771e934..1d84e43 100644 --- a/gdb/testsuite/gdb.ada/mi_task_arg.exp +++ b/gdb/testsuite/gdb.ada/mi_task_arg.exp @@ -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 \"\"" ".*" diff --git a/gdb/testsuite/gdb.ada/mi_task_info.exp b/gdb/testsuite/gdb.ada/mi_task_info.exp index 7701a3e..6e23f01 100644 --- a/gdb/testsuite/gdb.ada/mi_task_info.exp +++ b/gdb/testsuite/gdb.ada/mi_task_info.exp @@ -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. # #################################### diff --git a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp index ae6c58f..0d54947 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp @@ -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" diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp index 336290e..692e0f1 100644 --- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp +++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp @@ -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). diff --git a/gdb/testsuite/gdb.mi/gdb680.exp b/gdb/testsuite/gdb.mi/gdb680.exp index fb9d865..a5d321d 100644 --- a/gdb/testsuite/gdb.mi/gdb680.exp +++ b/gdb/testsuite/gdb.mi/gdb680.exp @@ -20,8 +20,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp b/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp index 2e05f1d..feb2915 100644 --- a/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp +++ b/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp @@ -21,8 +21,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-async-run.exp b/gdb/testsuite/gdb.mi/mi-async-run.exp index 0267b54..cd668b1 100644 --- a/gdb/testsuite/gdb.mi/mi-async-run.exp +++ b/gdb/testsuite/gdb.mi/mi-async-run.exp @@ -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" diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp index f970fc7..4bc82d5 100644 --- a/gdb/testsuite/gdb.mi/mi-async.exp +++ b/gdb/testsuite/gdb.mi/mi-async.exp @@ -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. diff --git a/gdb/testsuite/gdb.mi/mi-break-qualified.exp b/gdb/testsuite/gdb.mi/mi-break-qualified.exp index 64bb9e4..3f6acc5 100644 --- a/gdb/testsuite/gdb.mi/mi-break-qualified.exp +++ b/gdb/testsuite/gdb.mi/mi-break-qualified.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp index 5cc2fe8..c0d9add 100644 --- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp index ac2d8e1..595ae92 100644 --- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp +++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp @@ -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 \ diff --git a/gdb/testsuite/gdb.mi/mi-cmd-error.exp b/gdb/testsuite/gdb.mi/mi-cmd-error.exp index 5a3b84a..a43d824 100644 --- a/gdb/testsuite/gdb.mi/mi-cmd-error.exp +++ b/gdb/testsuite/gdb.mi/mi-cmd-error.exp @@ -25,8 +25,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp index de0914d..8184cd8 100644 --- a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp +++ b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp index 7389607..c39e05c 100644 --- a/gdb/testsuite/gdb.mi/mi-console.exp +++ b/gdb/testsuite/gdb.mi/mi-console.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp index 66a3042..358d929 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp @@ -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"] diff --git a/gdb/testsuite/gdb.mi/mi-editing.exp b/gdb/testsuite/gdb.mi/mi-editing.exp index 35ed2af..2fb65ff 100644 --- a/gdb/testsuite/gdb.mi/mi-editing.exp +++ b/gdb/testsuite/gdb.mi/mi-editing.exp @@ -23,8 +23,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -gdb_exit -if {[mi_gdb_start]} { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-eval.exp b/gdb/testsuite/gdb.mi/mi-eval.exp index 1611b15..74ff887 100644 --- a/gdb/testsuite/gdb.mi/mi-eval.exp +++ b/gdb/testsuite/gdb.mi/mi-eval.exp @@ -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] diff --git a/gdb/testsuite/gdb.mi/mi-file-transfer.exp b/gdb/testsuite/gdb.mi/mi-file-transfer.exp index 726504c..edb1ea6 100644 --- a/gdb/testsuite/gdb.mi/mi-file-transfer.exp +++ b/gdb/testsuite/gdb.mi/mi-file-transfer.exp @@ -29,12 +29,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_file_cmd ${binfile} proc mi_gdbserver_run { } { diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp index 811744e..0785c2b 100644 --- a/gdb/testsuite/gdb.mi/mi-file.exp +++ b/gdb/testsuite/gdb.mi/mi-file.exp @@ -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,8 +25,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir +if {[mi_clean_restart]} { + return +} mi_gdb_file_cmd ${binfile} proc test_file_list_exec_source_file {} { diff --git a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp index b41cc7f..f898e55 100644 --- a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp +++ b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp @@ -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" diff --git a/gdb/testsuite/gdb.mi/mi-hack-cli.exp b/gdb/testsuite/gdb.mi/mi-hack-cli.exp index 3013d87..f39923b 100644 --- a/gdb/testsuite/gdb.mi/mi-hack-cli.exp +++ b/gdb/testsuite/gdb.mi/mi-hack-cli.exp @@ -19,8 +19,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-i-cmd.exp b/gdb/testsuite/gdb.mi/mi-i-cmd.exp index 80ef266..e64f900 100644 --- a/gdb/testsuite/gdb.mi/mi-i-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-i-cmd.exp @@ -16,8 +16,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-info-os.exp b/gdb/testsuite/gdb.mi/mi-info-os.exp index 2f243a7..d71ad4c 100644 --- a/gdb/testsuite/gdb.mi/mi-info-os.exp +++ b/gdb/testsuite/gdb.mi/mi-info-os.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp index d3523b0..90bb182 100644 --- a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp +++ b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp @@ -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" diff --git a/gdb/testsuite/gdb.mi/mi-language.exp b/gdb/testsuite/gdb.mi/mi-language.exp index 4e8dea3..41a6c22 100644 --- a/gdb/testsuite/gdb.mi/mi-language.exp +++ b/gdb/testsuite/gdb.mi/mi-language.exp @@ -16,8 +16,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-memory-changed.exp b/gdb/testsuite/gdb.mi/mi-memory-changed.exp index 846415d..c562568 100644 --- a/gdb/testsuite/gdb.mi/mi-memory-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-memory-changed.exp @@ -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\".*" \ diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp index 271908c..153efdf 100644 --- a/gdb/testsuite/gdb.mi/mi-pending.exp +++ b/gdb/testsuite/gdb.mi/mi-pending.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp index fc410af..f8e701e 100644 --- a/gdb/testsuite/gdb.mi/mi-pthreads.exp +++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp index caca969..d690595 100644 --- a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp +++ b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp @@ -22,11 +22,6 @@ require dwarf2_support # This test can only be run on x86_64 targets. require is_x86_64_m64_target -gdb_exit -if [mi_gdb_start] { - return -} - standard_testfile .S if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nopie}] != "" } { @@ -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_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" diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp index 6254711..12185fb 100644 --- a/gdb/testsuite/gdb.mi/mi-return.exp +++ b/gdb/testsuite/gdb.mi/mi-return.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp index 99b729d..fec4f01 100644 --- a/gdb/testsuite/gdb.mi/mi-simplerun.exp +++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-solib.exp b/gdb/testsuite/gdb.mi/mi-solib.exp index 0363765..665759d 100644 --- a/gdb/testsuite/gdb.mi/mi-solib.exp +++ b/gdb/testsuite/gdb.mi/mi-solib.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp index 3359a87..633e090 100644 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ b/gdb/testsuite/gdb.mi/mi-stack.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-start.exp b/gdb/testsuite/gdb.mi/mi-start.exp index b7e81a3..89ce2dd 100644 --- a/gdb/testsuite/gdb.mi/mi-start.exp +++ b/gdb/testsuite/gdb.mi/mi-start.exp @@ -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. diff --git a/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp b/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp index 2193f05..149940d 100644 --- a/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp +++ b/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp @@ -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. diff --git a/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp b/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp index 998853c..9b57c82 100644 --- a/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp @@ -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" \ diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp index be87d2c..902fd8a 100644 --- a/gdb/testsuite/gdb.mi/mi-until.exp +++ b/gdb/testsuite/gdb.mi/mi-until.exp @@ -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"] diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp index 3638dfd..e2e788a 100644 --- a/gdb/testsuite/gdb.mi/mi-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi-var-block.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp index 7723dbc..1b4e164 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp @@ -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" diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index e64bde9..3cfa0ce 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 9bd1f7c..0846580 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -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 +} ##### ##### # # diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-var-cp.exp index 3ce48db..edb4332 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cp.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index b889d19..548c4fe 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -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;}"] diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp index dfaff33..20d9171 100644 --- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp +++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp @@ -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" diff --git a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp index ea02467..f9da4e4 100644 --- a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp +++ b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp @@ -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"] diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp index fb8e492..a41d58e 100644 --- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp +++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi-vla-c99.exp b/gdb/testsuite/gdb.mi/mi-vla-c99.exp index ddfe607..3c28549 100644 --- a/gdb/testsuite/gdb.mi/mi-vla-c99.exp +++ b/gdb/testsuite/gdb.mi/mi-vla-c99.exp @@ -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"] diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp index a240fb3..e4db423 100644 --- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp @@ -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" \ diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp index a6e6f89..5303a41 100644 --- a/gdb/testsuite/gdb.mi/mi-watch.exp +++ b/gdb/testsuite/gdb.mi/mi-watch.exp @@ -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}] != "" } { diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp index 76acabc..80c8ddf 100644 --- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp +++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp @@ -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 is_x86_64_m64_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" diff --git a/gdb/testsuite/gdb.mi/mi2-cli-display.exp b/gdb/testsuite/gdb.mi/mi2-cli-display.exp index 817c383..6a2b86d 100644 --- a/gdb/testsuite/gdb.mi/mi2-cli-display.exp +++ b/gdb/testsuite/gdb.mi/mi2-cli-display.exp @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi2-prompt.exp b/gdb/testsuite/gdb.mi/mi2-prompt.exp index 22fda0e..f528c76 100644 --- a/gdb/testsuite/gdb.mi/mi2-prompt.exp +++ b/gdb/testsuite/gdb.mi/mi2-prompt.exp @@ -16,8 +16,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi2" -gdb_exit -if [mi_gdb_start] { +if {[mi_clean_restart]} { return } diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp index 47cfeb8..5c40f83 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp @@ -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 diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite/gdb.python/py-framefilter-mi.exp index 723945d..509f21b 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp +++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp @@ -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" diff --git a/gdb/testsuite/gdb.python/py-mi-events.exp b/gdb/testsuite/gdb.python/py-mi-events.exp index cc417d4..8d546a9 100644 --- a/gdb/testsuite/gdb.python/py-mi-events.exp +++ b/gdb/testsuite/gdb.python/py-mi-events.exp @@ -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" diff --git a/gdb/testsuite/gdb.python/py-mi-objfile.exp b/gdb/testsuite/gdb.python/py-mi-objfile.exp index bc02da2..d098bba 100644 --- a/gdb/testsuite/gdb.python/py-mi-objfile.exp +++ b/gdb/testsuite/gdb.python/py-mi-objfile.exp @@ -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" diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp index 705a9c4..a7b7a5f 100644 --- a/gdb/testsuite/gdb.python/py-mi.exp +++ b/gdb/testsuite/gdb.python/py-mi.exp @@ -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" diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp index 6dc5e38..fab1463 100644 --- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp @@ -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 diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp index ea7fcf3..792bd4f 100644 --- a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp @@ -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 |