* config/udi-gdb.exp (gdb_load): Use "file", not "load" command,
[deliverable/binutils-gdb.git] / gdb / testsuite / config / udi-gdb.exp
CommitLineData
7a7d682b
JG
1# Test Framework Driver for GDB driving Universal Debug Interface on 29K
2# Copyright 1988, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3#
19fa4a0a
MW
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.
8#
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.
13#
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18# Please email any bugs, comments, and/or additions to this file to:
19# DejaGnu@cygnus.com
20
21# This file was written by Rob Savoye. (rob@cygnus.com)
22
23#
24# NOTE: these test assume that there is a udi_soc file in th
25#
26
27# these need to be initialized only if site.exp doesn't set them
28set prompt "\(gdb\)"
29
30if ![info exists prompt] then {
31 set prompt "\(gdb\)"
32}
33
41a85720 34load_lib gdb.exp
e4d30c7e 35load_lib udi.exp
41a85720 36
19fa4a0a
MW
37#
38# gdb_version -- extract and print the version number of gdb
39#
40proc gdb_version {} {
41a85720 41 default_gdb_version
19fa4a0a
MW
42}
43
44#
ebbed4c4
JK
45# gdb_load -- load a file into the debugger.
46# return a -1 if anything goes wrong.
19fa4a0a
MW
47#
48proc gdb_load { arg } {
49 global verbose
50 global loadpath
51 global loadfile
19fa4a0a 52 global GDB
ebbed4c4 53 global prompt
19fa4a0a 54
ebbed4c4 55 return [gdb_file_cmd $arg]
19fa4a0a
MW
56}
57
5f2912cc
ILT
58#
59# gdb_target_udi
60# Set gdb to the desired UDI target
61#
62proc gdb_target_udi { } {
63 global targetname
64 global prompt
65 global verbose
653ae28f 66 global exit_status
5f2912cc
ILT
67
68 # set targets hostname
69 send "target udi $targetname\n"
70 set timeout 60
71 expect {
41a85720
RS
72 -re "target udi $targetname\[\r\n\]+" {
73 continue -expect
74 }
5f2912cc 75 -re "TIP UDI 1.2 Conformant.*$prompt $" {
41a85720
RS
76 verbose "Set target to $targetname"
77 }
78 -re "TIP-ipc WARNING,.*failed:" {
79 warning "$expect_out(buffer)"
80 }
81 -re "TIP-ipc ERROR,.*failed:" {
82 error "$expect_out(buffer)"
5f2912cc
ILT
83 }
84 -re "A program is being debugged already. Kill it\? \(y or n\)" {
85 send "y\n"
86 continue -expect
87 }
88 timeout {
89 error "Couldn't set target for UDI."
653ae28f
FF
90 cleanup
91 exit $exit_status
5f2912cc
ILT
92 }
93 }
94 set timeout 10
19fa4a0a
MW
95}
96
97#
98# gdb_start -- start GDB running. This assumes that there the
99# UDICONF enviroment variable is set.
100#
101proc gdb_start { } {
102 global GDB
103 global GDBFLAGS
104 global spawn_id
105 global prompt
106 global verbose
19fa4a0a
MW
107
108 set GDB [which $GDB]
109 # start GDB
110 if [ llength $GDBFLAGS ] then {
111 spawn $GDB $GDBFLAGS
112 } else {
113 spawn $GDB
114 }
115 expect {
116 -re "GDB.*$prompt $" {
41a85720
RS
117 verbose "$GDB initialized for cross mode\n"
118 }
119 -re "$prompt $" {
120 error "GDB never initialized."
121 return -1
122 }
123 timeout {
124 error "(timeout) GDB never initialized."
125 return -1
19fa4a0a 126 }
19fa4a0a
MW
127 }
128
129 # force the height to "unlimited", so no pagers get used
130 send "set height 0\n"
131 expect -re ".*$prompt $" {}
132 # force the width to "unlimited", so no wraparound occurs
133 send "set width 0\n"
134 expect -re ".*$prompt $" {}
19fa4a0a 135
41a85720 136 verbose "Setting up target, Please wait..."
5f2912cc
ILT
137
138 gdb_target_udi
19fa4a0a
MW
139}
140
41a85720
RS
141#
142# gdb_exit -- exit gdb
143#
144proc gdb_exit { } {
145 slay isstip
146 catch default_gdb_exit
147 set in [open [concat "|ls -F"] r]
148 while {[gets $in line]>-1} {
149 if [regexp "=$" $line] then {
150 set line [string trimright $line "="]
151 verbose "Removing the $line named socket"
152 exec rm -f $line
153 }
154 }
155 close $in
19fa4a0a
MW
156}
157
19fa4a0a
MW
158gdb_start
159
160# make sure gdb has actually started, otherwise if the first test
161# timesout, DejaGnu crashes
162send "\n"
163expect {
164 -re "$prompt"
165 }
This page took 0.111258 seconds and 4 git commands to generate.