* config/slite-gdb.exp (gdb_start): Use "full_buffer", not
[deliverable/binutils-gdb.git] / gdb / testsuite / config / sim-gdb.exp
CommitLineData
8ef36cf3
SS
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
6c9638b4 16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
8ef36cf3
SS
17
18load_lib gdb.exp
19
20#
21# gdb_version -- extract and print the version number of gdb
22#
23proc gdb_version {} {
24 default_gdb_version
25}
26
ec6239dc
SS
27# The SH simulator by default will allocate 16M of memory, which is
28# convenient, but it slows down testing to chew up that much swap;
29# so supply an option that makes the simulator allocate 256K.
30
31set target_sim_options ""
32
33if [istarget "sh*-*-*"] then {
34 set target_sim_options "18"
35}
36
8ef36cf3
SS
37#
38# gdb_target_sim
39# Set gdb to target the simulator
40#
41proc gdb_target_sim { } {
42 global targetname
43 global prompt
44 global verbose
45 global exit_status
ec6239dc 46 global target_sim_options
8ef36cf3
SS
47
48 # force the height to "unlimited", so no pagers get used
49 send "set height 0\n"
50 expect -re ".*$prompt $" {}
51 # force the width to "unlimited", so no wraparound occurs
52 send "set width 0\n"
53 expect -re ".*$prompt $" {}
54
ec6239dc 55 send "target sim $target_sim_options\n"
8ef36cf3 56 set timeout 60
a26fa899 57 verbose "Timeout is now $timeout seconds" 2
8ef36cf3
SS
58 expect {
59 -re "Connected to the simulator.*$prompt $" {
60 verbose "Set target to sim"
61 }
62 timeout {
63 perror "Couldn't set target for simulator."
64 cleanup
65 exit $exit_status
66 }
67 }
68 set timeout 10
a26fa899 69 verbose "Timeout is now $timeout seconds" 2
8ef36cf3
SS
70}
71
72#
73# gdb_load -- load a file into the debugger.
74# return a -1 if anything goes wrong.
75#
76proc gdb_load { arg } {
77 global verbose
78 global loadpath
79 global loadfile
80 global GDB
81 global prompt
82
83 if [gdb_file_cmd $arg] then { return -1 }
84
85 gdb_target_sim
86
87 send "load\n"
88 set timeout 2400
a26fa899 89 verbose "Timeout is now $timeout seconds" 2
8ef36cf3
SS
90 expect {
91 -re ".*$prompt $" {
92 if $verbose>1 then {
93 send_user "Loaded $arg into $GDB\n"
94 }
95 set timeout 30
a26fa899 96 verbose "Timeout is now $timeout seconds" 2
8ef36cf3
SS
97 return 1
98 }
99 -re "$prompt $" {
100 if $verbose>1 then {
a26fa899 101 perror "GDB couldn't load."
8ef36cf3
SS
102 }
103 }
104 timeout {
105 if $verbose>1 then {
a26fa899 106 perror "Timed out trying to load $arg."
8ef36cf3
SS
107 }
108 }
109 }
110}
111
112#
113# gdb_start -- start GDB running.
114#
115proc gdb_start { } {
116 default_gdb_start
117 verbose "Setting up target, Please wait..."
118 gdb_target_sim
119}
120
121#
122# gdb_exit -- exit gdb
123#
124proc gdb_exit { } {
125 catch default_gdb_exit
126}
127
128gdb_start
129
130# make sure gdb has actually started, otherwise if the first test
131# timesout, DejaGnu crashes
132send "\n"
133expect {
134 -re "$prompt"
135 }
This page took 0.10144 seconds and 4 git commands to generate.