1 |
24 |
jeremybenn |
# Copyright 1998, 1999, 2002, 2003, 2004, 2007, 2008
|
2 |
|
|
# 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 .
|
16 |
|
|
|
17 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
18 |
|
|
# bug-gdb@prep.ai.mit.edu
|
19 |
|
|
|
20 |
|
|
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
|
21 |
|
|
|
22 |
|
|
# This file is part of the gdb testsuite.
|
23 |
|
|
|
24 |
|
|
#
|
25 |
|
|
# tests for command completion
|
26 |
|
|
#
|
27 |
|
|
# Here are some useful test cases for completion.
|
28 |
|
|
# They should be tested with both M-? and TAB.
|
29 |
|
|
#
|
30 |
|
|
# "show output-" "radix"
|
31 |
|
|
# "show output" "-radix"
|
32 |
|
|
# "p" ambiguous (commands starting with p--path, print, printf, etc.)
|
33 |
|
|
# "p " ambiguous (all symbols)
|
34 |
|
|
# "info t foo" no completions
|
35 |
|
|
# "info t " no completions
|
36 |
|
|
# "info t" ambiguous ("info target", "info terminal", etc.)
|
37 |
|
|
# "info ajksdlfk" no completions
|
38 |
|
|
# "info ajksdlfk " no completions
|
39 |
|
|
# "info" " "
|
40 |
|
|
# "info " ambiguous (all info commands)
|
41 |
|
|
# "p \"break1" unambiguous (completes to filename "break1.c")
|
42 |
|
|
# "p \"break1." unambiguous (should complete to "break1.c" but does not,
|
43 |
|
|
# due to readline limitations)
|
44 |
|
|
# "p 'a" ambiguous (all symbols starting with a)
|
45 |
|
|
# "p b-a" ambiguous (all symbols starting with a)
|
46 |
|
|
# "p b-" ambiguous (all symbols)
|
47 |
|
|
# "file Make" "file" (word break hard to screw up here)
|
48 |
|
|
# "file ../gdb.stabs/we" "ird" (needs to not break word at slash)
|
49 |
|
|
#
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
if $tracelevel then {
|
53 |
|
|
strace $tracelevel
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
global usestubs
|
58 |
|
|
|
59 |
|
|
#
|
60 |
|
|
# test running programs
|
61 |
|
|
#
|
62 |
|
|
set prms_id 0
|
63 |
|
|
set bug_id 0
|
64 |
|
|
|
65 |
|
|
set testfile "break"
|
66 |
|
|
set srcfile ${testfile}.c
|
67 |
|
|
set srcfile1 ${testfile}1.c
|
68 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
69 |
|
|
|
70 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
|
71 |
|
|
untested completion.exp
|
72 |
|
|
return -1
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
|
76 |
|
|
untested completion.exp
|
77 |
|
|
return -1
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
|
81 |
|
|
untested completion.exp
|
82 |
|
|
return -1
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
if [get_compiler_info ${binfile}] {
|
86 |
|
|
return -1;
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
gdb_exit
|
90 |
|
|
|
91 |
|
|
# Don't let a .inputrc file or an existing setting of INPUTRC mess up
|
92 |
|
|
# the test results. Even if /dev/null doesn't exist on the particular
|
93 |
|
|
# platform, the readline library will use the default setting just by
|
94 |
|
|
# failing to open the file. OTOH, opening /dev/null successfully will
|
95 |
|
|
# also result in the default settings being used since nothing will be
|
96 |
|
|
# read from this file.
|
97 |
|
|
global env
|
98 |
|
|
if [info exists env(INPUTRC)] {
|
99 |
|
|
set old_inputrc $env(INPUTRC)
|
100 |
|
|
}
|
101 |
|
|
set env(INPUTRC) "/dev/null"
|
102 |
|
|
|
103 |
|
|
gdb_start
|
104 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
105 |
|
|
gdb_load ${binfile}
|
106 |
|
|
|
107 |
|
|
if ![runto_main] then {
|
108 |
|
|
perror "tests suppressed"
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
set oldtimeout1 $timeout
|
112 |
|
|
set timeout 30
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
send_gdb "hfgfh\t"
|
116 |
|
|
sleep 1
|
117 |
|
|
gdb_expect {
|
118 |
|
|
-re "^hfgfh\\\x07$"\
|
119 |
|
|
{ send_gdb "\n"
|
120 |
|
|
gdb_expect {
|
121 |
|
|
-re "Undefined command: \"hfgfh\"\\. Try \"help\"\\..*$gdb_prompt $"\
|
122 |
|
|
{ pass "complete 'hfgfh'"}
|
123 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'hfgfh'"}
|
124 |
|
|
timeout {fail "(timeout) complete 'hfgfh'"}
|
125 |
|
|
}
|
126 |
|
|
}
|
127 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'hfgfh'" }
|
128 |
|
|
timeout { fail "(timeout) complete 'hfgfh'" }
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
#exp_internal 0
|
132 |
|
|
|
133 |
|
|
send_gdb "show output\t"
|
134 |
|
|
sleep 1
|
135 |
|
|
gdb_expect {
|
136 |
|
|
-re "^show output-radix $"\
|
137 |
|
|
{ send_gdb "\n"
|
138 |
|
|
gdb_expect {
|
139 |
|
|
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
|
140 |
|
|
{ pass "complete 'show output'"}
|
141 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'show output'"}
|
142 |
|
|
timeout {fail "(timeout) complete 'show output'"}
|
143 |
|
|
}
|
144 |
|
|
}
|
145 |
|
|
-re "^show output$"\
|
146 |
|
|
{ send_gdb "\n"
|
147 |
|
|
gdb_expect {
|
148 |
|
|
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
|
149 |
|
|
{ fail "complete 'show output'"}
|
150 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'show output'"}
|
151 |
|
|
timeout { fail "(timeout) complete 'show output'"}
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'show output'" }
|
157 |
|
|
timeout { fail "(timeout) complete 'show output'" }
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
send_gdb "show output-\t"
|
162 |
|
|
sleep 1
|
163 |
|
|
gdb_expect {
|
164 |
|
|
-re "^show output-radix $"\
|
165 |
|
|
{ send_gdb "\n"
|
166 |
|
|
gdb_expect {
|
167 |
|
|
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
|
168 |
|
|
{ pass "complete 'show output-'"}
|
169 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'show output-'"}
|
170 |
|
|
timeout {fail "(timeout) complete 'show output-'"}
|
171 |
|
|
}
|
172 |
|
|
}
|
173 |
|
|
-re "^show output-$"\
|
174 |
|
|
{ send_gdb "\n"
|
175 |
|
|
gdb_expect {
|
176 |
|
|
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
|
177 |
|
|
{ fail "complete 'show output-'"}
|
178 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'show output-'"}
|
179 |
|
|
timeout { fail "(timeout) complete 'show output-'"}
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
}
|
183 |
|
|
|
184 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'show output-'" }
|
185 |
|
|
timeout { fail "(timeout) complete 'show output-'" }
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
send_gdb "p\t"
|
189 |
|
|
sleep 1
|
190 |
|
|
gdb_expect {
|
191 |
|
|
-re "^p\\\x07$"\
|
192 |
|
|
{ send_gdb "\n"
|
193 |
|
|
sleep 1
|
194 |
|
|
gdb_expect {
|
195 |
|
|
-re "The history is empty\\..*$gdb_prompt $"\
|
196 |
|
|
{ pass "complete 'p'"}
|
197 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p'"}
|
198 |
|
|
timeout {fail "(timeout) complete 'p' 2"}
|
199 |
|
|
}
|
200 |
|
|
}
|
201 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p'" }
|
202 |
|
|
timeout { fail "(timeout) complete 'p' 1" }
|
203 |
|
|
}
|
204 |
|
|
|
205 |
|
|
send_gdb "p \t"
|
206 |
|
|
sleep 3
|
207 |
|
|
gdb_expect {
|
208 |
|
|
-re "^p \\\x07$"\
|
209 |
|
|
{ send_gdb "\n"
|
210 |
|
|
sleep 1
|
211 |
|
|
gdb_expect {
|
212 |
|
|
-re "The history is empty\\..*$gdb_prompt $"\
|
213 |
|
|
{ pass "complete 'p '"}
|
214 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p '"}
|
215 |
|
|
timeout {fail "(timeout) complete 'p ' 1"}
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p '" }
|
219 |
|
|
timeout { fail "(timeout) complete 'p ' 2" }
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
send_gdb "info t foo\t"
|
224 |
|
|
sleep 1
|
225 |
|
|
gdb_expect {
|
226 |
|
|
-re "^info t foo\\\x07$"\
|
227 |
|
|
{ send_gdb "\n"
|
228 |
|
|
gdb_expect {
|
229 |
|
|
-re "Ambiguous info command \"t foo\": target, terminal, threads, tp, tracepoints, types\\..*$gdb_prompt $"\
|
230 |
|
|
{ pass "complete 'info t foo'"}
|
231 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info t foo'"}
|
232 |
|
|
timeout {fail "(timeout) complete 'info t foo'"}
|
233 |
|
|
}
|
234 |
|
|
}
|
235 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info t foo'" }
|
236 |
|
|
timeout { fail "(timeout) complete 'info t foo'" }
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
send_gdb "info t\t"
|
240 |
|
|
sleep 1
|
241 |
|
|
gdb_expect {
|
242 |
|
|
-re "^info t\\\x07$"\
|
243 |
|
|
{ send_gdb "\n"
|
244 |
|
|
gdb_expect {
|
245 |
|
|
-re "Ambiguous info command \"t\": target, terminal, threads, tp, tracepoints, types\\..
|
246 |
|
|
*$gdb_prompt $"\
|
247 |
|
|
{ pass "complete 'info t'"}
|
248 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info t'"}
|
249 |
|
|
timeout {fail "(timeout) complete 'info t'"}
|
250 |
|
|
}
|
251 |
|
|
}
|
252 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info t'" }
|
253 |
|
|
timeout { fail "(timeout) complete 'info t'" }
|
254 |
|
|
}
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
send_gdb "info t \t"
|
258 |
|
|
sleep 1
|
259 |
|
|
gdb_expect {
|
260 |
|
|
-re "^info t \\\x07$"\
|
261 |
|
|
{ send_gdb "\n"
|
262 |
|
|
gdb_expect {
|
263 |
|
|
-re "Ambiguous info command \"t \": target, terminal, threads, tp, tracepoints, types\\..
|
264 |
|
|
*$gdb_prompt $"\
|
265 |
|
|
{ pass "complete 'info t '"}
|
266 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info t '"}
|
267 |
|
|
timeout {fail "(timeout) complete 'info t '"}
|
268 |
|
|
}
|
269 |
|
|
}
|
270 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info t '" }
|
271 |
|
|
timeout { fail "(timeout) complete 'info t '" }
|
272 |
|
|
}
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
send_gdb "info asdfgh\t"
|
276 |
|
|
sleep 1
|
277 |
|
|
gdb_expect {
|
278 |
|
|
-re "^info asdfgh\\\x07$"\
|
279 |
|
|
{ send_gdb "\n"
|
280 |
|
|
gdb_expect {
|
281 |
|
|
-re "Undefined info command: \"asdfgh\". Try \"help info\"\\..
|
282 |
|
|
*$gdb_prompt $"\
|
283 |
|
|
{ pass "complete 'info asdfgh'"}
|
284 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh'"}
|
285 |
|
|
timeout {fail "(timeout) complete 'info asdfgh'"}
|
286 |
|
|
}
|
287 |
|
|
}
|
288 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh'" }
|
289 |
|
|
timeout { fail "(timeout) complete 'info asdfgh'" }
|
290 |
|
|
}
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
send_gdb "info asdfgh \t"
|
294 |
|
|
sleep 1
|
295 |
|
|
gdb_expect {
|
296 |
|
|
-re "^info asdfgh \\\x07$"\
|
297 |
|
|
{ send_gdb "\n"
|
298 |
|
|
gdb_expect {
|
299 |
|
|
-re "Undefined info command: \"asdfgh \". Try \"help info\"\\..
|
300 |
|
|
*$gdb_prompt $"\
|
301 |
|
|
{ pass "complete 'info asdfgh '"}
|
302 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh '"}
|
303 |
|
|
timeout {fail "(timeout) complete 'info asdfgh '"}
|
304 |
|
|
}
|
305 |
|
|
}
|
306 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh '" }
|
307 |
|
|
timeout { fail "(timeout) complete 'info asdfgh '" }
|
308 |
|
|
}
|
309 |
|
|
|
310 |
|
|
send_gdb "info\t"
|
311 |
|
|
sleep 1
|
312 |
|
|
gdb_expect {
|
313 |
|
|
-re "^info $"\
|
314 |
|
|
{ send_gdb "\n"
|
315 |
|
|
gdb_expect {
|
316 |
|
|
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands.*$gdb_prompt $"\
|
317 |
|
|
{ pass "complete 'info'"}
|
318 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info'"}
|
319 |
|
|
timeout {fail "(timeout) complete 'info'"}
|
320 |
|
|
}
|
321 |
|
|
}
|
322 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info'" }
|
323 |
|
|
timeout { fail "(timeout) complete 'info'" }
|
324 |
|
|
}
|
325 |
|
|
|
326 |
|
|
send_gdb "info \t"
|
327 |
|
|
sleep 1
|
328 |
|
|
gdb_expect {
|
329 |
|
|
-re "^info \\\x07$"\
|
330 |
|
|
{ send_gdb "\n"
|
331 |
|
|
gdb_expect {
|
332 |
|
|
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*$gdb_prompt $"\
|
333 |
|
|
{ pass "complete 'info '"}
|
334 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info '"}
|
335 |
|
|
timeout {fail "(timeout) complete 'info '"}
|
336 |
|
|
}
|
337 |
|
|
}
|
338 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info '" }
|
339 |
|
|
timeout { fail "(timeout) complete 'info '" }
|
340 |
|
|
}
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
send_gdb "info \t"
|
344 |
|
|
sleep 1
|
345 |
|
|
gdb_expect {
|
346 |
|
|
-re "^info \\\x07$"\
|
347 |
|
|
{ send_gdb "\t"
|
348 |
|
|
gdb_expect {
|
349 |
|
|
-re "address.*types.*$gdb_prompt info $"\
|
350 |
|
|
{ send_gdb "\n"
|
351 |
|
|
gdb_expect {
|
352 |
|
|
-re "\"info\".*unambiguous\\..*$gdb_prompt $"\
|
353 |
|
|
{ pass "complete (2) 'info '"}
|
354 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'info '"}
|
355 |
|
|
timeout {fail "(timeout) complete (2) 'info '"}
|
356 |
|
|
}
|
357 |
|
|
}
|
358 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'info '"}
|
359 |
|
|
timeout {fail "(timeout) complete (2) 'info '"}
|
360 |
|
|
}
|
361 |
|
|
}
|
362 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'info '" }
|
363 |
|
|
timeout { fail "(timeout) complete (2) 'info '" }
|
364 |
|
|
}
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
send_gdb "p \"break1\t"
|
368 |
|
|
sleep 1
|
369 |
|
|
gdb_expect {
|
370 |
|
|
-re "^p \"break1\\\x07$"\
|
371 |
|
|
{ send_gdb "\n"
|
372 |
|
|
gdb_expect {
|
373 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \"break1'"}
|
374 |
|
|
timeout {fail "(timeout) complete 'p \"break1'"}
|
375 |
|
|
}
|
376 |
|
|
}
|
377 |
|
|
-re "^p \"break1\\.c\"$"\
|
378 |
|
|
{ send_gdb "\n"
|
379 |
|
|
gdb_expect {
|
380 |
|
|
-re ".*$gdb_prompt $" { pass "complete 'p \"break1'"}
|
381 |
|
|
timeout {fail "(timeout) complete 'p \"break1'"}
|
382 |
|
|
}
|
383 |
|
|
}
|
384 |
|
|
-re "^p \"break1.*$"
|
385 |
|
|
{ send_gdb "\n"
|
386 |
|
|
gdb_expect {
|
387 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \"break1'"}
|
388 |
|
|
timeout {fail "(timeout) complete 'p \"break1'"}
|
389 |
|
|
}
|
390 |
|
|
}
|
391 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \"break1'" }
|
392 |
|
|
timeout { fail "(timeout) complete 'p \"break1'" }
|
393 |
|
|
}
|
394 |
|
|
|
395 |
|
|
setup_xfail "*-*-*"
|
396 |
|
|
send_gdb "p \"break1.\t"
|
397 |
|
|
sleep 1
|
398 |
|
|
gdb_expect {
|
399 |
|
|
-re "^p \"break1\\.\\\x07$"\
|
400 |
|
|
{ send_gdb "\n"
|
401 |
|
|
gdb_expect {
|
402 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \"break1.'"}
|
403 |
|
|
timeout {fail "(timeout) complete 'p \"break1.'"}
|
404 |
|
|
}
|
405 |
|
|
}
|
406 |
|
|
-re "^p \"break1\\.c\"$"\
|
407 |
|
|
{ send_gdb "\n"
|
408 |
|
|
gdb_expect {
|
409 |
|
|
-re ".*$gdb_prompt $" { pass "complete 'p \"break1.'"}
|
410 |
|
|
timeout {fail "(timeout) complete 'p \"break1.'"}
|
411 |
|
|
}
|
412 |
|
|
}
|
413 |
|
|
-re "^p \"break1\\..*$"
|
414 |
|
|
{ send_gdb "\n"
|
415 |
|
|
gdb_expect {
|
416 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \"break1.'"}
|
417 |
|
|
timeout {fail "(timeout) complete 'p \"break1.'"}
|
418 |
|
|
}
|
419 |
|
|
}
|
420 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \"break1.'" }
|
421 |
|
|
timeout { fail "(timeout) complete 'p \"break1.'" }
|
422 |
|
|
}
|
423 |
|
|
|
424 |
|
|
send_gdb "p 'a\t"
|
425 |
|
|
sleep 1
|
426 |
|
|
gdb_expect {
|
427 |
|
|
-re "^p 'a\\\x07$"\
|
428 |
|
|
{ send_gdb "\n"
|
429 |
|
|
gdb_expect {
|
430 |
|
|
-re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $"\
|
431 |
|
|
{ pass "complete 'p \'a'"}
|
432 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \'a'"}
|
433 |
|
|
timeout {fail "(timeout) complete 'p \'a'"}
|
434 |
|
|
}
|
435 |
|
|
}
|
436 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'p \'a'" }
|
437 |
|
|
timeout { fail "(timeout) complete 'p \'a'" }
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
send_gdb "p 'a\t"
|
441 |
|
|
sleep 1
|
442 |
|
|
gdb_expect {
|
443 |
|
|
-re "^p 'a\\\x07$" {
|
444 |
|
|
send_gdb "\t"
|
445 |
|
|
gdb_expect {
|
446 |
|
|
-re ".*argv.*$gdb_prompt p .a$" {
|
447 |
|
|
send_gdb "\n"
|
448 |
|
|
gdb_expect {
|
449 |
|
|
-re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" {
|
450 |
|
|
pass "complete (2) 'p \'a'"
|
451 |
|
|
}
|
452 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
|
453 |
|
|
timeout { fail "(timeout) complete (2) 'p \'a'" }
|
454 |
|
|
}
|
455 |
|
|
}
|
456 |
|
|
-re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
|
457 |
|
|
send_gdb "n"
|
458 |
|
|
gdb_expect {
|
459 |
|
|
-re "\\(gdb\\) p 'a$" {
|
460 |
|
|
send_gdb "\n"
|
461 |
|
|
gdb_expect {
|
462 |
|
|
-re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" {
|
463 |
|
|
pass "complete (2) 'p \'a'"
|
464 |
|
|
}
|
465 |
|
|
-re ".*$gdb_prompt $" {
|
466 |
|
|
fail "complete (2) 'p \'a'"
|
467 |
|
|
}
|
468 |
|
|
timeout { fail "(timeout) complete (2) 'p \'a'" }
|
469 |
|
|
}
|
470 |
|
|
}
|
471 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
|
472 |
|
|
timeout { fail "(timeout) complete (2) 'p \'a'" }
|
473 |
|
|
}
|
474 |
|
|
}
|
475 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
|
476 |
|
|
timeout { fail "(timeout) complete (2) 'p \'a'" }
|
477 |
|
|
}
|
478 |
|
|
}
|
479 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
|
480 |
|
|
timeout { fail "(timeout) complete (2) 'p \'a'" }
|
481 |
|
|
}
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
# These tests used to try completing the shorter "p b-a".
|
485 |
|
|
# Unfortunately, on some systems, there are .o files in system
|
486 |
|
|
# libraries which declare static variables named `b'. Of course,
|
487 |
|
|
# those variables aren't really in scope, as far as the compiler is
|
488 |
|
|
# concerned. But GDB deliberately tries to be more liberal: if you
|
489 |
|
|
# enter an identifier that doesn't have any binding in scope, GDB will
|
490 |
|
|
# search all the program's compilation units for a static variable of
|
491 |
|
|
# the given name.
|
492 |
|
|
#
|
493 |
|
|
# This behavior can help avoid a lot of pedantry, so it's usually a
|
494 |
|
|
# good thing. But in this test case, it causes GDB to print the value
|
495 |
|
|
# of some random variable, instead of giving us the "No symbol..."
|
496 |
|
|
# error we were expecting.
|
497 |
|
|
#
|
498 |
|
|
# For example, on S/390 linux, the file s_atan.c in libm.a declares a
|
499 |
|
|
# `b', which is a structure containing an int and a float, so GDB says
|
500 |
|
|
# ``Argument to arithmetic operation not a number or boolean'' instead
|
501 |
|
|
# of ``No symbol ...''.
|
502 |
|
|
#
|
503 |
|
|
# So, I'm hoping that there is no system with a static library variable named
|
504 |
|
|
# `no_var_by_this_name'.
|
505 |
|
|
send_gdb "p no_var_named_this-a\t"
|
506 |
|
|
sleep 1
|
507 |
|
|
gdb_expect {
|
508 |
|
|
-re "^p no_var_named_this-a\\\x07$" {
|
509 |
|
|
send_gdb "\n"
|
510 |
|
|
gdb_expect {
|
511 |
|
|
-re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
|
512 |
|
|
pass "complete 'p no_var_named_this-a'"
|
513 |
|
|
}
|
514 |
|
|
-re ".*$gdb_prompt $" {
|
515 |
|
|
fail "complete 'p no_var_named_this-a'"
|
516 |
|
|
}
|
517 |
|
|
timeout {
|
518 |
|
|
fail "(timeout) complete 'p no_var_named_this-a'"
|
519 |
|
|
}
|
520 |
|
|
}
|
521 |
|
|
}
|
522 |
|
|
-re ".*$gdb_prompt $" {
|
523 |
|
|
fail "complete 'p no_var_named_this-a'"
|
524 |
|
|
}
|
525 |
|
|
timeout {
|
526 |
|
|
fail "(timeout) complete 'p no_var_named_this-a'"
|
527 |
|
|
}
|
528 |
|
|
}
|
529 |
|
|
|
530 |
|
|
send_gdb "p no_var_named_this-a\t"
|
531 |
|
|
sleep 1
|
532 |
|
|
gdb_expect {
|
533 |
|
|
-re "^p no_var_named_this-a\\\x07$" {
|
534 |
|
|
send_gdb "\t"
|
535 |
|
|
gdb_expect {
|
536 |
|
|
-re ".*argv.*$gdb_prompt p no_var_named_this-a$" {
|
537 |
|
|
send_gdb "\n"
|
538 |
|
|
gdb_expect {
|
539 |
|
|
-re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
|
540 |
|
|
pass "complete (2) 'p no_var_named_this-a'"
|
541 |
|
|
}
|
542 |
|
|
-re ".*$gdb_prompt $" {
|
543 |
|
|
fail "complete (2) 'p no_var_named_this-a'"
|
544 |
|
|
}
|
545 |
|
|
timeout {
|
546 |
|
|
fail "(timeout) complete (2) 'p no_var_named_this-a'"
|
547 |
|
|
}
|
548 |
|
|
}
|
549 |
|
|
}
|
550 |
|
|
-re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
|
551 |
|
|
send_gdb "n"
|
552 |
|
|
gdb_expect {
|
553 |
|
|
-re "\\(gdb\\) p no_var_named_this-a$" {
|
554 |
|
|
send_gdb "\n"
|
555 |
|
|
gdb_expect {
|
556 |
|
|
-re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
|
557 |
|
|
pass "complete (2) 'p no_var_named_this-a'"
|
558 |
|
|
}
|
559 |
|
|
-re ".*$gdb_prompt $" {
|
560 |
|
|
fail "complete (2) 'p no_var_named_this-a'"
|
561 |
|
|
}
|
562 |
|
|
timeout {
|
563 |
|
|
fail "(timeout) complete (2) 'p no_var_named_this-a'"
|
564 |
|
|
}
|
565 |
|
|
}
|
566 |
|
|
}
|
567 |
|
|
-re ".*$gdb_prompt $" {
|
568 |
|
|
fail "complete (2) 'p no_var_named_this-a'"
|
569 |
|
|
}
|
570 |
|
|
timeout {
|
571 |
|
|
fail "(timeout) complete (2) 'p no_var_named_this-a'"
|
572 |
|
|
}
|
573 |
|
|
}
|
574 |
|
|
}
|
575 |
|
|
-re ".*$gdb_prompt $" {
|
576 |
|
|
fail "complete (2) 'p no_var_named_this-a'"
|
577 |
|
|
}
|
578 |
|
|
timeout { fail "(timeout) complete (2) 'p no_var_named_this-a'" }
|
579 |
|
|
}
|
580 |
|
|
}
|
581 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_named_this-a'" }
|
582 |
|
|
timeout { fail "(timeout) complete (2) 'p no_var_named_this-a'" }
|
583 |
|
|
}
|
584 |
|
|
|
585 |
|
|
send_gdb "p no_var_named_this-\t"
|
586 |
|
|
sleep 1
|
587 |
|
|
gdb_expect {
|
588 |
|
|
-re "^p no_var_named_this-\\\x07$" {
|
589 |
|
|
send_gdb "\t"
|
590 |
|
|
gdb_expect {
|
591 |
|
|
-re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
|
592 |
|
|
send_gdb "n"
|
593 |
|
|
gdb_expect {
|
594 |
|
|
-re "\\(gdb\\) p no_var_named_this-$" {
|
595 |
|
|
send_gdb "\n"
|
596 |
|
|
gdb_expect {
|
597 |
|
|
-re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
|
598 |
|
|
pass "complete (2) 'p no_var_named_this-'"
|
599 |
|
|
}
|
600 |
|
|
-re ".*$gdb_prompt $" {
|
601 |
|
|
fail "complete (2) 'p no_var_named_this-'"
|
602 |
|
|
}
|
603 |
|
|
timeout {
|
604 |
|
|
fail "(timeout) complete (2) 'p no_var_named_this-'"
|
605 |
|
|
}
|
606 |
|
|
}
|
607 |
|
|
}
|
608 |
|
|
-re ".*$gdb_prompt $" {
|
609 |
|
|
fail "complete (2) 'p no_var_named_this-'"
|
610 |
|
|
}
|
611 |
|
|
timeout {
|
612 |
|
|
fail "(timeout) complete (2) 'p no_var_named_this-'"
|
613 |
|
|
}
|
614 |
|
|
}
|
615 |
|
|
}
|
616 |
|
|
-re ".*$gdb_prompt $" {
|
617 |
|
|
fail "complete (2) 'p no_var_named_this-'"
|
618 |
|
|
}
|
619 |
|
|
timeout { fail "(timeout) complete (2) 'p no_var_named_this-'" }
|
620 |
|
|
}
|
621 |
|
|
}
|
622 |
|
|
-re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_named_this-'" }
|
623 |
|
|
timeout { fail "(timeout) complete (2) 'p no_var_named_this-'" }
|
624 |
|
|
}
|
625 |
|
|
|
626 |
|
|
|
627 |
|
|
# The following tests used to simply try to complete `${objdir}/file',
|
628 |
|
|
# and so on. The problem is that ${objdir} can be very long; the
|
629 |
|
|
# completed filename may be more than eighty characters wide. When
|
630 |
|
|
# this happens, readline tries to manage things, producing output that
|
631 |
|
|
# may make sense on the screen, but is rather hard for our script to
|
632 |
|
|
# recognize.
|
633 |
|
|
#
|
634 |
|
|
# In the case that motivated this change, the (gdb) prompt occupied
|
635 |
|
|
# the leftmost six columns, and `${objdir}/' was seventy-four
|
636 |
|
|
# characters long --- eighty in all. After printing the slash,
|
637 |
|
|
# readline emitted a space, a carriage return, and then `Makefile'
|
638 |
|
|
# (the tab character being received as input after `Make'.
|
639 |
|
|
#
|
640 |
|
|
# Basically, you have to let readline do whatever it's going to do to
|
641 |
|
|
# make the screen look right. If it happens to use a different
|
642 |
|
|
# strategy on Tuesdays to get the cursor in the right place, that's
|
643 |
|
|
# not something the testsuite should care about.
|
644 |
|
|
#
|
645 |
|
|
# So, we avoid long lines. We `cd' to ${objdir} first, and then do
|
646 |
|
|
# the completion relative to the current directory.
|
647 |
|
|
|
648 |
|
|
# ${srcdir} may be a relative path. We want to make sure we end up
|
649 |
|
|
# in the right directory - so make sure we know where it is.
|
650 |
|
|
set mydir [pwd]
|
651 |
|
|
cd ${srcdir}
|
652 |
|
|
set fullsrcdir [pwd]
|
653 |
|
|
cd ${mydir}
|
654 |
|
|
|
655 |
|
|
# If the directory name contains a '+' we must escape it, adding a backslash.
|
656 |
|
|
# If not, the test below will fail because it will interpret the '+' as a
|
657 |
|
|
# regexp operator. We use string_to_regexp for this purpose.
|
658 |
|
|
|
659 |
|
|
gdb_test "cd ${fullsrcdir}" \
|
660 |
|
|
"Working directory [string_to_regexp ${fullsrcdir}].*" \
|
661 |
|
|
"cd to \${srcdir}"
|
662 |
|
|
|
663 |
|
|
send_gdb "complete file ./gdb.base/compl\n"
|
664 |
|
|
sleep 1
|
665 |
|
|
gdb_expect {
|
666 |
|
|
-re "file ./gdb.base/completion\\.exp.*$gdb_prompt $"
|
667 |
|
|
{ pass "complete-command 'file ./gdb.base/compl'"}
|
668 |
|
|
-re ".*$gdb_prompt $" { fail "complete-command 'file ./gdb.base/compl'" }
|
669 |
|
|
timeout { fail "(timeout) complete-command 'file ./gdb.base/compl'" }
|
670 |
|
|
}
|
671 |
|
|
|
672 |
|
|
send_gdb "file ./gdb.base/complet\t"
|
673 |
|
|
sleep 1
|
674 |
|
|
gdb_expect {
|
675 |
|
|
-re "^file ./gdb.base/completion\\.exp $"\
|
676 |
|
|
{ send_gdb "\n"
|
677 |
|
|
# Ignore the exact error message.
|
678 |
|
|
gdb_test_multiple "" "complete 'file ./gdb.base/complet'" {
|
679 |
|
|
-re "\r\nA program is being debugged already\\.\[\r\n\]+Are you sure you want to change the file\\? \\(y or n\\) $" {
|
680 |
|
|
send_gdb "n\n"
|
681 |
|
|
exp_continue
|
682 |
|
|
}
|
683 |
|
|
-re ".*$gdb_prompt $" { pass "complete 'file ./gdb.base/complet'" }
|
684 |
|
|
}
|
685 |
|
|
}
|
686 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'file ./gdb.base/complet'" }
|
687 |
|
|
timeout { fail "(timeout) complete 'file ./gdb.base/complet'" }
|
688 |
|
|
}
|
689 |
|
|
|
690 |
|
|
send_gdb "info func marke\t"
|
691 |
|
|
sleep 1
|
692 |
|
|
gdb_expect {
|
693 |
|
|
-re "^info func marke.*r$"\
|
694 |
|
|
{
|
695 |
|
|
send_gdb "\t\t"
|
696 |
|
|
sleep 3
|
697 |
|
|
gdb_expect {
|
698 |
|
|
-re "marker1.*$gdb_prompt info func marker$"\
|
699 |
|
|
{ send_gdb "\n"
|
700 |
|
|
gdb_expect {
|
701 |
|
|
-re "All functions matching regular expression \"marker\":.*File.*break1.c:\r\nint marker1\\((void|)\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\
|
702 |
|
|
{ pass "complete 'info func marke'"}
|
703 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info func marke'"}
|
704 |
|
|
timeout {fail "(timeout) complete 'info func marke'"}
|
705 |
|
|
}
|
706 |
|
|
}
|
707 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info func marke'"}
|
708 |
|
|
timeout {fail "(timeout) complete 'info func marke'"}
|
709 |
|
|
}
|
710 |
|
|
}
|
711 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'info func marke'" }
|
712 |
|
|
timeout { fail "(timeout) complete 'info func marke'" }
|
713 |
|
|
}
|
714 |
|
|
|
715 |
|
|
|
716 |
|
|
send_gdb "set follow-fork-mode \t\t"
|
717 |
|
|
sleep 1
|
718 |
|
|
gdb_expect {
|
719 |
|
|
-re "child.*parent.*$gdb_prompt set follow-fork-mode $"\
|
720 |
|
|
{ send_gdb "\n"
|
721 |
|
|
gdb_expect {
|
722 |
|
|
-re "Requires an argument.*child.*parent.*$gdb_prompt $"\
|
723 |
|
|
{ pass "complete 'set follow-fork-mode'"}
|
724 |
|
|
-re "Ambiguous item \"\"\\..*$gdb_prompt $"\
|
725 |
|
|
{ pass "complete 'set follow-fork-mode'"}
|
726 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'set follow-fork-mode'"}
|
727 |
|
|
timeout {fail "(timeout) complete 'set follow-fork-mode'"}
|
728 |
|
|
}
|
729 |
|
|
}
|
730 |
|
|
-re ".*$gdb_prompt $" { fail "complete 'set follow-fork-mode'" }
|
731 |
|
|
timeout { fail "(timeout) complete 'set follow-fork-mode'" }
|
732 |
|
|
}
|
733 |
|
|
|
734 |
|
|
# Restore globals modified in this test...
|
735 |
|
|
if [info exists old_inputrc] {
|
736 |
|
|
set env(INPUTRC) $old_inputrc
|
737 |
|
|
} else {
|
738 |
|
|
unset env(INPUTRC)
|
739 |
|
|
}
|
740 |
|
|
set timeout $oldtimeout1
|
741 |
|
|
|
742 |
|
|
return 0
|