1 # Copyright (C) 1988, 1990, 1991, 1992, 1995 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
20 # This file was written by Rob Savoye. (rob@cygnus.com)
23 # load support libraries
30 set 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 { [vxworks_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 set shell_id [remote_open target]
67 if { $shell_id < 0 } then {
68 perror "Couldn't connect to target."
71 verbose "Spawn id for remote shell is $shell_id"
73 # reboot vxworks to get a clean start
75 verbose "Rebooting VxWorks, Please wait...\n"
77 send -i $shell_id "\030"
79 verbose "Timeout is now $timeout seconds" 2
81 -i $shell_id -re "Connection closed.*$" {
82 verbose "\nVxWorks has closed the shell"
85 perror "(eof) never disconnected from VxWorks shell."
88 -i $shell_id timeout {
89 perror "(timeout) never disconnected from VxWorks shell."
93 catch "close -i $shell_id" tmp
97 verbose "Timeout is now $timeout seconds" 2
102 proc spawn_vxgdb { } {
108 # set the default arguments to "main", so that "run" with no
109 # arguments will work correctly.
110 send "set args main\n"
111 expect -re ".*$prompt $" {}
113 verbose "Setting up target, Please wait..."
114 # set targets hostname
115 send "target vxworks [target_info netport]\n"
117 verbose "Timeout is now $timeout seconds" 2
119 -re "Done\..*$prompt $" {
120 verbose "Set target to [target_info netport]" 1
122 -re "net_connect: RPC: Program not registered.*$" {
123 perror "Couldn't set GDB to target [target_info netport]."
127 perror "Couldn't set target for vxworks."
129 verbose "Timeout is now $timeout seconds" 2
134 verbose "Timeout is now $timeout seconds" 2
139 catch default_gdb_exit
143 # "<return>" { send "\n"; perror "Window too small." }
144 # -re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." }
145 # buffer_full { perror "internal buffer is full." }
146 # eof { perror "eof -- pty is hosed." }
147 # timeout { perror "timeout." }
148 # "virtual memory exhausted" { perror "virtual memory exhausted." }
149 # "Undefined command" { perror "send string probably wrong." }