]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/config/udi.exp
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / testsuite / config / udi.exp
1 # Test Framework Driver for GDB driving Universal Debug Interface on 29K
2 # Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
3 #
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 load_lib gdb.exp
24
25 #
26 # gdb_target_udi
27 # Set gdb to the desired UDI target
28 #
29 proc gdb_target_udi { } {
30 global gdb_prompt
31 global verbose
32 global exit_status
33
34 set targetname [target_info mondfe,name];
35 # set targets hostname
36 send_gdb "target udi $targetname\n"
37 set timeout 60
38 verbose "Timeout is now $timeout seconds" 2
39 gdb_expect {
40 -re "target udi $targetname\[\r\n\]+" {
41 exp_continue
42 }
43 -re "TIP UDI 1.2 Conformant.*$gdb_prompt $" {
44 verbose "Set target to $targetname"
45 }
46 -re "TIP-ipc WARNING,.*failed:" {
47 warning "$expect_out(buffer)"
48 }
49 -re "TIP-ipc ERROR,.*failed:" {
50 perror "$expect_out(buffer)"
51 }
52 -re "A program is being debugged already. Kill it\? \(y or n\)" {
53 send "y\n"
54 exp_continue
55 }
56 timeout {
57 perror "Couldn't set target for UDI."
58 cleanup
59 exit $exit_status
60 }
61 }
62 set timeout 10
63 verbose "Timeout is now $timeout seconds" 2
64 }
65
66 #
67 # gdb_load -- load a file into the debugger.
68 # return a -1 if anything goes wrong.
69 #
70
71 proc gdb_load { arg } {
72 global verbose
73 global loadpath
74 global loadfile
75 global GDB
76 global gdb_prompt
77
78 if [gdb_file_cmd $arg] {
79 return -1
80 }
81
82 gdb_target_udi
83 }
84
85 #
86 # gdb_start -- start GDB running. This assumes that there the
87 # UDICONF enviroment variable is set.
88 #
89 proc gdb_start { } {
90 global env;
91
92 set env(UDICONF) [target_info mondfe,udi_soc];
93 default_gdb_start
94 verbose "Setting up target, Please wait..."
95 gdb_target_udi
96 }
97
98 #
99 # gdb_exit -- exit gdb
100 #
101 proc gdb_exit { } {
102 catch default_gdb_exit
103 set in [open [concat "|ls -F"] r]
104 while {[gets $in line]>-1} {
105 if [regexp "=$" $line] then {
106 set line [string trimright $line "="]
107 verbose "Removing the $line named socket"
108 exec rm -f $line
109 }
110 }
111 close $in
112 }