# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
load_lib gdb.exp
+# 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 "\ 3";
+ break
+ }
+ }
+ }
+}
+
+
#
# gdb_target_monitor
if [target_info exists baud] {
gdb_test "set remotebaud [target_info baud]" "" ""
}
+ if [target_info exists binarydownload] {
+ gdb_test "set remotebinarydownload [target_info binarydownload]" "" ""
+ }
+ if { [ target_info exists disable_x_packet ] } {
+ gdb_test "set remote X-packet disable" ""
+ }
+ if { [ target_info exists disable_z_packet ] } {
+ gdb_test "set remote Z-packet disable" ""
+ }
if [target_info exists gdb_serial] {
set serialport "[target_info gdb_serial]";
} elseif [target_info exists netport] {
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 "\ 3";
- break
- }
- }
- }
+ gdb_target_cmd $targetname $serialport;
gdb_target_exec;