Remove superfluous semicolons from testsuite throughout.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / setshow.exp
1 # Copyright 1992-2013 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # This file was written by Michael Snyder (msnyder@cygnus.com)
17
18
19 set testfile "setshow"
20 set srcfile ${testfile}.c
21 set binfile ${objdir}/${subdir}/${testfile}
22 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
23 untested setshow.exp
24 return -1
25 }
26
27 # Start with a fresh gdb
28
29 gdb_exit
30 gdb_start
31 gdb_reinitialize_dir $srcdir/$subdir
32 gdb_load ${binfile}
33
34 # make sure $pc is sane, in case we're talking to a board.
35 if { ![runto_main] } {
36 gdb_suppress_tests
37 }
38
39 #
40 # Test gdb set and show commands.
41 # Add tests here for show and set that don't fit neatly elsewhere.
42 # FIXME: many rudimentary tests for set and show commands have been
43 # added below, but most do nothing more than check that a
44 # variable has been set successfully, ie. they do not test
45 # whether setting the variable has had the desired effect.
46 #
47
48 #test default annotation_level is 0
49 gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level is zero"
50
51 #test set annotate 2
52
53 # Here we need to fiddle with prompts.
54 set old_gdb_prompt $gdb_prompt
55 set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
56
57 gdb_test_multiple "set annotate 2" "set annotate 2" {
58 -re "\r\n$gdb_prompt$" {
59 pass "set annotate 2"
60 }
61 }
62
63 gdb_test_multiple "show annotate" "show annotate 2" {
64 -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" {
65 pass "show annotate 2"
66 }
67 }
68
69 #test annotation_level 2
70 gdb_test_multiple "info line 1" "annotation_level 2" {
71 -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" {
72 pass "annotation_level 2"
73 }
74 }
75
76 # Restore the original prompt for the rest of the testsuite.
77 set gdb_prompt $old_gdb_prompt
78
79 #test set annotate 1
80 gdb_test "set annotate 1" ".*post-prompt.*" "set annotate 1"
81 gdb_test "show annotate" "Annotation_level is 1..*" "show annotate (1)"
82 #test annotation_level 1
83 gdb_test "info line 1" "Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*" "annotation_level 1"
84 #test set annotate 0
85 gdb_test_no_output "set annotate 0" "set annotate 0"
86 gdb_test "show annotate" "Annotation_level is 0..*" "show annotate (0)"
87 #test annotation_level 0
88 gdb_test "info line 1" "Line 1 of .* is at address .* but contains no code.*" "annotation_level 0"
89
90 gdb_test_no_output "set args ~"
91 gdb_test "show args" "Argument list to give program being debugged when it is started is \"~\"..*" \
92 "show args ~"
93 #test set args
94 gdb_test_no_output "set args foo bar blup baz bubble" "set args"
95 #test show args
96 gdb_test "show args" "Argument list to give program being debugged when it is started is \"foo bar blup baz bubble\"..*" "show args"
97
98 # Don't test if we can't pass args or if we're using a stub.
99 if { !$use_gdb_stub && ![target_info exists noargs] } {
100 #test passing args
101 gdb_test "cont" "Continuing.*" "continuing"
102 delete_breakpoints
103 gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
104 }
105 #test set check range on
106 gdb_test "set check range on" ".*" "set check range on"
107 #test show check range on
108 gdb_test "show check range" "Range checking is \"on\"\..*" "show check range (on)"
109 #test set check range off with trailing space
110 gdb_test_no_output "set check range off " "set check range off"
111 #test show check range off
112 gdb_test "show check range" "Range checking is \"off\"\..*" "show check range (off)"
113 #test set check range auto
114 gdb_test_no_output "set check range auto" "set check range auto"
115 #test show check range auto
116 gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)"
117
118 # Test set check type on
119 gdb_test "set check type on" ".*" "set check type on"
120
121 # Test show check type on
122 gdb_test "show check type" "Strict type checking is on\..*" \
123 "show check type (on)"
124
125 # Test set check type off with trailing space
126 gdb_test_no_output "set check type off " "set check type off"
127
128 # Test show check type off
129 gdb_test "show check type" "Strict type checking is off\..*" \
130 "show check type (off)"
131
132 #test set complaints 100
133 gdb_test_no_output "set complaints 100" "set complaints 100"
134 #test show complaints 100
135 gdb_test "show complaints" "Max number of complaints about incorrect symbols is 100..*" "show complaints (100)"
136 #test set complaints 0
137 gdb_test_no_output "set complaints 0" "set complaints 0"
138 #test show complaints 0
139 gdb_test "show complaints" "Max number of complaints about incorrect symbols is 0..*" "show complaints (0)"
140 #test set confirm off
141 gdb_test_no_output "set confirm off" "set confirm off"
142 #test show confirm off
143 gdb_test "show confirm" "Whether to confirm potentially dangerous operations is off..*" "show confirm (off)"
144 #test set confirm on
145 gdb_test_no_output "set confirm on" "set confirm on"
146 #test show confirm on
147 gdb_test "show confirm" "Whether to confirm potentially dangerous operations is on..*" "show confirm (on)"
148 #test set editing off
149 gdb_test_no_output "set editing off" "set editing off"
150 #test show editing off
151 gdb_test "show editing" "Editing of command lines as they are typed is off..*" "show editing (off)"
152 #test set editing on
153 #gdb_test_no_output "set editing on" "set editing on"
154 #test show editing on
155 #gdb_test "show editing" "Editing of command lines as they are typed is on..*" "show editing (on)"
156 #test set environment FOOBARBAZ
157 gdb_test_no_output "set environment FOOBARBAZ = grbxgrbxgrbx" \
158 "set environment FOOBARBAZ"
159 #test show environment FOOBARBAZ
160 gdb_test "show environment FOOBARBAZ" "FOOBARBAZ = grbxgrbxgrbx.*" "show environment FOOBARBAZ"
161 #test set height 100
162 gdb_test_no_output "set height 100" "set height 100"
163 #test show height 100
164 gdb_test "show height" "Number of lines gdb thinks are in a page is 100..*" "show height"
165 # Back to infinite height to avoid pagers. While at it, check that
166 # literal "unlimited" works just as well as 0.
167 gdb_test_no_output "set height unlimited"
168 #test set history expansion on
169 gdb_test_no_output "set history expansion on" "set history expansion on"
170 #test show history expansion on
171 gdb_test "show history expansion on" "History expansion on command input is on.*" "show history expansion"
172 #test set history filename foobar.baz
173 gdb_test_no_output "set history filename foobar.baz" \
174 "set history filename foobar.baz"
175 #test show history filename foobar.baz
176 gdb_test "show history filename" "The filename in which to record the command history is \"foobar.baz\"..*" "show history filename (foobar.baz)"
177 #test set history save on
178 gdb_test_no_output "set history save on" "set history save on"
179 #test show history save on
180 gdb_test "show history save" "Saving of the history record on exit is on..*" "show history save (on)"
181 #history saving should stay disabled
182 gdb_test_no_output "set history save off" "set history save off"
183 #test set history size 100
184 gdb_test_no_output "set history size 100" "set history size 100"
185 #test show history size 100
186 gdb_test "show history size" "The size of the command history is 100..*" "show history size (100)"
187 #test set language asm
188 gdb_test "set language asm" ".*" "set language asm"
189 #test show language asm
190 gdb_test "show language" "The current source language is \"asm\"..*" "show language (asm)"
191 #test set language java, with a trailing space
192 gdb_test_no_output "set language java " "set language java"
193 #test show language java
194 gdb_test "show language" "The current source language is \"java\"..*" "show language (java)"
195 #test completion for set language.
196 gdb_test "complete set language min" "set language minimal" \
197 "complete set language minimal"
198 #test set language auto
199 gdb_test_no_output "set language auto" "set language auto"
200 #test show language
201 gdb_test "show language" "The current source language is \"auto.*\"..*" "show language (auto)"
202 #test set listsize 100
203 gdb_test_no_output "set listsize 100" "set listsize 100"
204 #test show listsize 100
205 gdb_test "show listsize" "Number of source lines gdb will list by default is 100..*" "show listsize (100)"
206
207 if ![board_info target exists gdb_prompt] {
208 #test set prompt (FooBarBaz)
209 set newprompt "\\(FooBarBaz\\)"
210
211 gdb_test_multiple "set prompt (FooBarBaz) " "set prompt FooBarBaz" {
212 -re "\[\r\n\]$newprompt $" {
213 pass "set prompt FooBarBaz"
214 }
215 }
216
217 #test show prompt (FooBarBaz)
218
219 gdb_test_multiple "show prompt" "show prompt FooBarBaz" {
220 -re "Gdb's prompt is \"$newprompt \"..* $" {
221 pass "show prompt FooBarBaz"
222 }
223 }
224
225 #test set prompt (gdb)
226
227 gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
228 -re "\[\r\n\]$gdb_prompt $" {
229 pass "set prompt gdb"
230 }
231 }
232 }
233
234 #test set radix 11
235 gdb_test "set radix 11" "Unsupported output radix ``decimal 11''; output radix unchanged..*" "set radix 11"
236 #test set radix 16
237 gdb_test "set radix 16" "Input and output radices now set to decimal 16, hex 10, octal 20..*" "set radix 16"
238 #test show radix 16
239 gdb_test "show radix" "Input and output radices set to decimal 16, hex 10, octal 20..*" "show radix (16)"
240 #test set radix 10
241 gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12..*" "set radix 10"
242 #test show radix 10
243 gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12..*" "show radix (10)"
244 #test set width 90
245 gdb_test_no_output "set width 90" "set width 90"
246 #test show width 90
247 gdb_test "show width" "Number of characters gdb thinks are in a line is 90..*" "show width (90)"
248 #test set write on
249 # This is only supported on targets which use exec.o.
250 gdb_test_no_output "set write on" "set write on"
251 #test show write on
252 # This is only supported on targets which use exec.o.
253 gdb_test "show write" "Writing into executable and core files is on..*" "show write (on)"
254 #test show user
255 gdb_test_no_output "show user" "show user"
256 #test set verbose on
257 gdb_test_no_output "set verbose on" "set verbose on"
258 #test show verbose on
259 gdb_test "show verbose" "Verbose printing of informational messages is on..*" "show verbose (on)"
260 #test set verbose off
261 gdb_test_no_output "set verbose off" "set verbose off"
262 #test show verbose off
263 gdb_test "show verbose" "Verbosity is off..*" "show verbose (off)"
264 #test argument must be preceded by space
265 foreach x {"history file" "solib-search-path" "data-directory"} {
266 foreach y {"/home/" "." "~/home" "=home"} {
267 gdb_test "set $x$y" "Argument must be preceded by space." \
268 "$x is not set to $y"
269 }
270 }
This page took 0.052341 seconds and 4 git commands to generate.