gdb/testsuite/sim: Remove redundant setting of timeout
[deliverable/binutils-gdb.git] / gdb / testsuite / config / sim.exp
1 # Test Framework Driver for GDB driving a builtin simulator
2 # Copyright 1994-2018 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 load_lib gdb.exp
18
19 #
20 # gdb_target_sim
21 # Set gdb to target the simulator
22 #
23 proc gdb_target_sim { } {
24 global gdb_prompt
25
26 set target_sim_options "[board_info target gdb,target_sim_options]"
27
28 send_gdb "target sim $target_sim_options\n"
29 gdb_expect 60 {
30 -re "Connected to the simulator.*$gdb_prompt $" {
31 verbose "Set target to sim"
32 }
33 timeout {
34 perror "Couldn't set target for simulator."
35 return -1
36 }
37 }
38 return 0
39 }
40
41 #
42 # gdb_load -- load a file into the debugger.
43 # return a -1 if anything goes wrong.
44 #
45 proc gdb_load { arg } {
46 global verbose
47 global loadpath
48 global loadfile
49 global GDB
50 global gdb_prompt
51
52 if { $arg != "" } {
53 if [gdb_file_cmd $arg] then { return -1 }
54 }
55
56 if [gdb_target_sim] then { return -1 }
57
58 send_gdb "load\n"
59 gdb_expect 2400 {
60 -re ".*$gdb_prompt $" {
61 if $verbose>1 then {
62 send_user "Loaded $arg into $GDB\n"
63 }
64 return 0
65 }
66 -re "$gdb_prompt $" {
67 if $verbose>1 then {
68 perror "GDB couldn't load."
69 }
70 }
71 timeout {
72 if $verbose>1 then {
73 perror "Timed out trying to load $arg."
74 }
75 }
76 }
77 return -1
78 }
This page took 0.032479 seconds and 4 git commands to generate.