d93f57548516acfdb255d088d28bb1f17ab915b2
[platform/upstream/binutils.git] / gdb / testsuite / gdb.base / completion.exp
1 # Copyright 1998, 1999 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
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 \"break" unambiguous (completes to filename "break.c")
42 #   "p \"break." unambiguous (should complete to "break.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 binfile ${objdir}/${subdir}/${testfile}
68 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
69     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
70 }
71
72 if [get_compiler_info ${binfile}] {
73     return -1;
74 }
75
76 gdb_exit
77
78 # Don't let a .inputrc file or an existing setting of INPUTRC mess up
79 # the test results.  Even if /dev/null doesn't exist on the particular
80 # platform, the readline library will use the default setting just by
81 # failing to open the file.  OTOH, opening /dev/null successfully will
82 # also result in the default settings being used since nothing will be
83 # read from this file.
84 global env
85 if [info exists env(INPUTRC)] {
86     set old_inputrc $env(INPUTRC)
87 }
88 set env(INPUTRC) "/dev/null"
89
90 gdb_start
91 gdb_reinitialize_dir $srcdir/$subdir
92 gdb_load ${binfile}
93
94 if ![runto_main] then {
95         perror "tests suppressed"
96 }
97
98 set oldtimeout1 $timeout
99 set timeout 30
100
101
102 send_gdb "hfgfh\t"
103 sleep 1
104 gdb_expect  {
105         -re "^hfgfh\\\x07$"\
106             { send_gdb "\n"
107               gdb_expect {
108                       -re "Undefined command: \"hfgfh\"\\.  Try \"help\"\\..*$gdb_prompt $"\
109                                         { pass "complete 'hfgfh'"}
110                       -re ".*$gdb_prompt $" { fail "complete 'hfgfh'"}
111                       timeout           {fail "(timeout) complete 'hfgfh'"}
112                      }
113             }
114         -re ".*$gdb_prompt $"       { fail "complete 'hfgfh'" }
115         timeout         { fail "(timeout) complete 'hfgfh'" }
116         }
117
118 #exp_internal 0
119
120 send_gdb "show output\t"
121 sleep 1
122 gdb_expect  {
123         -re "^show output-radix $"\
124             { send_gdb "\n"
125               gdb_expect {
126                       -re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
127                                         { pass "complete 'show output'"}
128                       -re ".*$gdb_prompt $" { fail "complete 'show output'"}
129                       timeout           {fail "(timeout) complete 'show output'"}
130                      }
131             }
132         -re "^show output$"\
133             { send_gdb "\n"
134                gdb_expect {
135                       -re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
136                                         { fail "complete 'show output'"}
137                       -re ".*$gdb_prompt $" { fail "complete 'show output'"}
138                       timeout           { fail "(timeout) complete 'show output'"}
139                      }
140
141              }
142
143         -re ".*$gdb_prompt $"       { fail "complete 'show output'" }
144         timeout         { fail "(timeout) complete 'show output'" }
145         }
146
147
148 send_gdb "show output-\t"
149 sleep 1
150 gdb_expect  {
151         -re "^show output-radix $"\
152             { send_gdb "\n"
153               gdb_expect {
154                       -re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
155                                         { pass "complete 'show output-'"}
156                       -re ".*$gdb_prompt $" { fail "complete 'show output-'"}
157                       timeout           {fail "(timeout) complete 'show output-'"}
158                      }
159             }
160         -re "^show output-$"\
161             { send_gdb "\n"
162                gdb_expect {
163                       -re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
164                                         { fail "complete 'show output-'"}
165                       -re ".*$gdb_prompt $" { fail "complete 'show output-'"}
166                       timeout           { fail "(timeout) complete 'show output-'"}
167                      }
168
169              }
170
171         -re ".*$gdb_prompt $"       { fail "complete 'show output-'" }
172         timeout         { fail "(timeout) complete 'show output-'" }
173         }
174
175 send_gdb "p\t"
176 sleep 1
177 gdb_expect  {
178         -re "^p\\\x07$"\
179             { send_gdb "\n"
180               sleep 1
181               gdb_expect {
182                       -re "The history is empty\\..*$gdb_prompt $"\
183                                         { pass "complete 'p'"}
184                       -re ".*$gdb_prompt $" { fail "complete 'p'"}
185                       timeout           {fail "(timeout) complete 'p' 2"}
186                      }
187             }
188         -re ".*$gdb_prompt $"       { fail "complete 'p'" }
189         timeout         { fail "(timeout) complete 'p' 1" }
190         }
191
192 send_gdb "p \t"
193 sleep 3
194 gdb_expect  {
195         -re "^p \\\x07$"\
196             { send_gdb "\n"
197               sleep 1
198               gdb_expect {
199                       -re "The history is empty\\..*$gdb_prompt $"\
200                                         { pass "complete 'p '"}
201                       -re ".*$gdb_prompt $" { fail "complete 'p '"}
202                       timeout           {fail "(timeout) complete 'p ' 1"}
203                      }
204             }
205         -re ".*$gdb_prompt $"       { fail "complete 'p '" }
206         timeout         { fail "(timeout) complete 'p ' 2" }
207         }
208
209
210 send_gdb "info t foo\t"
211 sleep 1
212 gdb_expect  {
213         -re "^info t foo\\\x07$"\
214             { send_gdb "\n"
215               gdb_expect {
216                       -re "Ambiguous info command \"t foo\": target, terminal, threads, tp, tracepoints, types\\..*$gdb_prompt $"\
217                                         { pass "complete 'info t foo'"}
218                       -re ".*$gdb_prompt $" { fail "complete 'info t foo'"}
219                       timeout           {fail "(timeout) complete 'info t foo'"}
220                      }
221             }
222         -re ".*$gdb_prompt $"       { fail "complete 'info t foo'" }
223         timeout         { fail "(timeout) complete 'info t foo'" }
224         }
225
226 send_gdb "info t\t"
227 sleep 1
228 gdb_expect  {
229         -re "^info t\\\x07$"\
230             { send_gdb "\n"
231               gdb_expect {
232                       -re "Ambiguous info command \"t\": target, terminal, threads, tp, tracepoints, types\\..
233 *$gdb_prompt $"\
234                                         { pass "complete 'info t'"}
235                       -re ".*$gdb_prompt $" { fail "complete 'info t'"}
236                       timeout           {fail "(timeout) complete 'info t'"}
237                      }
238             }
239         -re ".*$gdb_prompt $"       { fail "complete 'info t'" }
240         timeout         { fail "(timeout) complete 'info t'" }
241         }
242
243
244 send_gdb "info t \t"
245 sleep 1
246 gdb_expect  {
247         -re "^info t \\\x07$"\
248             { send_gdb "\n"
249               gdb_expect {
250                       -re "Ambiguous info command \"t \": target, terminal, threads, tp, tracepoints, types\\..
251 *$gdb_prompt $"\
252                                         { pass "complete 'info t '"}
253                       -re ".*$gdb_prompt $" { fail "complete 'info t '"}
254                       timeout           {fail "(timeout) complete 'info t '"}
255                      }
256             }
257         -re ".*$gdb_prompt $"       { fail "complete 'info t '" }
258         timeout         { fail "(timeout) complete 'info t '" }
259         }
260
261
262 send_gdb "info asdfgh\t"
263 sleep 1
264 gdb_expect  {
265         -re "^info asdfgh\\\x07$"\
266             { send_gdb "\n"
267               gdb_expect {
268                       -re "Undefined info command: \"asdfgh\".  Try \"help info\"\\..
269 *$gdb_prompt $"\
270                                         { pass "complete 'info asdfgh'"}
271                       -re ".*$gdb_prompt $" { fail "complete 'info asdfgh'"}
272                       timeout           {fail "(timeout) complete 'info asdfgh'"}
273                      }
274             }
275         -re ".*$gdb_prompt $"       { fail "complete 'info asdfgh'" }
276         timeout         { fail "(timeout) complete 'info asdfgh'" }
277         }
278
279
280 send_gdb "info asdfgh \t"
281 sleep 1
282 gdb_expect  {
283         -re "^info asdfgh \\\x07$"\
284             { send_gdb "\n"
285               gdb_expect {
286                       -re "Undefined info command: \"asdfgh \".  Try \"help info\"\\..
287 *$gdb_prompt $"\
288                                         { pass "complete 'info asdfgh '"}
289                       -re ".*$gdb_prompt $" { fail "complete 'info asdfgh '"}
290                       timeout           {fail "(timeout) complete 'info asdfgh '"}
291                      }
292             }
293         -re ".*$gdb_prompt $"       { fail "complete 'info asdfgh '" }
294         timeout         { fail "(timeout) complete 'info asdfgh '" }
295         }
296
297 send_gdb "info\t"
298 sleep 1
299 gdb_expect  {
300         -re "^info $"\
301             { send_gdb "\n"
302               gdb_expect {
303                       -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*info watchpoints.*\r\n\r\nType \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
304                                         { pass "complete 'info'"}
305                       -re ".*$gdb_prompt $" { fail "complete 'info'"}
306                       timeout           {fail "(timeout) complete 'info'"}
307                      }
308             }
309         -re ".*$gdb_prompt $"       { fail "complete 'info'" }
310         timeout         { fail "(timeout) complete 'info'" }
311         }
312
313 send_gdb "info \t"
314 sleep 1
315 gdb_expect  {
316         -re "^info \\\x07$"\
317             { send_gdb "\n"
318               gdb_expect {
319                       -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*Type \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
320                                         { pass "complete 'info '"}
321                       -re ".*$gdb_prompt $" { fail "complete 'info '"}
322                       timeout           {fail "(timeout) complete 'info '"}
323                      }
324             }
325         -re ".*$gdb_prompt $"       { fail "complete 'info '" }
326         timeout         { fail "(timeout) complete 'info '" }
327         }
328
329
330 send_gdb "info \t"
331 sleep 1
332 gdb_expect  {
333         -re "^info \\\x07$"\
334             { send_gdb "\t"
335               gdb_expect {
336                       -re "address.*types.*$gdb_prompt info $"\
337                           { send_gdb "\n"
338                             gdb_expect {
339                                      -re "\"info\".*unambiguous\\..*$gdb_prompt $"\
340                                         { pass "complete (2) 'info '"}
341                                      -re ".*$gdb_prompt $" { fail "complete (2) 'info '"}
342                                      timeout           {fail "(timeout) complete (2) 'info '"}
343                                     }
344                            }
345                       -re ".*$gdb_prompt $" { fail "complete (2) 'info '"}
346                       timeout           {fail "(timeout) complete (2) 'info '"}
347                      }
348             }
349         -re ".*$gdb_prompt $"       { fail "complete (2) 'info '" }
350         timeout         { fail "(timeout) complete (2) 'info '" }
351         }
352
353
354 send_gdb "p \"break\t"
355 sleep 1
356 gdb_expect  {
357         -re "^p \"break\\\x07$"\
358             { send_gdb "\n"
359               gdb_expect {
360                       -re ".*$gdb_prompt $" { fail "complete 'p \"break'"}
361                       timeout           {fail "(timeout) complete 'p \"break'"}
362                      }
363             }
364         -re "^p \"break\\.c\"$"\
365             {   send_gdb "\n"
366                 gdb_expect {
367                     -re ".*$gdb_prompt $" { pass "complete 'p \"break'"}
368                     timeout           {fail "(timeout) complete 'p \"break'"}
369                 }
370             }
371         -re "^p \"break.*$"
372             {   send_gdb "\n"
373                 gdb_expect {
374                     -re ".*$gdb_prompt $" { fail "complete 'p \"break'"}
375                     timeout           {fail "(timeout) complete 'p \"break'"}
376                 }
377             }
378         -re ".*$gdb_prompt $"       { fail "complete 'p \"break'" }
379         timeout         { fail "(timeout) complete 'p \"break'" }
380         }
381
382 setup_xfail "*-*-*"
383 send_gdb "p \"break.\t"
384 sleep 1
385 gdb_expect  {
386         -re "^p \"break\\.\\\x07$"\
387             { send_gdb "\n"
388               gdb_expect {
389                       -re ".*$gdb_prompt $" { fail "complete 'p \"break.'"}
390                       timeout           {fail "(timeout) complete 'p \"break.'"}
391                      }
392             }
393         -re "^p \"break\\.c\"$"\
394             {   send_gdb "\n"
395                 gdb_expect {
396                     -re ".*$gdb_prompt $" { pass "complete 'p \"break.'"}
397                     timeout           {fail "(timeout) complete 'p \"break.'"}
398                 }
399             }
400         -re "^p \"break\\..*$"
401             {   send_gdb "\n"
402                 gdb_expect {
403                     -re ".*$gdb_prompt $" { fail "complete 'p \"break.'"}
404                     timeout           {fail "(timeout) complete 'p \"break.'"}
405                 }
406             }
407         -re ".*$gdb_prompt $"       { fail "complete 'p \"break.'" }
408         timeout         { fail "(timeout) complete 'p \"break.'" }
409         }
410
411 send_gdb "p 'a\t"
412 sleep 1
413 gdb_expect  {
414         -re "^p 'a\\\x07$"\
415             { send_gdb "\n"
416               gdb_expect {
417                       -re "Invalid character constant\\..*$gdb_prompt $"\
418                                         { pass "complete 'p \'a'"}
419                       -re ".*$gdb_prompt $" { fail "complete 'p \'a'"}
420                       timeout           {fail "(timeout) complete 'p \'a'"}
421                      }
422             }
423         -re ".*$gdb_prompt $"       { fail "complete 'p \'a'" }
424         timeout         { fail "(timeout) complete 'p \'a'" }
425         }
426
427 send_gdb "p 'a\t"
428 sleep 1
429 gdb_expect {
430     -re "^p 'a\\\x07$" {
431         send_gdb "\t"
432         gdb_expect {
433             -re ".*argv.*$gdb_prompt p .a$" {
434                 send_gdb "\n"
435                 gdb_expect {
436                     -re "Invalid character constant\\..*$gdb_prompt $" {
437                         pass "complete (2) 'p \'a'"
438                     }
439                     -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
440                     timeout { fail "(timeout) complete (2) 'p \'a'" }
441                 }
442             }
443             -re "(There are $decimal possibilities\\.  Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
444                 send_gdb "n"
445                 gdb_expect {
446                     -re "\\(gdb\\) p 'a$" {
447                         send_gdb "\n"
448                         gdb_expect {
449                             -re "Invalid character constant\\..*$gdb_prompt $" {
450                                 pass "complete (2) 'p \'a'"
451                             }
452                             -re ".*$gdb_prompt $" { 
453                                 fail "complete (2) 'p \'a'"
454                             }
455                             timeout { fail "(timeout) complete (2) 'p \'a'" }
456                         }
457                     }
458                     -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
459                     timeout { fail "(timeout) complete (2) 'p \'a'" }
460                 }
461             }
462             -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
463             timeout { fail "(timeout) complete (2) 'p \'a'" }
464         }
465     }
466     -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
467     timeout { fail "(timeout) complete (2) 'p \'a'" }
468 }
469
470
471 send_gdb "p b-a\t"
472 sleep 1
473 gdb_expect {
474     -re "^p b-a\\\x07$" {
475         send_gdb "\n"
476         gdb_expect {
477             -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
478                 pass "complete 'p b-a'"
479             }
480             -re ".*$gdb_prompt $" {
481                 fail "complete 'p b-a'"
482             }
483             timeout {
484                 fail "(timeout) complete 'p b-a'"
485             }
486         }
487     }
488     -re ".*$gdb_prompt $" {
489         fail "complete 'p b-a'"
490     }
491     timeout {
492         fail "(timeout) complete 'p b-a'"
493     }
494 }
495
496 send_gdb "p b-a\t"
497 sleep 1
498 gdb_expect {
499     -re "^p b-a\\\x07$" {
500         send_gdb "\t"
501         gdb_expect {
502             -re ".*argv.*$gdb_prompt p b-a$" {
503                 send_gdb "\n"
504                 gdb_expect {
505                     -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
506                         pass "complete (2) 'p b-a'"
507                     }
508                     -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
509                     timeout { fail "(timeout) complete (2) 'p b-a'" }
510                 }
511             }
512             -re "(There are $decimal possibilities\\.  Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
513                 send_gdb "n"
514                 gdb_expect {
515                     -re "\\(gdb\\) p b-a$" {
516                         send_gdb "\n"
517                         gdb_expect {
518                             -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
519                                 pass "complete (2) 'p b-a'"
520                             }
521                             -re ".*$gdb_prompt $" {
522                                 fail "complete (2) 'p b-a'"
523                             }
524                             timeout { fail "(timeout) complete (2) 'p b-a'" }
525                         }
526                     }
527                     -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
528                     timeout { fail "(timeout) complete (2) 'p b-a'" }
529                 }
530             }
531             -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
532             timeout { fail "(timeout) complete (2) 'p b-a'" }
533         }
534     }
535     -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
536     timeout { fail "(timeout) complete (2) 'p b-a'" }
537 }
538
539 send_gdb "p b-\t"
540 sleep 1
541 gdb_expect  {
542     -re "^p b-\\\x07$" {
543         send_gdb "\t"
544         gdb_expect {
545             -re "(There are $decimal possibilities\\.  Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
546                 send_gdb "n"
547                 gdb_expect {
548                     -re "\\(gdb\\) p b-$" {
549                         send_gdb "\n"
550                         gdb_expect {
551                             -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
552                                 pass "complete (2) 'p b-'"
553                             }
554                             -re ".*$gdb_prompt $" {
555                                 fail "complete (2) 'p b-'"
556                             }
557                             timeout { fail "(timeout) complete (2) 'p b-'" }
558                         }
559                     }
560                     -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" }
561                     timeout { fail "(timeout) complete (2) 'p b-'" }
562                 }
563             }
564             -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" }
565             timeout { fail "(timeout) complete (2) 'p b-'" }
566         }
567     }
568     -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" }
569     timeout { fail "(timeout) complete (2) 'p b-'" }
570 }
571
572 send_gdb "file ${objdir}/Make\t"
573 sleep 1
574 gdb_expect  {
575         -re "file ${objdir}/Makefile.*$"\
576             { send_gdb "\n"
577               gdb_expect {
578                       -re "\r\nA program is being debugged already\\.  Kill it\\? \\(y or n\\) $"\
579                       { send_gdb "n\n"
580                         gdb_expect {
581                                 -re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
582                                         { pass "complete 'file Make'"}
583                                 -re ".*$gdb_prompt $" { fail "complete 'file Make'"}
584                                 timeout           {fail "(timeout) complete 'file Make'"}
585                                }
586                       }
587                       -re ".*$gdb_prompt $" { fail "complete 'file Make'"}
588                       timeout           {fail "(timeout) complete 'file Make'"}
589                      }
590             }
591         -re ".*$gdb_prompt $"       { fail "complete 'file Make'" }
592         timeout         { fail "(timeout) complete 'file Make'" }
593         }
594
595
596 send_gdb "file ${srcdir}/gdb.base/compl\t"
597 sleep 1
598 gdb_expect  {
599         -re "^file ${srcdir}/gdb.base/completion\\.exp $"\
600             { send_gdb "\n"
601               gdb_expect {
602                       -re "\r\nA program is being debugged already\\.  Kill it\\? \\(y or n\\) $"
603 \
604                       { send_gdb "n\n"
605                         gdb_expect {
606                                 -re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
607                                         { pass "complete 'file gdb.base/compl'"}
608                                 -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/compl'"}
609                                 timeout           {fail "(timeout) complete 'file gdb.base/compl'"}
610                                }
611                       }
612                       -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/compl'"}
613                       timeout           {fail "(timeout) complete 'file gdb.base/compl'"}
614                      }
615             }
616         -re ".*$gdb_prompt $"       { fail "complete 'file gdb.base/compl'" }
617         timeout         { fail "(timeout) complete 'file gdb.base/compl'" }
618         }
619
620 send_gdb "info func mark\t"
621 sleep 1
622 gdb_expect  {
623         -re "^info func mark.*er$"\
624             {
625               send_gdb "\t\t"
626               sleep 3
627               gdb_expect {
628                       -re "marker1.*$gdb_prompt info func marker$"\
629                       { send_gdb "\n"
630                         gdb_expect {
631                                 -re "All functions matching regular expression \"marker\":.*File.*break.c:\r\nint marker1\\(\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\
632                                                   { pass "complete 'info func mar'"}
633                                 -re ".*$gdb_prompt $" { fail "complete 'info func mar'"}
634                                 timeout           {fail "(timeout) complete 'info func mar'"}
635                                }
636                       }
637                       -re ".*$gdb_prompt $" { fail "complete 'info func mar'"}
638                       timeout           {fail "(timeout) complete 'info func mar'"}
639                      }
640             }
641         -re ".*$gdb_prompt $"       { fail "complete 'info func mar'" }
642         timeout         { fail "(timeout) complete 'info func mar'" }
643         }
644
645
646 send_gdb "set follow-fork-mode \t\t"
647 sleep 1
648 gdb_expect  {
649         -re "ask.*child.*parent.*$gdb_prompt set follow-fork-mode $"\
650             { send_gdb "\n"
651               gdb_expect {
652                       -re "Requires an argument.*ask.*child.*parent.*$gdb_prompt $"\
653                                         { pass "complete 'set follow-fork-mode'"}
654                       -re "Ambiguous item \"\"\\..*$gdb_prompt $"\
655                                         { pass "complete 'set follow-fork-mode'"}
656                       -re ".*$gdb_prompt $" { fail "complete 'set follow-fork-mode'"}
657                       timeout           {fail "(timeout) complete 'set follow-fork-mode'"}
658                      }
659             }
660         -re ".*$gdb_prompt $"       { fail "complete 'set follow-fork-mode'" }
661         timeout         { fail "(timeout) complete 'set follow-fork-mode'" }
662         }
663
664 # Restore globals modified in this test...
665 if [info exists old_inputrc] {
666     set env(INPUTRC) $old_inputrc
667 } else {
668     unset env(INPUTRC)
669 }
670 set timeout $oldtimeout1
671
672 return 0