Commit | Line | Data |
---|---|---|
c906108c SS |
1 | # Test Framework Driver for GDB driving a builtin simulator |
2 | # Copyright 1994, 1997, 1998 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 | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | ||
18 | load_lib gdb.exp | |
19 | ||
20 | # | |
21 | # gdb_target_sim | |
22 | # Set gdb to target the simulator | |
23 | # | |
24 | proc gdb_target_sim { } { | |
25 | global gdb_prompt | |
26 | global exit_status | |
27 | ||
28 | set target_sim_options "[board_info target gdb,target_sim_options]"; | |
29 | ||
30 | send_gdb "target sim $target_sim_options\n" | |
31 | set timeout 60 | |
32 | verbose "Timeout is now $timeout seconds" 2 | |
33 | gdb_expect { | |
34 | -re "Connected to the simulator.*$gdb_prompt $" { | |
35 | verbose "Set target to sim" | |
36 | } | |
37 | timeout { | |
38 | perror "Couldn't set target for simulator." | |
39 | cleanup | |
40 | exit $exit_status | |
41 | } | |
42 | } | |
43 | set timeout 10 | |
44 | verbose "Timeout is now $timeout seconds" 2 | |
45 | } | |
46 | ||
47 | # | |
48 | # gdb_load -- load a file into the debugger. | |
49 | # return a -1 if anything goes wrong. | |
50 | # | |
51 | proc gdb_load { arg } { | |
52 | global verbose | |
53 | global loadpath | |
54 | global loadfile | |
55 | global GDB | |
56 | global gdb_prompt | |
57 | ||
58 | if [gdb_file_cmd $arg] then { return -1 } | |
59 | ||
60 | gdb_target_sim | |
61 | ||
62 | send_gdb "load\n" | |
63 | set timeout 2400 | |
64 | verbose "Timeout is now $timeout seconds" 2 | |
65 | gdb_expect { | |
66 | -re ".*$gdb_prompt $" { | |
67 | if $verbose>1 then { | |
68 | send_user "Loaded $arg into $GDB\n" | |
69 | } | |
70 | set timeout 30 | |
71 | verbose "Timeout is now $timeout seconds" 2 | |
72 | return 1 | |
73 | } | |
74 | -re "$gdb_prompt $" { | |
75 | if $verbose>1 then { | |
76 | perror "GDB couldn't load." | |
77 | } | |
78 | } | |
79 | timeout { | |
80 | if $verbose>1 then { | |
81 | perror "Timed out trying to load $arg." | |
82 | } | |
83 | } | |
84 | } | |
85 | } |