1 # Test Framework Driver for GDB using the extended gdb remote protocol
2 # Copyright 1995, 1997 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.
18 # For this to function correctly, you need to set a number of variables
19 # in your gdb/site.exp file
21 # set noargs 1 -- we can't pass arguments (yet)
22 # set noinferiorio 1 -- we can't get io to/from the inferior
23 # set targethost <host> -- name of the remote system (runs gdbserver)
24 # set debughost <host> -- name of the system running gdb
25 # set port <number> -- starting port number for communication
26 # set gdbserver <path> -- path (on the remote side) to find
28 # set rsh <path> -- path (on debughost side) to rsh
29 # set rcp <path> -- path (on debughost side) to rcp
31 # You will need to be able to spawn processes from gdbhost to run on
32 # targethost via rsh (this is how we start gdbserver); similarly
33 # you need to be able to rcp files from gdbhost to targethost.
35 # We don't do much error checking, if something goes wrong, you'll probably
36 # just get a tcl error and everything will die. FIXME
39 # Load the basic gdb testing library
44 # gdb_load -- load a file into the debugger.
45 # return a -1 if anything goes wrong.
47 # Loading a file in the gdbsrever framework is a little strange in that
48 # we also create the inferior (which is stopped at the first instruction
49 # in the program when we get control).
51 proc gdb_load { arg } {
60 # bump the port number to avoid conflicts with hung ports
61 set targethost [target_info gdb_server_host];
62 set debughost [target_info gdb_debug_host];
63 if [target_info exists gdb_server_prog] {
64 set gdbserver [target_info gdb_server_prog];
66 set gdbserver "gdbserver";
69 set serialport $targethost:$port
71 # Copy the file down to the remote host.
72 set file [remote_download host $arg];
74 # now start gdbserver on the remote side
75 remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
77 # give it plenty of time to get going (lynx)
80 # tell gdb we are remote debugging
81 if [gdb_target_monitor $arg] {
89 # gdb_start -- start GDB running.
95 catch default_gdb_start
97 # FIXME: This shouldn't be necessary, but lots of PA tests fail
99 send "set remotecache 0\n"
101 -re "set remotecache 0\[\r\n\]+.*$gdb_prompt $" {}
102 default { fail "gdb_start"}