1 # Copyright 1988, 1990, 1991, 1992, 1995, 1997
2 # 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 # Please email any bugs, comments, and/or additions to this file to:
21 # This file was written by Rob Savoye. (rob@cygnus.com)
24 # load support libraries
30 set gdb_prompt "\\(vxgdb\\)"
33 # gdb_version -- extract and print the version number of gcc
40 # gdb_load -- load a file into the debugger.
41 # We have to stop and start gdb each time we do this, because when
42 # vxgdb loads two files in a row, the symbols in the first file loaded
43 # take precedence. Returns -1 on error, else 0.
45 proc gdb_load { arg } {
48 if { [remote_ld target $arg] != 0 } {
49 perror "Couldn't load $arg"
53 return [gdb_file_cmd $arg]
57 # gdb_start -- start gdb running
65 # get a connection to the board
66 for { set x 0; } { $x < 3 } { incr x } {
67 set shell_id [remote_open target]
68 if { $shell_id > 0 } {
69 verbose "Spawn id for remote shell is $shell_id"
72 verbose "Timeout is now $timeout seconds" 2
74 set state [spawn_vxgdb];
75 if { $state == "pass" } {
78 if { $state == "fail" } {
86 proc spawn_vxgdb { } {
91 # set the default arguments to "main", so that "run" with no
92 # arguments will work correctly.
93 send_gdb "set args main\n"
94 gdb_expect -re ".*$gdb_prompt $" {}
96 verbose "Setting up target, Please wait..."
97 # set targets hostname
98 send_gdb "target vxworks [target_info hostname]\n"
100 verbose "Timeout is now $timeout seconds" 2
102 -re "Done\..*$gdb_prompt $" {
103 verbose "Set target to [target_info hostname]" 1
107 -re "net_connect: RPC: (Program not registered|.*Timed out).*$" {
108 warning "Couldn't set GDB to target [target_info netport]."
111 warning "Couldn't set target for vxworks."
119 catch default_gdb_exit
123 # "<return>" { send "\n"; perror "Window too small." }
124 # -re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." }
125 # buffer_full { perror "internal buffer is full." }
126 # eof { perror "eof -- pty is hosed." }
127 # timeout { perror "timeout." }
128 # "virtual memory exhausted" { perror "virtual memory exhausted." }
129 # "Undefined command" { perror "send string probably wrong." }