From 2226f861d20ac90ed2dc31b0f602c63e3f84c818 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 23 May 2007 12:41:14 +0000 Subject: * lib/gdbserver-support.exp (gdbserver_spawn): Only match full_buffer. (gdbserver_run): Kill any running gdbserver. * lib/mi-support.exp (mi_gdb_target_load): Likewise. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/lib/gdbserver-support.exp | 17 ++++++++++++++++- gdb/testsuite/lib/mi-support.exp | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'gdb') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1f0fdd3..3b882ca 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-05-23 Daniel Jacobowitz + + * lib/gdbserver-support.exp (gdbserver_spawn): Only match full_buffer. + (gdbserver_run): Kill any running gdbserver. + * lib/mi-support.exp (mi_gdb_target_load): Likewise. + 2007-05-17 Maciej W. Rozycki * gdb.base/sigbpt.exp: Preset segv_addr. diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp index 0a8b111..4d8f049 100644 --- a/gdb/testsuite/lib/gdbserver-support.exp +++ b/gdb/testsuite/lib/gdbserver-support.exp @@ -222,7 +222,7 @@ proc gdbserver_spawn { child_args } { # don't need to redirect output. expect_background { -i $server_spawn_id - -re "." { } + full_buffer { } eof { # The spawn ID is already closed now (but not yet waited for). wait -i $expect_out(spawn_id) @@ -236,6 +236,21 @@ proc gdbserver_spawn { child_args } { # to it. Return 0 on success, or non-zero on failure. proc gdbserver_run { child_args } { + # Kill anything running before we try to start gdbserver, in case + # we are sharing a serial connection. + global gdb_prompt + send_gdb "kill\n" + gdb_expect 120 { + -re "Kill the program being debugged. .y or n. $" { + send_gdb "y\n" + verbose "\t\tKilling previous program being debugged" + exp_continue + } + -re "$gdb_prompt $" { + # OK. + } + } + set res [gdbserver_spawn $child_args] set protocol [lindex $res 0] set gdbport [lindex $res 1] diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 6763ff5..c1381a5 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -454,6 +454,7 @@ proc mi_gdb_target_load { } { upvar timeout timeout if { [info procs gdbserver_gdb_load] != "" } { + mi_gdb_test "kill" ".*" "" set res [gdbserver_gdb_load] set protocol [lindex $res 0] set gdbport [lindex $res 1] -- cgit v1.1