]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame_incremental - gdb/testsuite/config/sim.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / config / sim.exp
... / ...
CommitLineData
1# Test Framework Driver for GDB driving a builtin simulator
2# Copyright 1994-2020 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 3 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, see <http://www.gnu.org/licenses/>.
16
17#
18# gdb_target_sim
19# Set gdb to target the simulator
20#
21proc gdb_target_sim { } {
22 global gdb_prompt
23
24 set target_sim_options "[board_info target gdb,target_sim_options]"
25
26 send_gdb "target sim $target_sim_options\n"
27 gdb_expect 60 {
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."
33 return -1
34 }
35 }
36 return 0
37}
38
39#
40# gdb_load -- load a file into the debugger.
41# return a -1 if anything goes wrong.
42#
43proc gdb_load { arg } {
44 global verbose
45 global loadpath
46 global loadfile
47 global GDB
48 global gdb_prompt
49
50 if { $arg != "" } {
51 if [gdb_file_cmd $arg] then { return -1 }
52 }
53
54 if [gdb_target_sim] then { return -1 }
55
56 send_gdb "load\n"
57 gdb_expect 2400 {
58 -re ".*$gdb_prompt $" {
59 if $verbose>1 then {
60 send_user "Loaded $arg into $GDB\n"
61 }
62 return 0
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 }
75 return -1
76}