After test-case gdb.mi/mi-break.exp, a gdb instance is left running.
The test-case starts two instances using mi_clean_restart, one using
separate-mi-tty.
For each instance, gdb_exit is called once, from two different locations:
- mi_clean_restart, and
- gdb_finish.
But this doesn't seem to be effective for the separate-mi-tty case.
Fix this by calling gdb_mi_exit at the end of proc test_break.
Likewise in a few more more test-case.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
PR testsuite/32709
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32709
test_explicit_breakpoints
test_forced_conditions
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
}
foreach_mi_ui_mode mi-mode {
break
}
}
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
}
foreach_with_prefix args { "" "separate-mi-tty" } {
}
foreach_mi_ui_mode mode {
- mi_gdb_exit
-
if {$mode eq "separate"} {
set start_ops "separate-mi-tty"
} else {
"set do_spin variable in inferior, inferior should now finish"
mi_expect_stop "breakpoint-hit" "breakpt" ".*" ".*" "$::decimal" \
{"" "disp=\"keep\""} "stop in breakpt at the end of the test"
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
}
return [mi_make_breakpoint_loc -thread "1" -number "$::decimal\\.$num"]
}
-foreach_mi_ui_mode mode {
-
- if {$mode == "separate"} {
- set start_ops "separate-mi-tty"
- } else {
- set start_ops ""
- }
-
- if {[mi_clean_restart $binfile $start_ops]} {
- return -1
- }
+proc do_test { mode } {
# Ensure we get an error when placing a b/p for thread 1 at a point
# where thread 1 doesn't exist.
# would succeed, and then 'info breakpoint' on the CLI would
# trigger an assertion.
if {$mode eq "separate"} {
- with_spawn_id $gdb_main_spawn_id {
+ with_spawn_id $::gdb_main_spawn_id {
gdb_test "info breakpoints" "No breakpoints, watchpoints, tracepoints, or catchpoints\\." \
"check CLI 'info breakpoints' when there are no breakpoints"
}
# Check that 'info breakpoints' on the CLI succeeds.
if {$mode eq "separate"} {
- with_spawn_id $gdb_main_spawn_id {
+ with_spawn_id $::gdb_main_spawn_id {
gdb_test "info breakpoints" ".*" \
"check CLI 'info breakpoints' when there are some breakpoints"
}
}
+
+ return 1
+}
+
+foreach_mi_ui_mode mode {
+
+ if {$mode == "separate"} {
+ set start_ops "separate-mi-tty"
+ } else {
+ set start_ops ""
+ }
+
+ if {[mi_clean_restart $binfile $start_ops]} {
+ break
+ }
+
+ set res [do_test $mode]
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
+
+ if { $res == -1 } {
+ break
+ }
}
#test_rwatch_creation_and_listing
#test_awatch_creation_and_listing
test_watchpoint_triggering
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
}
# Run the tests twice, once using software watchpoints, and another
}
foreach_mi_ui_mode mode {
- mi_gdb_exit
-
if {$mode eq "separate"} {
set start_ops "separate-mi-tty"
} else {
"=breakpoint-deleted,id=\"$bpnum\"" \
"\\^done"]
}
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
}
global gdb_spawn_id gdb_main_spawn_id mi_spawn_id inferior_spawn_id
global gdb_prompt mi_gdb_prompt
- if {[mi_clean_restart $binfile "separate-mi-tty"] != 0} {
- fail "could not start gdb"
- return
- }
-
# Start a synchronous run/continue on the MI UI.
set test "send synchronous execution command"
if {$sync_command == "run"} {
if {[mi_run_cmd] >= 0} {
pass $test
} else {
- return
+ return -1
}
} else {
if {[mi_runto_main] < 0} {
- return
+ return -1
}
if {[mi_send_resuming_command_raw "123-exec-continue" $test] >= 0} {
pass $test
} else {
- return
+ return -1
}
}
}
foreach_with_prefix sync-command {"run" "continue"} {
- do_test ${sync-command}
+ if {[mi_clean_restart $binfile "separate-mi-tty"] != 0} {
+ fail "could not start gdb"
+ break
+ }
+
+ set res [do_test ${sync-command}]
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
+
+ if { $res == -1 } {
+ break
+ }
}
# the expected ^running record.
mi_runto_main
}
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
}
foreach_with_prefix ui_to_run {first second} {
global mi_spawn_id
global decimal
global binfile
- global GDBFLAGS
global async
set any "\[^\r\n\]*"
- save_vars { GDBFLAGS } {
- if { $mode == "non-stop" } {
- set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop 1\""]
- }
-
- if { [mi_clean_restart $binfile "separate-mi-tty"] != 0 } {
- return -1
- }
- }
-
if { [mi_runto_main] < 0 } {
return -1
}
}
}
-foreach_with_prefix mode { "all-stop" "non-stop" } {
+proc do_test { mode } {
set test "setup done"
if { [test_setup $mode] == -1 } {
fail $test
test_cli_in_mi_frame $mode $exec_mode
}
}
+
+foreach_with_prefix mode { "all-stop" "non-stop" } {
+ save_vars { GDBFLAGS } {
+ if { $mode == "non-stop" } {
+ set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop 1\""]
+ }
+
+ if { [mi_clean_restart $binfile "separate-mi-tty"] != 0 } {
+ break
+ }
+ }
+
+ set res [do_test $mode]
+
+ # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for
+ # separate-mi-tty. Use mi_gdb_exit instead.
+ mi_gdb_exit
+
+ if { $res == -1 } {
+ break
+ }
+}