1 # Copyright
(C
) 1988, 1990, 1991, 1992, 1994, 1997 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
:
18 # bug
-gdb@prep.ai.mit.edu
20 # This file was written by J.T. Conklin.
(jtc@cygnus.com
)
28 if ![info exists LD] then {
29 set LD [findfile
"$base_dir/../../ld/ld.new"]
33 if ![info exists NLMCONV
] then {
34 set NLMCONV
[findfile
"$base_dir/../../binutils/nlmconv"]
38 # gdb_version
-- extract and print the version number of gcc
45 # gdb_unload
-- unload a file
if one is loaded
49 # gdb_load
-- load a file into the debugger.
50 #
return a
-1 if anything goes wrong.
52 proc gdb_load
{ arg } {
59 # FIXME
: this is wrong.
60 set targetname
[target_info
name];
62 set obj [file tail $
arg]
68 puts $fd
"description \"[file tail $nlm]\""
69 puts $fd
"screenname \"System Console\""
70 puts $fd
"module clib.nlm"
71 puts $fd
"module mathlib.nlm"
72 puts $fd
"stack 32768"
73 # puts $fd
"stack 64512"
75 # FIXME
: don
't hardcode location of prelude.o
76 puts $fd "input /s1/cygnus/dejagnu/i386-netware/lib/prelude.o"
78 puts $fd "output $nlm"
82 verbose "Executing: $NLMCONV -l$LD -T$lnk" 1
83 catch "exec $NLMCONV -l$LD -T$lnk" output
84 if ![string match "" $output] then {
87 if ![string match "NONE" $errorCode] {
88 warning "Can't link $
arg"
92 catch
"exec rm -f $lnk"
95 verbose
"Downloading $nlm" 1
96 catch
"exec cp $nlm /.NetWare/$targetname.nws/sys.nwv/tmp/x.nlm" output
97 if ![string match
"" $output] then {
105 proc gdb_run_cmd
{ } {
110 set connhost
[target_info
name];
111 if [board_info $connhost
exists serial
] {
112 set serialport
[board_info $connhost serial
];
114 set serialport
[board_info $connhost netport
];
117 if [board_info $connhost
exists baud
] {
118 set baud
[board_info $connhost baud
];
122 # FIXME
: This is wrong.
125 -re
".*Kill the program being debugged.*y or n. $" {
129 -re
".*$gdb_prompt $" {}
132 verbose
"Starting GDB stub on [target_info name]" 1
133 send
-i $shell_id
"load nlmstub BAUD=$baud x.nlm\r\n"
135 send
"set remotebaud $baud\n"
139 perror
"Couldn't set remote baud rate"
144 set otimeout $timeout
146 verbose
"Timeout is now $timeout seconds" 2
147 send
"target remote $serialport\n"
149 -re
"Couldn't establish connection to remote target" {
150 send
"target remote $serialport\n"
155 set timeout $otimeout
156 verbose
"Timeout restored to $timeout seconds" 2
157 perror
"Couldn't set remote target"
161 set timeout $otimeout
162 verbose
"Timeout restored to $timeout seconds" 2
175 # start the remote
shell
178 set shell_prompt
"Password:"
179 set shell_id
[remote_open target
]
181 if $shell_id
<0 then {
182 warning
"Couldn't connect to target"
186 if [string match
"" $passwd] then {
188 send_user
"Password: "
189 expect_user
-re
"(.*)\n"
191 set passwd
"$expect_out(1,string)"
195 send
-i $shell_id
"$passwd\n"
198 verbose
"Got termtype prompt" 0
201 -i $shell_id timeout
{
202 warning
"Connection timed out"
208 # FIXME
: this is wrong.
209 set shell_prompt
"[string toupper [target_info name]]:"
210 send
-i $shell_id
"1\n"
213 -i $shell_id
-re
"$shell_prompt" {}
214 -i $shell_id timeout
{
215 warning
"Connection timed out"