OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [testsuite/] [config/] [netware.exp] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#   Copyright (C) 1988, 1990, 1991, 1992, 1994, 1997 Free Software Foundation, Inc.
2
 
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.
7
#
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.
12
#
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.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by J.T. Conklin. (jtc@cygnus.com)
21
 
22
load_lib gdb.exp
23
load_lib remote.exp
24
 
25
global shell_id
26
 
27
global LD
28
if ![info exists LD] then {
29
        set LD [findfile "$base_dir/../../ld/ld.new"]
30
}
31
 
32
global NLMCONV
33
if ![info exists NLMCONV] then {
34
        set NLMCONV [findfile "$base_dir/../../binutils/nlmconv"]
35
}
36
 
37
#
38
# gdb_version -- extract and print the version number of gcc
39
#
40
proc gdb_version {} {
41
    default_gdb_version
42
}
43
 
44
#
45
# gdb_unload -- unload a file if one is loaded
46
#
47
 
48
#
49
# gdb_load -- load a file into the debugger.
50
#             return a -1 if anything goes wrong.
51
#
52
proc gdb_load { arg } {
53
    global gdb_prompt
54
    global LD
55
    global NLMCONV
56
    global errorCode
57
    global shell_id
58
 
59
    # FIXME: this is wrong.
60
    set targetname [target_info name];
61
 
62
    set obj [file tail $arg]
63
    set nlm "$obj.nlm"
64
    set lnk "$obj.lnk"
65
 
66
    # build *.lnk file
67
    set fd [open $lnk w]
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"
74
    puts $fd "debug"
75
    # FIXME: don't hardcode location of prelude.o
76
    puts $fd "input /s1/cygnus/dejagnu/i386-netware/lib/prelude.o"
77
    puts $fd "input $arg"
78
    puts $fd "output $nlm"
79
    close $fd
80
 
81
    # run nlmconv
82
    verbose "Executing: $NLMCONV -l$LD -T$lnk" 1
83
    catch "exec $NLMCONV -l$LD -T$lnk" output
84
    if ![string match "" $output] then {
85
        verbose $output 1
86
    }
87
    if ![string match "NONE" $errorCode] {
88
        warning "Can't link $arg"
89
 
90
        return -1
91
    }
92
    catch "exec rm -f $lnk"
93
 
94
    # download
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 {
98
        verbose $output 1
99
        return -1
100
    }
101
 
102
    gdb_file_cmd $nlm
103
}
104
 
105
proc gdb_run_cmd { } {
106
    global shell_id
107
    global gdb_prompt
108
    global timeout
109
 
110
    set connhost [target_info name];
111
    if [board_info $connhost exists serial] {
112
        set serialport [board_info $connhost serial];
113
    } else {
114
        set serialport [board_info $connhost netport];
115
    }
116
 
117
    if [board_info $connhost exists baud] {
118
        set baud [board_info $connhost baud];
119
    } else {
120
        set baud 9600;
121
    }
122
    # FIXME: This is wrong.
123
    send "kill\n"
124
    gdb_expect {
125
        -re ".*Kill the program being debugged.*y or n. $" {
126
            send "y\n"
127
            exp_continue
128
        }
129
        -re ".*$gdb_prompt $" {}
130
    }
131
 
132
    verbose "Starting GDB stub on [target_info name]" 1
133
    send -i $shell_id "load nlmstub BAUD=$baud x.nlm\r\n"
134
 
135
    send "set remotebaud $baud\n"
136
    gdb_expect {
137
        -re "$gdb_prompt" {}
138
        timeout {
139
            perror "Couldn't set remote baud rate"
140
            return
141
        }
142
    }
143
 
144
    set otimeout $timeout
145
    set timeout 60
146
    verbose "Timeout is now $timeout seconds" 2
147
    send "target remote $serialport\n"
148
    gdb_expect {
149
        -re "Couldn't establish connection to remote target" {
150
            send "target remote $serialport\n"
151
            exp_continue
152
        }
153
        -re "$gdb_prompt" {}
154
        timeout {
155
            set timeout $otimeout
156
            verbose "Timeout restored to $timeout seconds" 2
157
            perror "Couldn't set remote target"
158
            return
159
        }
160
    }
161
    set timeout $otimeout
162
    verbose "Timeout restored to $timeout seconds" 2
163
 
164
    send "continue\n"
165
    gdb_expect {
166
        "Continuing.$" {}
167
    }
168
 
169
    return
170
}
171
 
172
 
173
 
174
#
175
# start the remote shell
176
#
177
 
178
set shell_prompt "Password:"
179
set shell_id [remote_open target]
180
 
181
if $shell_id<0 then {
182
    warning "Couldn't connect to target"
183
    return -1
184
}
185
 
186
if [string match "" $passwd] then {
187
    stty -echo
188
    send_user "Password: "
189
    expect_user -re "(.*)\n"
190
    send_user "\n"
191
    set passwd "$expect_out(1,string)"
192
    stty echo
193
}
194
 
195
send -i $shell_id "$passwd\n"
196
gdb_expect {
197
    -i $shell_id ":" {
198
        verbose "Got termtype prompt" 0
199
    }
200
 
201
    -i $shell_id timeout {
202
        warning "Connection timed out"
203
        return -1
204
    }
205
}
206
 
207
 
208
# FIXME: this is wrong.
209
set shell_prompt "[string toupper [target_info name]]:"
210
send -i $shell_id "1\n"
211
 
212
gdb_expect {
213
    -i $shell_id -re "$shell_prompt" {}
214
    -i $shell_id timeout {
215
        warning "Connection timed out"
216
        return -1
217
    }
218
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.