]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/config/sim.exp
Major revision to testsuites for cross-testing and DOS testing support.
[thirdparty/binutils-gdb.git] / gdb / testsuite / config / sim.exp
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
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17
18 load_lib gdb.exp
19
20 # The SH simulator by default will allocate 16M of memory, which is
21 # convenient, but it slows down testing to chew up that much swap;
22 # so supply an option that makes the simulator allocate 256K.
23
24 set target_sim_options ""
25
26 if [istarget "sh*-*-*"] then {
27 set target_sim_options "18"
28 }
29
30 #
31 # gdb_target_sim
32 # Set gdb to target the simulator
33 #
34 proc gdb_target_sim { } {
35 global prompt
36 global verbose
37 global exit_status
38 global target_sim_options
39 global gdb_spawn_id
40
41 set spawn_id $gdb_spawn_id
42 send_gdb "target sim $target_sim_options\n"
43 set timeout 60
44 verbose "Timeout is now $timeout seconds" 2
45 expect {
46 -re "Connected to the simulator.*$prompt $" {
47 verbose "Set target to sim"
48 }
49 timeout {
50 perror "Couldn't set target for simulator."
51 cleanup
52 exit $exit_status
53 }
54 }
55 set timeout 10
56 verbose "Timeout is now $timeout seconds" 2
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 global gdb_spawn_id
70
71 set spawn_id $gdb_spawn_id
72
73 if [gdb_file_cmd $arg] then { return -1 }
74
75 gdb_target_sim
76
77 send_gdb "load\n"
78 set timeout 2400
79 verbose "Timeout is now $timeout seconds" 2
80 expect {
81 -re ".*$prompt $" {
82 if $verbose>1 then {
83 send_user "Loaded $arg into $GDB\n"
84 }
85 set timeout 30
86 verbose "Timeout is now $timeout seconds" 2
87 return 1
88 }
89 -re "$prompt $" {
90 if $verbose>1 then {
91 perror "GDB couldn't load."
92 }
93 }
94 timeout {
95 if $verbose>1 then {
96 perror "Timed out trying to load $arg."
97 }
98 }
99 }
100 }