1 # Test Framework Driver for GDB driving a ROM monitor (via monitor.c).
2 # Copyright 1995 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 # Set gdb to target the monitor
24 proc gdb_target_monitor { } {
31 verbose "Timeout is now $timeout seconds" 2
32 if [target_info exists gdb_protocol] {
33 set targetname "[target_info gdb_protocol]"
35 perror "No protocol specified for [target_info name].";
38 if [target_info exists baud] {
39 send_gdb "set remotebaud [target_info baud]\n"
41 if [target_info exists netport] {
42 set serialport "[target_info netport]"
44 set serialport "[target_info serial]"
47 for {set j 1} {$j <= 2} {incr j} {
48 for {set i 1} {$i <= 3} {incr i} {
49 send_gdb "target $targetname $serialport\n"
51 -re "Remote MIPS debugging.*" {
52 verbose "Set target to $targetname"
55 -re "Remote debugging using $serialport.*" {
56 verbose "Set target to $targetname"
59 -re "Remote target $targetname connected to.*" {
60 verbose "Set target to $targetname"
63 -re "Connection refused" {
64 verbose "Connection refused by remote target. Pausing, and trying again."
73 if { $j == 1 && ![reboot_target] } {
78 perror "Couldn't set target for $targetname, port is $serialport."
84 # gdb_load -- load a file into the debugger.
85 # return a -1 if anything goes wrong.
87 proc gdb_load { arg } {
96 if [gdb_file_cmd $arg] { return -1 }
101 if [is_remote host] {
106 verbose "Loading $arg"
107 send_gdb "load $arg\n"
109 verbose "Timeout is now $timeout seconds" 2
112 if { $verbose > 1 } {
113 send_user "Loaded $arg into $GDB\n"
118 if { $verbose > 1 } {
119 perror "GDB couldn't load."
123 if { $verbose > 1 } {
124 perror "Timed out trying to load $arg."
134 # reboot the board to get a clean start
138 catch default_gdb_start;
141 verbose "Timeout is now $timeout seconds" 2