aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/config
diff options
context:
space:
mode:
authorBob Manson <manson@cygnus>1997-06-04 00:04:43 +0000
committerBob Manson <manson@cygnus>1997-06-04 00:04:43 +0000
commit43f396d00783011c903e3284828cd5c81f47a105 (patch)
tree44a869b096be9fdeb1aa67e24435f45520b0e8d8 /gdb/testsuite/config
parent3d400c0939c790bb605dcf0733bffc5322ba7677 (diff)
downloadgdb-43f396d00783011c903e3284828cd5c81f47a105.zip
gdb-43f396d00783011c903e3284828cd5c81f47a105.tar.gz
gdb-43f396d00783011c903e3284828cd5c81f47a105.tar.bz2
* config/monitor.exp(gdb_target_monitor): Call gdb_file_cmd
here. Call gdb_target_exec before rebooting the target, to make sure the connection to the target is closed. (gdb_load): Pass the name of the executable to gdb_target_monitor. Don't call gdb_file_cmd here; let gdb_target_monitor do it. * config/gdbserver.exp: Pass the executable being loaded to gdb_target_monitor. Don't call gdb_file_cmd here; let gdb_target_monitor do it. * gdb.disasm/hppa.exp: Don't use exec_output.
Diffstat (limited to 'gdb/testsuite/config')
-rw-r--r--gdb/testsuite/config/monitor.exp78
1 files changed, 42 insertions, 36 deletions
diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp
index 53d2152..242e98d 100644
--- a/gdb/testsuite/config/monitor.exp
+++ b/gdb/testsuite/config/monitor.exp
@@ -21,7 +21,7 @@ load_lib gdb.exp
# gdb_target_monitor
# Set gdb to target the monitor
#
-proc gdb_target_monitor { } {
+proc gdb_target_monitor { exec_file } {
global gdb_prompt
global exit_status
global timeout
@@ -47,27 +47,29 @@ proc gdb_target_monitor { } {
}
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"
+ send_gdb "target $targetname $serialport\n"
gdb_expect {
-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"
+ verbose "Connection failed";
}
-re "Remote MIPS debugging.*$gdb_prompt" {
- verbose "Set target to $targetname"
- return
+ verbose "Set target to $targetname";
+ return 0;
}
-re "Remote debugging using $serialport.*$gdb_prompt" {
- verbose "Set target to $targetname"
- return
+ verbose "Set target to $targetname";
+ return 0;
}
-re "Remote target $targetname connected to.*$gdb_prompt" {
- verbose "Set target to $targetname"
- return
+ verbose "Set target to $targetname";
+ return 0;
}
-re "Ending remote.*$gdb_prompt" { }
-re "Connection refused.*$gdb_prompt" {
@@ -81,12 +83,15 @@ proc gdb_target_monitor { } {
}
}
}
+
+ gdb_target_exec;
+
if { $j == 1 && ![reboot_target] } {
break;
}
}
- perror "Couldn't set target for $targetname, port is $serialport."
+ perror "Couldn't set target for $targetname, port is $serialport.";
return -1;
}
@@ -106,6 +111,21 @@ proc gdb_load { arg } {
global gdb_prompt
global timeout
+ if { $arg == "" } {
+ send_gdb "info files\n";
+ gdb_expect {
+ -re "Symbols from \"([^\"]+)\"" {
+ set arg $expect_out(1,string);
+ exp_continue;
+ }
+ -re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
+ set arg $expect_out(1,string);
+ exp_continue;
+ }
+ -re "$gdb_prompt $" { }
+ }
+ }
+
for { set j 1; } { $j <= 2 } {incr j; } {
if [target_info exists gdb,use_standard_load] {
gdb_target_exec;
@@ -114,21 +134,20 @@ proc gdb_load { arg } {
remote_close target;
remote_pop_conn host;
if { $state == "pass" } {
- if { $arg != "" } {
- if [gdb_file_cmd $arg] { return -1 }
- }
- gdb_target_monitor;
+ if [gdb_target_monitor $arg] { return -1; }
gdb_test "list main" ".*" ""
verbose "Loaded $arg into $GDB\n";
- return 1;
+ return 0;
}
} else {
- if { $arg != "" } {
- if [gdb_file_cmd $arg] { return -1 }
+ if [is_remote host] {
+ # FIXME:
+ set arg a.out;
}
- gdb_target_monitor
- if [target_info exists gdb_sect_offset] {
+ if [gdb_target_monitor $arg] { return -1 }
+
+ if { $arg != "" && [target_info exists gdb_sect_offset] } {
set textoff [target_info gdb_sect_offset];
send_gdb "sect .text $textoff\n";
gdb_expect {
@@ -153,10 +172,6 @@ proc gdb_load { arg } {
-re "$gdb_prompt" { }
}
}
- if [is_remote host] {
- # FIXME:
- set arg a.out;
- }
verbose "Loading $arg"
if [target_info exists gdb_load_offset] {
@@ -168,12 +183,12 @@ proc gdb_load { arg } {
set timeout 1000
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
- -re ".*\[Ff\]ailed.*$gdb_prompt $" {
+ -re "\[Ff\]ailed.*$gdb_prompt $" {
verbose "load failed";
}
- -re ".*$gdb_prompt $" {
+ -re "$gdb_prompt $" {
verbose "Loaded $arg into $GDB\n"
- return 1
+ return 0;
}
timeout {
if { $verbose > 1 } {
@@ -183,6 +198,7 @@ proc gdb_load { arg } {
}
}
+ # Make sure we don't have an open connection to the target.
gdb_target_exec;
if { $j == 1 } {
@@ -196,21 +212,11 @@ proc gdb_load { arg } {
}
proc gdb_start { } {
- global timeout
- global reboot
global gdb_prompt;
- # reboot the board to get a clean start
- if $reboot then {
- reboot_target;
- }
-
if [board_info target exists gdb_prompt] {
set gdb_prompt [board_info target gdb_prompt];
}
catch default_gdb_start;
-
- set timeout 10
- verbose "Timeout is now $timeout seconds" 2
}