]>
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 | |
a26fa899 | 50 | verbose "Timeout is now $timeout seconds" 2 |
5f2912cc | 51 | expect { |
41a85720 | 52 | -re "target udi $targetname\[\r\n\]+" { |
32a1239c | 53 | exp_continue |
41a85720 | 54 | } |
5f2912cc | 55 | -re "TIP UDI 1.2 Conformant.*$prompt $" { |
41a85720 RS |
56 | verbose "Set target to $targetname" |
57 | } | |
58 | -re "TIP-ipc WARNING,.*failed:" { | |
59 | warning "$expect_out(buffer)" | |
60 | } | |
61 | -re "TIP-ipc ERROR,.*failed:" { | |
8f07e537 | 62 | perror "$expect_out(buffer)" |
5f2912cc ILT |
63 | } |
64 | -re "A program is being debugged already. Kill it\? \(y or n\)" { | |
65 | send "y\n" | |
32a1239c | 66 | exp_continue |
5f2912cc ILT |
67 | } |
68 | timeout { | |
8f07e537 | 69 | perror "Couldn't set target for UDI." |
653ae28f FF |
70 | cleanup |
71 | exit $exit_status | |
5f2912cc ILT |
72 | } |
73 | } | |
74 | set timeout 10 | |
a26fa899 | 75 | verbose "Timeout is now $timeout seconds" 2 |
19fa4a0a MW |
76 | } |
77 | ||
2558ba5d JK |
78 | # |
79 | # gdb_load -- load a file into the debugger. | |
80 | # return a -1 if anything goes wrong. | |
81 | # | |
82 | proc gdb_load { arg } { | |
83 | global verbose | |
84 | global loadpath | |
85 | global loadfile | |
86 | global GDB | |
87 | global prompt | |
88 | ||
89 | if [gdb_file_cmd $arg] then { return -1 } | |
90 | ||
91 | gdb_target_udi | |
92 | } | |
93 | ||
90fba5fa BC |
94 | # |
95 | # gdb_start -- start GDB running. This assumes that there the | |
96 | # UDICONF enviroment variable is set. | |
97 | # | |
19fa4a0a | 98 | proc gdb_start { } { |
0fba9aa2 | 99 | default_gdb_start |
41a85720 | 100 | verbose "Setting up target, Please wait..." |
5f2912cc | 101 | gdb_target_udi |
19fa4a0a MW |
102 | } |
103 | ||
41a85720 RS |
104 | # |
105 | # gdb_exit -- exit gdb | |
106 | # | |
107 | proc gdb_exit { } { | |
108 | slay isstip | |
109 | catch default_gdb_exit | |
110 | set in [open [concat "|ls -F"] r] | |
111 | while {[gets $in line]>-1} { | |
112 | if [regexp "=$" $line] then { | |
113 | set line [string trimright $line "="] | |
114 | verbose "Removing the $line named socket" | |
115 | exec rm -f $line | |
116 | } | |
117 | } | |
118 | close $in | |
19fa4a0a MW |
119 | } |
120 | ||
19fa4a0a MW |
121 | gdb_start |
122 | ||
123 | # make sure gdb has actually started, otherwise if the first test | |
124 | # timesout, DejaGnu crashes | |
125 | send "\n" | |
126 | expect { | |
127 | -re "$prompt" | |
128 | } |