]>
Commit | Line | Data |
---|---|---|
7a7d682b | 1 | # Test Framework Driver for GDB driving Universal Debug Interface on 29K |
0fba9aa2 | 2 | # Copyright 1988, 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. |
7a7d682b | 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 | |
6c9638b4 | 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
19fa4a0a MW |
17 | |
18 | # Please email any bugs, comments, and/or additions to this file to: | |
19 | # [email protected] | |
20 | ||
21 | # This file was written by Rob Savoye. ([email protected]) | |
22 | ||
23 | # | |
24 | # NOTE: these test assume that there is a udi_soc file in th | |
25 | # | |
26 | ||
41a85720 | 27 | load_lib gdb.exp |
e4d30c7e | 28 | load_lib udi.exp |
41a85720 | 29 | |
19fa4a0a MW |
30 | # |
31 | # gdb_version -- extract and print the version number of gdb | |
32 | # | |
33 | proc gdb_version {} { | |
41a85720 | 34 | default_gdb_version |
19fa4a0a MW |
35 | } |
36 | ||
5f2912cc ILT |
37 | # |
38 | # gdb_target_udi | |
39 | # Set gdb to the desired UDI target | |
40 | # | |
41 | proc gdb_target_udi { } { | |
42 | global targetname | |
43 | global prompt | |
44 | global verbose | |
653ae28f | 45 | global exit_status |
5f2912cc ILT |
46 | |
47 | # set targets hostname | |
48 | send "target udi $targetname\n" | |
49 | set timeout 60 | |
50 | expect { | |
41a85720 | 51 | -re "target udi $targetname\[\r\n\]+" { |
32a1239c | 52 | exp_continue |
41a85720 | 53 | } |
5f2912cc | 54 | -re "TIP UDI 1.2 Conformant.*$prompt $" { |
41a85720 RS |
55 | verbose "Set target to $targetname" |
56 | } | |
57 | -re "TIP-ipc WARNING,.*failed:" { | |
58 | warning "$expect_out(buffer)" | |
59 | } | |
60 | -re "TIP-ipc ERROR,.*failed:" { | |
8f07e537 | 61 | perror "$expect_out(buffer)" |
5f2912cc ILT |
62 | } |
63 | -re "A program is being debugged already. Kill it\? \(y or n\)" { | |
64 | send "y\n" | |
32a1239c | 65 | exp_continue |
5f2912cc ILT |
66 | } |
67 | timeout { | |
8f07e537 | 68 | perror "Couldn't set target for UDI." |
653ae28f FF |
69 | cleanup |
70 | exit $exit_status | |
5f2912cc ILT |
71 | } |
72 | } | |
73 | set timeout 10 | |
19fa4a0a MW |
74 | } |
75 | ||
2558ba5d JK |
76 | # |
77 | # gdb_load -- load a file into the debugger. | |
78 | # return a -1 if anything goes wrong. | |
79 | # | |
80 | proc gdb_load { arg } { | |
81 | global verbose | |
82 | global loadpath | |
83 | global loadfile | |
84 | global GDB | |
85 | global prompt | |
86 | ||
87 | if [gdb_file_cmd $arg] then { return -1 } | |
88 | ||
89 | gdb_target_udi | |
90 | } | |
91 | ||
90fba5fa BC |
92 | # |
93 | # gdb_start -- start GDB running. This assumes that there the | |
94 | # UDICONF enviroment variable is set. | |
95 | # | |
19fa4a0a | 96 | proc gdb_start { } { |
0fba9aa2 | 97 | default_gdb_start |
41a85720 | 98 | verbose "Setting up target, Please wait..." |
5f2912cc | 99 | gdb_target_udi |
19fa4a0a MW |
100 | } |
101 | ||
41a85720 RS |
102 | # |
103 | # gdb_exit -- exit gdb | |
104 | # | |
105 | proc gdb_exit { } { | |
106 | slay isstip | |
107 | catch default_gdb_exit | |
108 | set in [open [concat "|ls -F"] r] | |
109 | while {[gets $in line]>-1} { | |
110 | if [regexp "=$" $line] then { | |
111 | set line [string trimright $line "="] | |
112 | verbose "Removing the $line named socket" | |
113 | exec rm -f $line | |
114 | } | |
115 | } | |
116 | close $in | |
19fa4a0a MW |
117 | } |
118 | ||
19fa4a0a MW |
119 | gdb_start |
120 | ||
121 | # make sure gdb has actually started, otherwise if the first test | |
122 | # timesout, DejaGnu crashes | |
123 | send "\n" | |
124 | expect { | |
125 | -re "$prompt" | |
126 | } |