Commit | Line | Data |
---|---|---|
8ef36cf3 SS |
1 | # Test Framework Driver for GDB driving a builtin simulator |
2 | # Copyright 1994 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 | |
6c9638b4 | 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
8ef36cf3 SS |
17 | |
18 | load_lib gdb.exp | |
19 | ||
20 | # | |
21 | # gdb_version -- extract and print the version number of gdb | |
22 | # | |
23 | proc gdb_version {} { | |
24 | default_gdb_version | |
25 | } | |
26 | ||
27 | # | |
28 | # gdb_target_sim | |
29 | # Set gdb to target the simulator | |
30 | # | |
31 | proc gdb_target_sim { } { | |
32 | global targetname | |
33 | global prompt | |
34 | global verbose | |
35 | global exit_status | |
36 | ||
37 | # force the height to "unlimited", so no pagers get used | |
38 | send "set height 0\n" | |
39 | expect -re ".*$prompt $" {} | |
40 | # force the width to "unlimited", so no wraparound occurs | |
41 | send "set width 0\n" | |
42 | expect -re ".*$prompt $" {} | |
43 | ||
44 | send "target sim\n" | |
45 | set timeout 60 | |
46 | expect { | |
47 | -re "Connected to the simulator.*$prompt $" { | |
48 | verbose "Set target to sim" | |
49 | } | |
50 | timeout { | |
51 | perror "Couldn't set target for simulator." | |
52 | cleanup | |
53 | exit $exit_status | |
54 | } | |
55 | } | |
56 | set timeout 10 | |
57 | } | |
58 | ||
59 | # | |
60 | # gdb_load -- load a file into the debugger. | |
61 | # return a -1 if anything goes wrong. | |
62 | # | |
63 | proc gdb_load { arg } { | |
64 | global verbose | |
65 | global loadpath | |
66 | global loadfile | |
67 | global GDB | |
68 | global prompt | |
69 | ||
70 | if [gdb_file_cmd $arg] then { return -1 } | |
71 | ||
72 | gdb_target_sim | |
73 | ||
74 | send "load\n" | |
75 | set timeout 2400 | |
76 | expect { | |
77 | -re ".*$prompt $" { | |
78 | if $verbose>1 then { | |
79 | send_user "Loaded $arg into $GDB\n" | |
80 | } | |
81 | set timeout 30 | |
82 | return 1 | |
83 | } | |
84 | -re "$prompt $" { | |
85 | if $verbose>1 then { | |
86 | perror "GDB couldn't load." | |
87 | } | |
88 | } | |
89 | timeout { | |
90 | if $verbose>1 then { | |
91 | perror "Timed out trying to load $arg." | |
92 | } | |
93 | } | |
94 | } | |
95 | } | |
96 | ||
97 | # | |
98 | # gdb_start -- start GDB running. | |
99 | # | |
100 | proc gdb_start { } { | |
101 | default_gdb_start | |
102 | verbose "Setting up target, Please wait..." | |
103 | gdb_target_sim | |
104 | } | |
105 | ||
106 | # | |
107 | # gdb_exit -- exit gdb | |
108 | # | |
109 | proc gdb_exit { } { | |
110 | catch default_gdb_exit | |
111 | } | |
112 | ||
113 | gdb_start | |
114 | ||
115 | # make sure gdb has actually started, otherwise if the first test | |
116 | # timesout, DejaGnu crashes | |
117 | send "\n" | |
118 | expect { | |
119 | -re "$prompt" | |
120 | } |