1 # Test Framework Driver for GDB driving Universal Debug Interface on 29K
2 # Copyright 1988, 1990, 1991, 1992, 1993 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
18 # Please email any bugs, comments, and/or additions to this file to:
24 # NOTE: these test assume that there is a udi_soc file in th
27 # these need to be initialized only if site.exp doesn't set them
30 if ![info exists prompt] then {
37 # gdb_version -- extract and print the version number of gdb
44 # gdb_load -- load a file into the GDB.
45 # Returns a 0 if there was an error,
46 # 1 if it load successfully.
48 proc gdb_load { arg } {
58 verbose "Loading $arg into $GDB"
60 -re "Loading.*\.text.*\.data.*\.bss.*Reading symbols from $arg.+done.*$prompt $" {
61 verbose "Loaded $arg into $GDB"
65 error "Couldn't load $arg into $GDB."
69 error "Timed out trying to load $arg."
73 if [info exists expect_out(buffer)] then {
74 send_log $expect_out(buffer)
81 # Set gdb to the desired UDI target
83 proc gdb_target_udi { } {
89 # set targets hostname
90 send "target udi $targetname\n"
93 -re "target udi $targetname\[\r\n\]+" {
96 -re "TIP UDI 1.2 Conformant.*$prompt $" {
97 verbose "Set target to $targetname"
99 -re "TIP-ipc WARNING,.*failed:" {
100 warning "$expect_out(buffer)"
102 -re "TIP-ipc ERROR,.*failed:" {
103 error "$expect_out(buffer)"
105 -re "A program is being debugged already. Kill it\? \(y or n\)" {
110 error "Couldn't set target for UDI."
119 # gdb_start -- start GDB running. This assumes that there the
120 # UDICONF enviroment variable is set.
131 if [ llength $GDBFLAGS ] then {
137 -re "GDB.*$prompt $" {
138 verbose "$GDB initialized for cross mode\n"
141 error "GDB never initialized."
145 error "(timeout) GDB never initialized."
150 # force the height to "unlimited", so no pagers get used
151 send "set height 0\n"
152 expect -re ".*$prompt $" {}
153 # force the width to "unlimited", so no wraparound occurs
155 expect -re ".*$prompt $" {}
156 # set the default arguments to "main", so that "run" with no
157 # arguments will work correctly.
158 send "set args main\n"
159 expect -re ".*$prompt $" {}
161 verbose "Setting up target, Please wait..."
167 # gdb_exit -- exit gdb
171 catch default_gdb_exit
172 set in [open [concat "|ls -F"] r]
173 while {[gets $in line]>-1} {
174 if [regexp "=$" $line] then {
175 set line [string trimright $line "="]
176 verbose "Removing the $line named socket"
185 # make sure gdb has actually started, otherwise if the first test
186 # timesout, DejaGnu crashes