2004-02-07 Elena Zannoni <ezannoni@redhat.com>
[deliverable/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
3 # Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 # This file was written by Rob Savoye. (rob@cygnus.com)
20
21 load_lib gdb.exp
22
23 #
24 # gdb_target_udi
25 # Set gdb to the desired UDI target
26 #
27 proc gdb_target_udi { } {
28 global gdb_prompt
29 global verbose
30 global exit_status
31
32 set targetname [target_info mondfe,name];
33 # set targets hostname
34 send_gdb "target udi $targetname\n"
35 set timeout 60
36 verbose "Timeout is now $timeout seconds" 2
37 gdb_expect {
38 -re "target udi $targetname\[\r\n\]+" {
39 exp_continue
40 }
41 -re "TIP UDI 1.2 Conformant.*$gdb_prompt $" {
42 verbose "Set target to $targetname"
43 }
44 -re "TIP-ipc WARNING,.*failed:" {
45 warning "$expect_out(buffer)"
46 }
47 -re "TIP-ipc ERROR,.*failed:" {
48 perror "$expect_out(buffer)"
49 }
50 -re "A program is being debugged already. Kill it\? \(y or n\)" {
51 send "y\n"
52 exp_continue
53 }
54 timeout {
55 perror "Couldn't set target for UDI."
56 cleanup
57 exit $exit_status
58 }
59 }
60 set timeout 10
61 verbose "Timeout is now $timeout seconds" 2
62 }
63
64 #
65 # gdb_load -- load a file into the debugger.
66 # return a -1 if anything goes wrong.
67 #
68
69 proc gdb_load { arg } {
70 global verbose
71 global loadpath
72 global loadfile
73 global GDB
74 global gdb_prompt
75
76 if [gdb_file_cmd $arg] {
77 return -1
78 }
79
80 gdb_target_udi
81 }
82
83 #
84 # gdb_start -- start GDB running. This assumes that there the
85 # UDICONF enviroment variable is set.
86 #
87 proc gdb_start { } {
88 global env;
89
90 set env(UDICONF) [target_info mondfe,udi_soc];
91 default_gdb_start
92 verbose "Setting up target, Please wait..."
93 gdb_target_udi
94 }
95
96 #
97 # gdb_exit -- exit gdb
98 #
99 proc gdb_exit { } {
100 catch default_gdb_exit
101 set in [open [concat "|ls -F"] r]
102 while {[gets $in line]>-1} {
103 if [regexp "=$" $line] then {
104 set line [string trimright $line "="]
105 verbose "Removing the $line named socket"
106 exec rm -f $line
107 }
108 }
109 close $in
110 }
This page took 0.03807 seconds and 4 git commands to generate.