]>
Commit | Line | Data |
---|---|---|
7a7d682b | 1 | # Test Framework Driver for GDB driving Universal Debug Interface on 29K |
fa5864d5 | 2 | # Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1997 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 | |
fa5864d5 | 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 | ||
41a85720 | 23 | load_lib gdb.exp |
19fa4a0a | 24 | |
5f2912cc ILT |
25 | # |
26 | # gdb_target_udi | |
27 | # Set gdb to the desired UDI target | |
28 | # | |
29 | proc gdb_target_udi { } { | |
85fbaa74 | 30 | global gdb_prompt |
5f2912cc | 31 | global verbose |
653ae28f | 32 | global exit_status |
5f2912cc | 33 | |
76abb184 | 34 | set targetname [target_info mondfe,name]; |
5f2912cc | 35 | # set targets hostname |
40ac1624 | 36 | send_gdb "target udi $targetname\n" |
5f2912cc | 37 | set timeout 60 |
a26fa899 | 38 | verbose "Timeout is now $timeout seconds" 2 |
40ac1624 | 39 | gdb_expect { |
41a85720 | 40 | -re "target udi $targetname\[\r\n\]+" { |
32a1239c | 41 | exp_continue |
41a85720 | 42 | } |
85fbaa74 | 43 | -re "TIP UDI 1.2 Conformant.*$gdb_prompt $" { |
41a85720 RS |
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:" { | |
8f07e537 | 50 | perror "$expect_out(buffer)" |
5f2912cc ILT |
51 | } |
52 | -re "A program is being debugged already. Kill it\? \(y or n\)" { | |
53 | send "y\n" | |
32a1239c | 54 | exp_continue |
5f2912cc ILT |
55 | } |
56 | timeout { | |
8f07e537 | 57 | perror "Couldn't set target for UDI." |
653ae28f FF |
58 | cleanup |
59 | exit $exit_status | |
5f2912cc ILT |
60 | } |
61 | } | |
62 | set timeout 10 | |
a26fa899 | 63 | verbose "Timeout is now $timeout seconds" 2 |
19fa4a0a MW |
64 | } |
65 | ||
2558ba5d JK |
66 | # |
67 | # gdb_load -- load a file into the debugger. | |
68 | # return a -1 if anything goes wrong. | |
69 | # | |
787f6220 | 70 | |
2558ba5d JK |
71 | proc gdb_load { arg } { |
72 | global verbose | |
73 | global loadpath | |
74 | global loadfile | |
75 | global GDB | |
85fbaa74 | 76 | global gdb_prompt |
2558ba5d | 77 | |
787f6220 BM |
78 | if [gdb_file_cmd $arg] { |
79 | return -1 | |
80 | } | |
2558ba5d JK |
81 | |
82 | gdb_target_udi | |
83 | } | |
84 | ||
90fba5fa BC |
85 | # |
86 | # gdb_start -- start GDB running. This assumes that there the | |
87 | # UDICONF enviroment variable is set. | |
88 | # | |
19fa4a0a | 89 | proc gdb_start { } { |
4d400231 BM |
90 | global env; |
91 | ||
92 | set env(UDICONF) [target_info mondfe,udi_soc]; | |
0fba9aa2 | 93 | default_gdb_start |
41a85720 | 94 | verbose "Setting up target, Please wait..." |
5f2912cc | 95 | gdb_target_udi |
19fa4a0a MW |
96 | } |
97 | ||
41a85720 RS |
98 | # |
99 | # gdb_exit -- exit gdb | |
100 | # | |
101 | proc gdb_exit { } { | |
41a85720 RS |
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 | |
19fa4a0a | 112 | } |