Provide completer for "info registers"
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / completion.exp
1 # Copyright 1998-2014 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 Elena Zannoni (ezannoni@cygnus.com)
17
18 # This file is part of the gdb testsuite.
19
20 #
21 # tests for command completion
22 #
23 # Here are some useful test cases for completion.
24 # They should be tested with both M-? and TAB.
25 #
26 # "show output-" "radix"
27 # "show output" "-radix"
28 # "p" ambiguous (commands starting with p--path, print, printf, etc.)
29 # "p " ambiguous (all symbols)
30 # "info t foo" no completions
31 # "info t " no completions
32 # "info t" ambiguous ("info target", "info terminal", etc.)
33 # "info ajksdlfk" no completions
34 # "info ajksdlfk " no completions
35 # "info" " "
36 # "info " ambiguous (all info commands)
37 # "p \"break1" unambiguous (completes to filename "break1.c")
38 # "p \"break1." unambiguous (should complete to "break1.c" but does not,
39 # due to readline limitations)
40 # "p 'arg" ambiguous (all symbols starting with arg)
41 # "p b-arg" ambiguous (all symbols starting with arg)
42 # "p b-" ambiguous (all symbols)
43 # "file Make" "file" (word break hard to screw up here)
44 # "file ../gdb.stabs/we" "ird" (needs to not break word at slash)
45 #
46
47
48
49 #
50 # test running programs
51 #
52
53 standard_testfile break.c break1.c
54
55 if [get_compiler_info] {
56 return -1
57 }
58
59 if {[prepare_for_testing $testfile.exp $testfile \
60 [list $srcfile $srcfile2] {debug nowarnings}]} {
61 untested $testfile.exp
62 return -1
63 }
64
65 if ![runto_main] then {
66 perror "tests suppressed"
67 }
68
69 set timeout 30
70
71 gdb_test_no_output "complete print values\[0\].x." \
72 "field completion with invalid field"
73
74 # If there is a non-deprecated completion, it should be returned.
75 gdb_test "complete sav" "save" "test non-deprecated completion"
76 # If there is only a deprecated completion, then it should be returned.
77 gdb_test "complete save-t" "save-tracepoints" "test deprecated completion"
78
79
80 #
81 # Tag name completion.
82 #
83
84 gdb_test "complete ptype struct some_" "ptype struct some_struct"
85 gdb_test "complete ptype enum some_" "ptype enum some_enum"
86 gdb_test "complete ptype union some_" "ptype union some_union"
87
88
89 gdb_test "complete set gnutarget aut" "set gnutarget auto"
90
91
92 gdb_test "complete set cp-abi aut" "set cp-abi auto"
93
94 # Test that completion of commands 'target FOO' works well.
95 set targets [list "core" "tfile" "exec"]
96
97 # Test that completion of command 'target ctf' if GDB supports ctf
98 # target.
99 gdb_test_multiple "target ctf" "" {
100 -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" {
101 }
102 -re "No CTF directory specified.*\r\n$gdb_prompt $" {
103 lappend targets "ctf"
104 }
105 }
106
107 # Test artifacts are put in different locations depending on test
108 # is a parallel run or not. Firstly check file exists, and then
109 # do the test on file completion.
110
111 foreach dir1 [ list "./gdb.base" "./outputs/gdb.base/completion" ] {
112 if { [remote_file host exists ${dir1}/completion]
113 && [remote_file host exists ${dir1}/completion0.o]
114 && [remote_file host exists ${dir1}/completion1.o] } {
115 foreach target_name ${targets} {
116 gdb_test "complete target ${target_name} ${dir1}/completion" \
117 "target ${target_name} ${dir1}/completion.*${dir1}/completion0\\.o.*${dir1}/completion1\\.o.*" \
118 "complete target ${target_name}"
119 }
120 break
121 }
122 }
123
124 #
125 # "set foo unlimited" completion.
126 #
127
128 # A var_uinteger command.
129 gdb_test "complete set height " "set height unlimited"
130 gdb_test "complete set height u" "set height unlimited"
131
132 # A var_integer command.
133 gdb_test "complete set listsize " "set listsize unlimited"
134 gdb_test "complete set listsize unl" "set listsize unlimited"
135
136 # A var_zuinteger_unlimited command.
137 gdb_test "complete set trace-buffer-size " "set trace-buffer-size unlimited"
138 gdb_test "complete set trace-buffer-size unl" "set trace-buffer-size unlimited"
139
140 # Test "info registers" completion: First determine this
141 # architecture's registers and reggroups...
142
143 set regs_output [capture_command_output "mt print registers" \
144 ".*Name.*Nr.*Rel.*Offset.*Size.*Type.\[^\n\]*\n"]
145 append regs_output "\n"
146 append regs_output [capture_command_output "mt print reggroups" \
147 ".*Group.*Type\[^\n]*\n"]
148 set all_regs {}
149 foreach {- reg} [regexp -all -inline -line {^\s+(\w+)} $regs_output] {
150 lappend all_regs $reg
151 }
152
153 set regs_output [capture_command_output "mt print user-registers" \
154 ".*Nr.*Name\[^\n]*\n"]
155 foreach {- reg} [regexp -all -inline -line {^\s+\d+\s+(\w+)} $regs_output] {
156 lappend all_regs $reg
157 }
158
159 set all_regs [join [lsort -unique $all_regs]]
160
161 # ... and then compare them to the completion of "info registers".
162
163 set regs_output [capture_command_output "complete info registers " ""]
164 set completed_regs {}
165 foreach {-> reg} [regexp -all -inline -line {^info registers (\w+\S*)} $regs_output] {
166 lappend completed_regs $reg
167 }
168 set completed_regs [join [lsort $completed_regs]]
169 gdb_assert {{$all_regs eq $completed_regs}} "complete 'info registers '"
170
171 # Tests below are about tab-completion, which doesn't work if readline
172 # library isn't used. Check it first.
173
174 if { ![readline_is_used] } {
175 return -1
176 }
177
178 set test "complete 'hfgfh'"
179 send_gdb "hfgfh\t"
180 gdb_test_multiple "" "$test" {
181 -re "^hfgfh\\\x07$" {
182 send_gdb "\n"
183 gdb_test_multiple "" $test {
184 -re "Undefined command: \"hfgfh\"\\. Try \"help\"\\..*$gdb_prompt $" {
185 pass "$test"
186 }
187 }
188 }
189 }
190
191 #exp_internal 0
192
193 set test "complete 'show output'"
194 send_gdb "show output\t"
195 gdb_test_multiple "" "$test" {
196 -re "^show output-radix $" {
197 send_gdb "\n"
198 gdb_test_multiple "" "$test" {
199 -re "Default output radix for printing of values is 10\\..*$gdb_prompt $" {
200 pass "$test"
201 }
202 }
203 }
204 }
205
206 set test "complete 'show output-'"
207 send_gdb "show output-\t"
208 gdb_test_multiple "" "$test" {
209 -re "^show output-radix $" {
210 send_gdb "\n"
211 gdb_test_multiple "" "$test" {
212 -re "Default output radix for printing of values is 10\\..*$gdb_prompt $" {
213 pass "$test"
214 }
215 }
216 }
217 }
218
219 set test "complete 'p'"
220 send_gdb "p\t"
221 gdb_test_multiple "" "$test" {
222 -re "^p\\\x07$" {
223 send_gdb "\n"
224 gdb_test_multiple "" "$test" {
225 -re "The history is empty\\..*$gdb_prompt $" {
226 pass "$test"
227 }
228 }
229 }
230 }
231
232 set test "complete 'p '"
233 send_gdb "p \t"
234 gdb_test_multiple "" "$test" {
235 -re "^p \\\x07$" {
236 send_gdb "\n"
237 gdb_test_multiple "" "$test" {
238 -re "The history is empty\\..*$gdb_prompt $" {
239 pass "$test"
240 }
241 }
242 }
243 }
244
245 set test "complete 'info t foo'"
246 send_gdb "info t foo\t"
247 gdb_test_multiple "" "$test" {
248 -re "^info t foo\\\x07$" {
249 send_gdb "\n"
250 gdb_test_multiple "" "$test" {
251 -re "Ambiguous info command \"t foo\": target, tasks, terminal, threads, tp, tracepoints, tvariables, (type-printers, )?types\\..*$gdb_prompt $" {
252 pass "$test"
253 }
254 }
255 }
256 }
257
258 set test "complete 'info t'"
259 send_gdb "info t\t"
260 gdb_test_multiple "" "$test" {
261 -re "^info t\\\x07$" {
262 send_gdb "\n"
263 gdb_test_multiple "" "$test" {
264 -re "Ambiguous info command \"t\": target, tasks, terminal, threads, tp, tracepoints, tvariables, (type-printers, )?types\\..*$gdb_prompt $" {
265 pass "$test"
266 }
267 }
268 }
269 }
270
271 set test "complete 'info t '"
272 send_gdb "info t \t"
273 gdb_test_multiple "" "$test" {
274 -re "^info t \\\x07$" {
275 send_gdb "\n"
276 gdb_test_multiple "" "$test" {
277 -re "Ambiguous info command \"t \": target, tasks, terminal, threads, tp, tracepoints, tvariables, (type-printers, )?types\\..*$gdb_prompt $" {
278 pass "$test"
279 }
280 }
281 }
282 }
283
284 set test "complete 'info asdfgh'"
285 send_gdb "info asdfgh\t"
286 gdb_test_multiple "" "$test" {
287 -re "^info asdfgh\\\x07$" {
288 send_gdb "\n"
289 gdb_test_multiple "" "$test" {
290 -re "Undefined info command: \"asdfgh\". Try \"help info\"\\..*$gdb_prompt $" {
291 pass "$test"
292 }
293 }
294 }
295 }
296
297 set test "complete 'info asdfgh '"
298 send_gdb "info asdfgh \t"
299 gdb_test_multiple "" "$test" {
300 -re "^info asdfgh \\\x07$" {
301 send_gdb "\n"
302 gdb_test_multiple "" "$test" {
303 -re "Undefined info command: \"asdfgh \". Try \"help info\"\\..*$gdb_prompt $" {
304 pass "$test"
305 }
306 }
307 }
308 }
309
310 set test "complete 'info'"
311 send_gdb "info\t"
312 gdb_test_multiple "" "$test" {
313 -re "^info $" {
314 send_gdb "\n"
315 gdb_test_multiple "" "$test" {
316 -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands.*$gdb_prompt $" {
317 pass "$test"
318 }
319 }
320 }
321 }
322
323 set test "complete 'info '"
324 send_gdb "info \t"
325 gdb_test_multiple "" "$test" {
326 -re "^info \\\x07$" {
327 send_gdb "\n"
328 gdb_test_multiple "" "$test" {
329 -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*$gdb_prompt $" {
330 pass "$test"
331 }
332 }
333 }
334 }
335
336 set test "complete (2) 'info '"
337 send_gdb "info \t"
338 gdb_test_multiple "" "$test" {
339 -re "^info \\\x07$" {
340 send_gdb "\t"
341 gdb_test_multiple "" "$test" {
342 -re "address.*types.*$gdb_prompt " {
343 send_gdb "\n"
344 gdb_test_multiple "" "$test" {
345 -re "\"info\".*unambiguous\\..*$gdb_prompt $" {
346 pass "$test"
347 }
348 }
349 }
350 }
351 }
352 }
353
354 set test "complete 'help info wat'"
355 send_gdb "help info wat\t"
356 gdb_test_multiple "" "$test" {
357 -re "^help info watchpoints $" {
358 send_gdb "\n"
359 gdb_test_multiple "" "$test" {
360 -re "Status of specified watchpoints.*\r\n.*$gdb_prompt $" {
361 pass "$test"
362 }
363 }
364 }
365 -re "^help info wat\\\x07$" {
366 fail "$test"
367 }
368 }
369
370 set test "complete 'p \"break1'"
371 send_gdb "p \"break1\t"
372 gdb_test_multiple "" "$test" {
373 -re "^p \"break1\\\x07$" {
374 send_gdb "\n"
375 gdb_test_multiple "" "$test" {}
376 }
377 -re "^p \"break1\\.c\"$" {
378 send_gdb "\n"
379 gdb_test_multiple "" "$test" {
380 -re "$gdb_prompt $" {
381 pass "$test"
382 }
383 }
384 }
385 }
386
387 setup_xfail "*-*-*"
388 set test "complete 'p \"break1.'"
389 send_gdb "p \"break1.\t"
390 gdb_test_multiple "" "$test" {
391 -re "^p \"break1\\.\\\x07$" {
392 send_gdb "\n"
393 gdb_test_multiple "" "$test" {}
394 }
395 -re "^p \"break1\\.c\"$" {
396 send_gdb "\n"
397 gdb_test_multiple "" "$test" {
398 -re "$gdb_prompt $" {
399 pass "$test"
400 }
401 }
402 }
403 -re "^p \"break1\\..*$" {
404 send_gdb "\n"
405 gdb_test_multiple "" "$test" {}
406 }
407 }
408
409 set test "complete 'p 'arg'"
410 send_gdb "p 'arg\t"
411 gdb_test_multiple "" "$test" {
412 -re "^p 'arg\\\x07$" {
413 send_gdb "\n"
414 gdb_test_multiple "" "$test" {
415 -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" {
416 pass "$test"
417 }
418 }
419 }
420 }
421
422 set test "complete (2) 'p 'arg'"
423 send_gdb "p 'arg\t"
424 gdb_test_multiple "" "$test" {
425 -re "^p 'arg\\\x07$" {
426 send_gdb "\t"
427 gdb_test_multiple "" "$test" {
428 -re "argv.*$gdb_prompt " {
429 send_gdb "\n"
430 gdb_test_multiple "" "$test" {
431 -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" {
432 pass "$test"
433 }
434 }
435 }
436 -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
437 send_gdb "n"
438 gdb_test_multiple "" "$test" {
439 -re "\\(gdb\\) p 'arg$" {
440 send_gdb "\n"
441 gdb_test_multiple "" "$test" {
442 -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" {
443 pass "$test"
444 }
445 }
446 }
447 }
448 }
449 }
450 }
451 }
452
453 set test "complete 'handle signal'"
454 send_gdb "handle sigq\t"
455 gdb_test_multiple "" "$test" {
456 -re "^handle sigq\b\b\b\bSIGQUIT $" {
457 send_gdb "\n"
458 gdb_test_multiple "" "$test" {
459 -re "SIGQUIT.*Quit.*$gdb_prompt $" {
460 pass "$test"
461 }
462 }
463 }
464 }
465
466 set test "complete 'handle keyword'"
467 send_gdb "handle nos\t"
468 gdb_test_multiple "" "$test" {
469 -re "^handle nostop $" {
470 send_gdb "\n"
471 gdb_test_multiple "" "$test" {
472 -re "$gdb_prompt $" {
473 pass "$test"
474 }
475 }
476 }
477 }
478
479 set test "complete help aliases"
480 send_gdb "help user-define\t"
481 gdb_test_multiple "" "$test" {
482 -re "^help user-defined $" {
483 send_gdb "\n"
484 gdb_test_multiple "" "$test" {
485 -re "$gdb_prompt $" {
486 pass "$test"
487 }
488 }
489 }
490 }
491
492
493 # These tests used to try completing the shorter "p b-a".
494 # Unfortunately, on some systems, there are .o files in system
495 # libraries which declare static variables named `b'. Of course,
496 # those variables aren't really in scope, as far as the compiler is
497 # concerned. But GDB deliberately tries to be more liberal: if you
498 # enter an identifier that doesn't have any binding in scope, GDB will
499 # search all the program's compilation units for a static variable of
500 # the given name.
501 #
502 # This behavior can help avoid a lot of pedantry, so it's usually a
503 # good thing. But in this test case, it causes GDB to print the value
504 # of some random variable, instead of giving us the "No symbol..."
505 # error we were expecting.
506 #
507 # For example, on S/390 linux, the file s_atan.c in libm.a declares a
508 # `b', which is a structure containing an int and a float, so GDB says
509 # ``Argument to arithmetic operation not a number or boolean'' instead
510 # of ``No symbol ...''.
511 #
512 # So, I'm hoping that there is no system with a static library variable named
513 # `no_var_by_this_name'.
514
515 set test "complete 'p no_var_named_this-arg'"
516 send_gdb "p no_var_named_this-arg\t"
517 gdb_test_multiple "" "$test" {
518 -re "^p no_var_named_this-arg\\\x07$" {
519 send_gdb "\n"
520 gdb_test_multiple "" "$test" {
521 -re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
522 pass "$test"
523 }
524 }
525 }
526 }
527
528 set test "complete (2) 'p no_var_named_this-arg'"
529 send_gdb "p no_var_named_this-arg\t"
530 gdb_test_multiple "" "$test" {
531 -re "^p no_var_named_this-arg\\\x07$" {
532 send_gdb "\t"
533 gdb_test_multiple "" "$test" {
534 -re "argv.*$gdb_prompt " {
535 send_gdb "\n"
536 gdb_test_multiple "" "$test" {
537 -re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
538 pass "$test"
539 }
540 }
541 }
542 -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
543 send_gdb "n\n"
544
545 # Eat the prompt
546 gdb_expect {
547 -re "$gdb_prompt " {
548 pass "$test (eat prompt)"
549 }
550 timeout {
551 fail "(timeout) $test (eat prompt)"
552 }
553 }
554
555 gdb_test_multiple "" "$test" {
556 -re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
557 pass "$test"
558 }
559 }
560 }
561 }
562 }
563 }
564
565 set test "complete (2) 'p no_var_named_this-'"
566 send_gdb "p no_var_named_this-\t"
567 gdb_test_multiple "" "$test" {
568 -re "^p no_var_named_this-\\\x07$" {
569 send_gdb "\t"
570 gdb_test_multiple "" "$test" {
571 -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
572 send_gdb "n\n"
573
574 # Eat the prompt
575 gdb_expect {
576 -re "$gdb_prompt " {
577 pass "$test (eat prompt)"
578 }
579 timeout {
580 fail "(timeout) $test (eat prompt)"
581 }
582 }
583
584 gdb_test_multiple "" "$test" {
585 -re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
586 pass "$test"
587 }
588 }
589 }
590 -re "argv.*$gdb_prompt $" {
591 send_gdb "\n"
592 gdb_test_multiple "" "$test" {
593 -re "No symbol \"no_var_named_this\" in current context\\..*$gdb_prompt $" {
594 pass "$test"
595 }
596 }
597 }
598 }
599 }
600 }
601
602 set test "complete 'p values\[0\].a'"
603 send_gdb "p values\[0\].a\t"
604 gdb_test_multiple "" "$test" {
605 -re "^p values.0..a_field $" {
606 send_gdb "\n"
607 gdb_test_multiple "" "$test" {
608 -re " = 0.*$gdb_prompt $" {
609 pass "$test"
610 }
611 }
612 }
613 }
614
615 set test "complete 'p values\[0\] . a'"
616 send_gdb "p values\[0\] . a\t"
617 gdb_test_multiple "" "$test" {
618 -re "^p values.0. . a_field $" {
619 send_gdb "\n"
620 gdb_test_multiple "" "$test" {
621 -re " = 0.*$gdb_prompt $" {
622 pass "$test"
623 }
624 }
625 }
626 }
627
628 set test "complete 'p &values\[0\] -> a'"
629 send_gdb "p &values\[0\] -> a\t"
630 gdb_test_multiple "" "$test" {
631 -re "^p &values.0. -> a_field $" {
632 send_gdb "\n"
633 gdb_test_multiple "" "$test" {
634 -re " = .*0x\[0-9a-fA-F\]*.*$gdb_prompt $" {
635 pass "$test"
636 }
637 }
638 }
639 }
640
641 gdb_test "complete p &values\[0\]->z" \
642 "p &values.0.->z_field" \
643 "completion of field in anonymous union"
644
645 gdb_test "complete ptype &values\[0\]->z" \
646 "ptype &values.0.->z_field" \
647 "ptype completion of field in anonymous union"
648
649 gdb_test "complete whatis &values\[0\]->z" \
650 "whatis &values.0.->z_field" \
651 "whatis completion of field in anonymous union"
652
653 # The following tests used to simply try to complete `${objdir}/file',
654 # and so on. The problem is that ${objdir} can be very long; the
655 # completed filename may be more than eighty characters wide. When
656 # this happens, readline tries to manage things, producing output that
657 # may make sense on the screen, but is rather hard for our script to
658 # recognize.
659 #
660 # In the case that motivated this change, the (gdb) prompt occupied
661 # the leftmost six columns, and `${objdir}/' was seventy-four
662 # characters long --- eighty in all. After printing the slash,
663 # readline emitted a space, a carriage return, and then `Makefile'
664 # (the tab character being received as input after `Make'.
665 #
666 # Basically, you have to let readline do whatever it's going to do to
667 # make the screen look right. If it happens to use a different
668 # strategy on Tuesdays to get the cursor in the right place, that's
669 # not something the testsuite should care about.
670 #
671 # So, we avoid long lines. We `cd' to ${objdir} first, and then do
672 # the completion relative to the current directory.
673
674 # ${srcdir} may be a relative path. We want to make sure we end up
675 # in the right directory - so make sure we know where it is.
676 set mydir [pwd]
677 cd ${srcdir}
678 set fullsrcdir [pwd]
679 cd ${mydir}
680
681 # If the directory name contains a '+' we must escape it, adding a backslash.
682 # If not, the test below will fail because it will interpret the '+' as a
683 # regexp operator. We use string_to_regexp for this purpose.
684
685 gdb_test "cd ${fullsrcdir}" \
686 "Working directory [string_to_regexp ${fullsrcdir}].*" \
687 "cd to \${srcdir}"
688
689
690 # GDB used to fail adding / on directories, on the first try only.
691 set uniquedir ../testsuite/gdb.base/comp-dir
692 set escapeduniquedir [string_to_regexp ${uniquedir}]
693 set uniquesu subdi
694 set uniquesub ${uniquesu}r
695 set escapeuniquesub [string_to_regexp ${uniquesub}]
696 send_gdb "dir ${uniquedir}\t"
697 gdb_expect {
698 -re "${escapeduniquedir}/" {
699 pass "directory completion"
700 send_gdb "${uniquesu}\t"
701 }
702 -re "${escapeduniquedir} $" {
703 fail "directory completion (old gdb bug)"
704 send_gdb "\b/${uniquesu}\t"
705 }
706 default {
707 fail "directory completion (timeout)"
708 send_gdb "\ndir ${uniquedir}/${uniquesu}\t"
709 }
710 }
711
712 gdb_expect {
713 -re "${escapeuniquesub}/$" {
714 pass "directory completion 2"
715 }
716 timeout {
717 fail "directory completion 2"
718 }
719 }
720
721 # Empty COMMAND sends no newline while " " sends the newline we need.
722 gdb_test " " "Source directories searched: .*" "Glob remaining of directory test"
723
724 gdb_test "complete file ./gdb.base/compl" \
725 "file ./gdb.base/completion\\.exp.*" \
726 "complete-command 'file ./gdb.base/compl'"
727
728 set test "complete 'file ./gdb.base/complet'"
729 send_gdb "file ./gdb.base/complet\t"
730 gdb_test_multiple "" "$test" {
731 -re "^file ./gdb.base/completion\\.exp $" {
732 send_gdb "\n"
733 # Ignore the exact error message.
734 gdb_test_multiple "" "complete 'file ./gdb.base/complet'" {
735 -re "\r\nA program is being debugged already\\.\[\r\n\]+Are you sure you want to change the file\\? \\(y or n\\) $" {
736 send_gdb "n\n"
737 exp_continue
738 }
739 -re "$gdb_prompt $" {
740 pass "$test"
741 }
742 }
743 }
744 }
745
746 set test "complete 'info func marke'"
747 send_gdb "info func marke\t"
748 gdb_test_multiple "" "$test" {
749 -re "^info func marke.*r$" {
750 send_gdb "\t\t"
751 gdb_test_multiple "" "$test" {
752 -re "marker1.*$gdb_prompt " {
753 send_gdb "\n"
754 gdb_test_multiple "" "$test" {
755 -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 $" {
756 pass "$test"
757 }
758 }
759 }
760 }
761 }
762 }
763
764
765 set test "complete 'set follow-fork-mode'"
766 send_gdb "set follow-fork-mode \t\t"
767 gdb_test_multiple "" "$test" {
768 -re "child.*parent.*$gdb_prompt " {
769 send_gdb "\n"
770 gdb_test_multiple "" "$test" {
771 -re "Requires an argument.*child.*parent.*$gdb_prompt $" {
772 pass "$test"
773 }
774 -re "Ambiguous item \"\"\\..*$gdb_prompt $" {
775 pass "$test"
776 }
777 }
778 }
779 }
780
781 return 0
This page took 0.0671 seconds and 5 git commands to generate.