*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / testsuite / config / sim.exp
CommitLineData
8ef36cf3 1# Test Framework Driver for GDB driving a builtin simulator
7ec482ba 2# Copyright 1994, 1997, 1998 Free Software Foundation, Inc.
8ef36cf3
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
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
7ec482ba 16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
8ef36cf3
SS
17
18load_lib gdb.exp
19
ec6239dc
SS
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
24set target_sim_options ""
25
26if [istarget "sh*-*-*"] then {
27 set target_sim_options "18"
28}
29
7ec482ba
MA
30# The ERC32 simulator requires the argument -sparclite in order
31# to emulate sparclite-specific instructions.
32
33if [istarget "sparclite*-*-*"] then {
34 set target_sim_options "-sparclite"
35}
36if [istarget "sparc86x*-*-*"] then {
37 set target_sim_options "-sparclite"
38}
39
8ef36cf3
SS
40#
41# gdb_target_sim
42# Set gdb to target the simulator
43#
44proc gdb_target_sim { } {
7ec482ba 45 global gdb_prompt
8ef36cf3
SS
46 global verbose
47 global exit_status
ec6239dc 48 global target_sim_options
8ef36cf3 49
787f6220 50 send_gdb "target sim $target_sim_options\n"
8ef36cf3 51 set timeout 60
a26fa899 52 verbose "Timeout is now $timeout seconds" 2
7ec482ba
MA
53 gdb_expect {
54 -re "Connected to the simulator.*$gdb_prompt $" {
8ef36cf3
SS
55 verbose "Set target to sim"
56 }
57 timeout {
58 perror "Couldn't set target for simulator."
59 cleanup
60 exit $exit_status
61 }
62 }
63 set timeout 10
a26fa899 64 verbose "Timeout is now $timeout seconds" 2
8ef36cf3
SS
65}
66
67#
68# gdb_load -- load a file into the debugger.
69# return a -1 if anything goes wrong.
70#
71proc gdb_load { arg } {
72 global verbose
73 global loadpath
74 global loadfile
75 global GDB
7ec482ba 76 global gdb_prompt
8ef36cf3
SS
77
78 if [gdb_file_cmd $arg] then { return -1 }
79
80 gdb_target_sim
81
787f6220 82 send_gdb "load\n"
8ef36cf3 83 set timeout 2400
a26fa899 84 verbose "Timeout is now $timeout seconds" 2
7ec482ba
MA
85 gdb_expect {
86 -re ".*$gdb_prompt $" {
8ef36cf3
SS
87 if $verbose>1 then {
88 send_user "Loaded $arg into $GDB\n"
89 }
90 set timeout 30
a26fa899 91 verbose "Timeout is now $timeout seconds" 2
8ef36cf3
SS
92 return 1
93 }
7ec482ba 94 -re "$gdb_prompt $" {
8ef36cf3 95 if $verbose>1 then {
a26fa899 96 perror "GDB couldn't load."
8ef36cf3
SS
97 }
98 }
99 timeout {
100 if $verbose>1 then {
a26fa899 101 perror "Timed out trying to load $arg."
8ef36cf3
SS
102 }
103 }
104 }
105}
This page took 0.209989 seconds and 4 git commands to generate.