]>
Commit | Line | Data |
---|---|---|
c906108c | 1 | # Test Framework Driver for GDB driving a builtin simulator |
b811d2c2 | 2 | # Copyright 1994-2020 Free Software Foundation, Inc. |
c906108c SS |
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 | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
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. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | # |
18 | # gdb_target_sim | |
19 | # Set gdb to target the simulator | |
20 | # | |
21 | proc gdb_target_sim { } { | |
22 | global gdb_prompt | |
c906108c | 23 | |
4ec70201 | 24 | set target_sim_options "[board_info target gdb,target_sim_options]" |
c906108c SS |
25 | |
26 | send_gdb "target sim $target_sim_options\n" | |
13f2ed32 | 27 | gdb_expect 60 { |
c906108c SS |
28 | -re "Connected to the simulator.*$gdb_prompt $" { |
29 | verbose "Set target to sim" | |
30 | } | |
31 | timeout { | |
32 | perror "Couldn't set target for simulator." | |
b7b73cae | 33 | return -1 |
c906108c SS |
34 | } |
35 | } | |
b7b73cae | 36 | return 0 |
c906108c SS |
37 | } |
38 | ||
39 | # | |
40 | # gdb_load -- load a file into the debugger. | |
41 | # return a -1 if anything goes wrong. | |
42 | # | |
43 | proc gdb_load { arg } { | |
44 | global verbose | |
45 | global loadpath | |
46 | global loadfile | |
47 | global GDB | |
48 | global gdb_prompt | |
49 | ||
83f66e8f DJ |
50 | if { $arg != "" } { |
51 | if [gdb_file_cmd $arg] then { return -1 } | |
52 | } | |
c906108c | 53 | |
b7b73cae | 54 | if [gdb_target_sim] then { return -1 } |
c906108c SS |
55 | |
56 | send_gdb "load\n" | |
13f2ed32 | 57 | gdb_expect 2400 { |
c906108c SS |
58 | -re ".*$gdb_prompt $" { |
59 | if $verbose>1 then { | |
60 | send_user "Loaded $arg into $GDB\n" | |
61 | } | |
954269c2 | 62 | return 0 |
c906108c SS |
63 | } |
64 | -re "$gdb_prompt $" { | |
65 | if $verbose>1 then { | |
66 | perror "GDB couldn't load." | |
67 | } | |
68 | } | |
69 | timeout { | |
70 | if $verbose>1 then { | |
71 | perror "Timed out trying to load $arg." | |
72 | } | |
73 | } | |
74 | } | |
954269c2 | 75 | return -1 |
c906108c | 76 | } |