From 08e706b15a3650e649aa49023b8ac1976512520f Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 14 Nov 2000 22:19:02 +0000 Subject: 2000-11-03 Michael Snyder * config/monitor.exp (gdb_target_cmd): Abstracts some of the code from gdb_target_monitor, so it can be used independantly for gdbserver. Also comment out an unnecessary PUTS. --- gdb/testsuite/ChangeLog | 6 +++ gdb/testsuite/config/monitor.exp | 97 +++++++++++++++++++++++----------------- 2 files changed, 61 insertions(+), 42 deletions(-) (limited to 'gdb') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 45efe37..7dd18b0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2000-11-03 Michael Snyder + * config/monitor.exp (gdb_target_cmd): Abstracts some of the + code from gdb_target_monitor, so it can be used independantly + for gdbserver. Also comment out an unnecessary PUTS. + +2000-11-03 Michael Snyder + * gdb.base/a2-run.exp: Use gdb_skip_stdio_test. * gdb.base/corefile.exp: Expect the message "Program is being debugged already" when we send the "corefile" command, since diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp index b482480..0b94ad3 100644 --- a/gdb/testsuite/config/monitor.exp +++ b/gdb/testsuite/config/monitor.exp @@ -16,7 +16,60 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. load_lib gdb.exp -puts "***** DID USE MONITOR ******" +# puts "***** DID USE MONITOR ******" + +# +# gdb_target_cmd +# Send gdb the "target" command +# +proc gdb_target_cmd { targetname serialport } { + global gdb_prompt + + for {set i 1} {$i <= 3} {incr i} { + send_gdb "target $targetname $serialport\n" + gdb_expect 60 { + -re "A program is being debugged already.*ill it.*y or n. $" { + send_gdb "y\n"; + exp_continue; + } + -re "Couldn't establish connection to remote.*$gdb_prompt" { + verbose "Connection failed"; + } + -re "Remote MIPS debugging.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Remote debugging using .*$serialport.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Remote target $targetname connected to.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Connected to.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Ending remote.*$gdb_prompt" { } + -re "Connection refused.*$gdb_prompt" { + verbose "Connection refused by remote target. Pausing, and trying again." + sleep 30 + continue + } + -re "Timeout reading from remote system.*$gdb_prompt" { + verbose "Got timeout error from gdb."; + } + timeout { + send_gdb ""; + break + } + } + } +} + + + # # gdb_target_monitor # Set gdb to target the monitor @@ -55,47 +108,7 @@ proc gdb_target_monitor { exec_file } { for {set j 1} {$j <= 2} {incr j} { if [gdb_file_cmd $exec_file] { return -1; } - for {set i 1} {$i <= 3} {incr i} { - send_gdb "target $targetname $serialport\n" - gdb_expect 60 { - -re "A program is being debugged already.*ill it.*y or n. $" { - send_gdb "y\n"; - exp_continue; - } - -re "Couldn't establish connection to remote.*$gdb_prompt" { - verbose "Connection failed"; - } - -re "Remote MIPS debugging.*$gdb_prompt" { - verbose "Set target to $targetname"; - return 0; - } - -re "Remote debugging using .*$serialport.*$gdb_prompt" { - verbose "Set target to $targetname"; - return 0; - } - -re "Remote target $targetname connected to.*$gdb_prompt" { - verbose "Set target to $targetname"; - return 0; - } - -re "Connected to.*$gdb_prompt" { - verbose "Set target to $targetname"; - return 0; - } - -re "Ending remote.*$gdb_prompt" { } - -re "Connection refused.*$gdb_prompt" { - verbose "Connection refused by remote target. Pausing, and trying again." - sleep 30 - continue - } - -re "Timeout reading from remote system.*$gdb_prompt" { - verbose "Got timeout error from gdb."; - } - timeout { - send_gdb ""; - break - } - } - } + gdb_target_cmd $targetname $serialport; gdb_target_exec; -- cgit v1.1