1 # Copyright
1988-2024 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Start with a fresh gdb
21 set prev_timeout $timeout
25 # test default actions of gdb commands
28 gdb_test
"add-symbol-file" "add-symbol-file takes a file name and an address"
31 gdb_test
"append" "List of append subcommands:.*"
32 gdb_test
"append binary" "List of append binary subcommands:.*"
33 gdb_test
"append memory" "Missing filename\."
34 gdb_test
"append value" "Missing filename\."
35 gdb_test
"append binary memory" "Missing filename\."
36 gdb_test
"append binary value" "Missing filename\."
39 gdb_test_multiple
"attach" "attach" {
40 -re
"Argument required .(process-id|program) to attach.*$gdb_prompt $"\
42 -re
"You can't do that when your target is `None'.*$gdb_prompt $"\
44 -re
"You can't do that without a process to debug.*$gdb_prompt $"\
46 -re
"Don't know how to attach. Try \"help target\"..*$gdb_prompt $"\
48 -re
"Kill it. .y or n." {
54 gdb_test
"break" "No default breakpoint address now."
55 foreach i
"b br bre brea" {
56 gdb_test $i
"No default breakpoint address now." "break \"$i\" abbreviation"
60 gdb_test
"backtrace" "No stack."
62 # ba and bac are no longer unique command prefixes. So these tests
63 # elict an error from GDB.
64 # GDB needs to be fixed to map unique alias here
for ba bac.
66 foreach i
"bt ba bac" {
67 gdb_test $i
"No stack." "backtrace \"$i\" abbreviation"
71 gdb_test
"continue" "The program is not being run."
72 gdb_test
"c" "The program is not being run." "continue \"c\" abbreviation"
75 gdb_test
"call" "The history is empty..*"
79 gdb_test
"catch" "List of catch subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help catch\" followed by catch subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
82 gdb_test
"cd" "Working directory \[^\r\n\]*\(\r\n \\(canonically \[^\r\n\]*\\)\)?\\."
85 gdb_test
"clear" "No source file specified..*"
88 gdb_test
"commands" "Argument required .one or more breakpoint numbers...*"
91 gdb_test
"condition" "Argument required .breakpoint number.*"
94 gdb_test
"core-file" "No core file now."
95 #test
delete "d" abbreviation
96 gdb_test_no_output
"d" "delete \"d\" abbreviation"
98 gdb_test_no_output
"delete" "delete"
100 gdb_test
"define" "Argument required \[(\]name of command to define\[)\]."
101 #test
delete breakpoints
102 gdb_test_no_output
"delete breakpoints" "delete breakpoints"
104 # FIXME
-- need to dump full output to detailed
log
106 gdb_test
"delete display" \
108 "delete display prompt" \
109 "Delete all auto-display expressions.*y or n. $" \
114 gdb_test
"detach" ".*"
117 # FIXME
-- need to dump full output to detailed
log
119 gdb_test
"directory" \
120 "Source directories searched: .cdir\[:;\].cwd.*" \
122 "Reinitialize source path to empty.*y or n. $" \
125 #test disable
"dis" abbreviation
126 gdb_test_no_output
"dis" "disable \"dis\" abbreviation"
127 #test disable
"disa" abbreviation
128 gdb_test_no_output
"disa" "disable \"disa\" abbreviation"
130 gdb_test_no_output
"disable" "disable"
131 #test disable breakpoints
132 gdb_test_no_output
"disable breakpoints" "disable breakpoints"
133 #test disable display
134 gdb_test_no_output
"disable display" "disable display"
136 gdb_test
"disassemble" "No frame selected."
138 gdb_test_no_output
"display" "display"
140 gdb_test
"do" "No stack."
142 gdb_test
"document" "Argument required .name of command to define.*"
144 gdb_test
"down" "No stack.*"
146 gdb_test
"down-silently" "No stack."
148 gdb_test
"dump" "List of dump subcommands:.*"
149 gdb_test
"dump binary" "List of dump binary subcommands:.*"
150 gdb_test
"dump ihex" "List of dump ihex subcommands:.*"
151 gdb_test
"dump memory" "Missing filename\."
152 gdb_test
"dump srec" "List of dump srec subcommands:.*"
153 gdb_test
"dump tekhex" "List of dump tekhex subcommands:.*"
154 gdb_test
"dump value" "Missing filename\."
155 gdb_test
"dump binary memory" "Missing filename\."
156 gdb_test
"dump binary value" "Missing filename\."
157 gdb_test
"dump ihex memory" "Missing filename\."
158 gdb_test
"dump ihex value" "Missing filename\."
159 gdb_test
"dump srec memory" "Missing filename\."
160 gdb_test
"dump srec value" "Missing filename\."
161 gdb_test
"dump tekhex memory" "Missing filename\."
162 gdb_test
"dump tekhex value" "Missing filename\."
164 gdb_test_no_output
"echo" "echo"
165 #test enable breakpoints
delete
166 gdb_test
"enable breakpoints delete" "Argument required .one or more breakpoint numbers.*"
167 #test enable breakpoints once
168 gdb_test
"enable breakpoints once" "Argument required .one or more breakpoint numbers.*"
169 #test enable breakpoints
170 gdb_test_no_output
"enable breakpoints" "enable breakpoints"
172 gdb_test
"enable delete" "Argument required .one or more breakpoint numbers.*"
174 gdb_test_no_output
"enable display" "enable display"
176 gdb_test
"enable once" "Argument required .one or more breakpoint numbers.*"
178 gdb_test_no_output
"enable" "enable"
180 send_gdb
"exec-file\n"
182 -re
"No executable file now..*$gdb_prompt $" {
185 -re
"exec-file.*A program is being debugged already. Kill it. .y or n.*$" {
188 send_user
"\tDidn't kill program being debugged\n"
190 gdb_expect
-re
"$gdb_prompt $" { }
193 -re
"$gdb_prompt $" { fail "exec-file" }
194 timeout
{ fail
"(timeout) exec-file" }
197 #test frame
"f" abbreviation
198 gdb_test
"f" "No stack." "frame \"f\" abbreviation"
200 gdb_test
"frame" "No stack."
202 gdb_test
"fg" "The program is not being run."
207 -re
"No executable file now..*$gdb_prompt $"\
209 -re
".*A program is being debugged already. Kill it. .y or n.*$" {
212 send_user
"\t\tDidn't kill program being debugged\n"
214 gdb_expect
-re
"$gdb_prompt $" { }
217 -re
".*$gdb_prompt $" { fail "file" }
218 timeout
{ fail
"(timeout) file" }
222 gdb_test
"finish" "The program is not being run."
224 # The message here comes from the regexp library
, not gdb
, and so can
225 # vary
on different systems.
226 gdb_test
"forward-search" "No previous regular expression.*|There is no previous regular expression.*"
229 gdb_test_multiple
"gcore" "gcore" {
230 -re
"You can\'t do that without a process to debug.*$gdb_prompt $" {
233 -re
"Undefined command: .*$gdb_prompt $" {
238 gdb_test_multiple
"generate-core-file" "generate-core-file" {
239 -re
"You can\'t do that without a process to debug.*$gdb_prompt $" {
240 pass
"generate-core-file"
242 -re
"Undefined command: .*$gdb_prompt $" {
243 pass
"generate-core-file"
247 #test help
"h" abbreviation
248 gdb_test
"h" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- User-defined aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "help \"h\" abbreviation"
250 gdb_test
"help" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- User-defined aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
252 gdb_test
"handle" "Argument required .signal to handle.*"
253 #test
info "i" abbreviation
254 gdb_test
"i" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
256 gdb_test
"info" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
258 gdb_test
"ignore" "Argument required .a breakpoint number.*"
260 gdb_test
"info address" "Argument required."
261 #test
info all
-registers
262 gdb_test
"info all-registers" "The program has no registers now."
264 gdb_test
"info args" "No frame selected."
265 #test
info bogus
-gdb
-command
266 gdb_test
"info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\". Try \"help info\".*"
267 #test
info breakpoints
268 gdb_test
"info breakpoints" "No breakpoints, watchpoints, tracepoints, or catchpoints."
270 # The license
text is very big
, so it may overwhelm Expect
's output buffer
271 # and cause the test to fail occasionally. To avoid this problem, verify
272 # the command's output in small chunks.
280 # These excerpts were chosen
for no particular reason
, except that they
281 # occur at the beginning
, middle and end of the license
text.
282 set re_header
[multi_line \
283 "\\s+GNU GENERAL PUBLIC LICENSE" \
284 "\\s+Version 3, 29 June 2007" \
286 " Copyright \\(C\\) 2007 Free Software Foundation, Inc. <http://fsf.org/>" \
287 " Everyone is permitted to copy and distribute verbatim copies" \
288 " of this license document, but changing it is not allowed." \
292 " The GNU General Public License is a free, copyleft license for" \
293 "software and other kinds of works.\r\n"]
294 set re_terms
[multi_line \
295 "\\s+TERMS AND CONDITIONS" \
299 " \"This License\" refers to version 3 of the GNU General Public License.\r\n"]
300 set re_section5
[multi_line \
301 " 5. Conveying Modified Source Versions." \
303 " You may convey a work based on the Program, or the modifications to\r\n"]
304 set re_section7
[multi_line \
305 " 7. Additional Terms." \
307 " \"Additional permissions\" are terms that supplement the terms of this\r\n"]
308 set re_section10
[multi_line \
309 " 10. Automatic Licensing of Downstream Recipients." \
311 " Each time you convey a covered work, the recipient automatically\r\n"]
312 set re_section14
[multi_line \
313 " 14. Revised Versions of this License." \
315 " The Free Software Foundation may publish revised and/or new versions of\r\n"]
316 set re_last_para
[multi_line \
317 " Later license versions may give you additional or different" \
318 "permissions. However, no additional obligations are imposed on any" \
319 "author or copyright holder as a result of your choosing to follow a" \
320 "later version.\r\n"]
321 set test
"info copying"
322 gdb_test_multiple $test $test
{
351 -re
"$gdb_prompt \$" {
352 gdb_assert
{ $saw_header
&& $saw_terms
&& $saw_section5 \
353 && $saw_section7
&& $saw_section10 \
354 && $saw_section14
&& $saw_last_para
} $test
358 gdb_test
"info display" "There are no auto-display expressions now."
359 #test
info frame
"f" abbreviation
360 gdb_test
"info f" "No stack.*|No selected frame.*" "info frame \"f\" abbreviation"
362 gdb_test
"info frame" "No stack.|No selected frame."
364 gdb_test_no_output
"info files" "info files"
366 gdb_test
"info float" "The program has no registers now."
368 gdb_test
"info functions" "All defined functions:"
370 gdb_test
"info locals" "No frame selected."
372 gdb_test
"info program" "The program being debugged is not being run."
374 gdb_test
"info registers" "The program has no registers now."
375 #test
info stack
"s" abbreviation
376 gdb_test
"info s" "No stack." "info stack \"s\" abbreviation"
378 gdb_test
"info stack" "No stack."
380 # Test improved to check three parts
:
384 # And only succeed
if all three are matched.
385 # This should fix an old problem
on native solaris
2.8,
386 # where this test fails due to this line
:
387 # prompt
: Gdb
's prompt is "(gdb) ".^M
388 set set_confirm_seen 0
389 set set_prompt_seen 0
390 gdb_test_multiple "info set" "info set" {
391 -re "confirm: Whether to confirm potentially dangerous operations is o\[a-z\]*.(\[^\r\n\]*\[\r\n\])+history filename: The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+listsize: Number of source lines gdb will list by default is 10" {
392 verbose "Confirm dislayed"
393 set set_confirm_seen 1
396 -re "Gdb's prompt is
\"$gdb_prompt
\"" {
397 verbose
"GDB prompt displayed"
398 set set_prompt_seen
1
401 -re
"Writing into executable.*$gdb_prompt $" {
402 verbose
"write displayed"
403 if { $set_prompt_seen
&& $set_confirm_seen
} {
406 verbose
"prompt $set_prompt_seen confirm $set_confirm_seen"
407 fail
"info set (incomplete output)"
411 gdb_test
"info symbol" "Argument required .address.."
413 gdb_test
"info source" "No current source file..*"
415 gdb_test
"info sources" "No symbol table is loaded. Use the \"file\" command.*"
417 gdb_test_no_output
"info target" "info target"
419 gdb_test
"info terminal" "No saved terminal information."
421 gdb_test
"info threads" "No threads."
423 gdb_test
"info types" "All defined types:"
425 gdb_test
"info variables" "All defined variables:"
427 gdb_test
"info vector" "The program has no registers now."
429 gdb_test
"info warranty" "15. *Disclaimer of Warranty.*"
430 #test
info watchpoints
431 gdb_test
"info watchpoints" "No watchpoints."
433 gdb_test
"inspect" "The history is empty."
435 gdb_test
"jump" "The program is not being run."
437 gdb_test
"kill" "The program is not being run."
438 #test list
"l" abbreviation
439 gdb_test
"l" "No symbol table is loaded. Use the \"file\" command.*" "list \"l\" abbreviation"
441 gdb_test
"list" "No symbol table is loaded. Use the \"file\" command.*"
443 # The ``takes a file
name'' case is
for vxgdb.
444 # The ``Use the
"file" command'' case is for newer GDB versions which try
445 # to deduce the filename from the exec file.
446 gdb_test
"load" "You can't do that when your target is `None'.*|The load command takes a file name.*|Must specify at least a file name with the load command.*|.*Use the .file. or .exec-file. command.*"
447 #test next
"n" abbreviation
448 gdb_test
"n" "The program is not being run." "next \"n\" abbreviation"
450 gdb_test
"next" "The program is not being run."
451 #test nexti
"ni" abbreviation
452 gdb_test
"ni" "The program is not being run." "nexti \"ni\" abbreviation"
454 gdb_test
"nexti" "The program is not being run."
456 gdb_test
"output" "Argument required .expression to compute.*"
459 gdb_test
"overlay" "List of overlay subcommands:.*"
460 #test a non
-existant overlay subcommand
461 gdb_test
"overlay on" "Undefined overlay command.* Try \"help overlay\"."
462 gdb_test_no_output
"overlay manual" "overlay manual #1"
463 gdb_test_no_output
"overlay auto"
464 gdb_test_no_output
"overlay off"
465 gdb_test
"overlay list" "No sections are mapped."
466 gdb_test
"overlay map" "Overlay debugging not enabled.*" "overlay map #1"
467 gdb_test
"overlay unmap" "Overlay debugging not enabled.*" "overlay unmap #1"
468 gdb_test_no_output
"overlay manual" "overlay manual #2"
469 gdb_test
"overlay map" "Argument required: name of an overlay section" "overlay map #2"
470 gdb_test
"overlay unmap" "Argument required: name of an overlay section" "overlay unmap #2"
472 #test print
"p" abbreviation
473 gdb_test
"p" "The history is empty." "print \"p\" abbreviation"
475 gdb_test
"print" "The history is empty."
477 gdb_test
"printf" "Argument required .format-control string and values to print.*"
479 gdb_test
"ptype" "The history is empty."
481 gdb_test
"pwd" "Working directory .*"
483 #test run
"r" abbreviation
485 # Only extended
-remote supports
"run".
487 gdb_test_multiple
"r" "run \"r\" abbreviation" {
488 -re
"Starting program: .*You can't do that when your target is `None'.*$gdb_prompt $"\
489 { pass
"run \"r\" abbreviation" }
490 -re
"Starting program: .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
491 { pass
"run \"r\" abbreviation" }
492 -re
"Starting program: .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
493 { pass
"run \"r\" abbreviation" }
494 -re
"Starting program: .*No image loaded into target.*$gdb_prompt $"\
495 { pass
"run \"r\" abbreviation" }
496 -re
"Starting program: .*No program loaded.*$gdb_prompt $"\
497 { pass
"run \"r\" abbreviation" }
498 -re
"Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
499 { pass
"run \"r\" abbreviation" }
500 -re
"Starting program: .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
501 { pass
"run \"r\" abbreviation" }
507 # Only extended
-remote supports
"run".
509 gdb_test_multiple
"run" "run" {
510 -re
"Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $"\
512 -re
"Starting program: .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
514 -re
"Starting program: .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
516 -re
"Starting program: .*No image loaded into target.*$gdb_prompt $"\
518 -re
"Starting program: .*No program loaded.*$gdb_prompt $"\
520 -re
"Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
522 -re
"Starting program: .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
528 gdb_test
"rbreak" "No breakpoints made."
531 gdb_test
"restore" "You can't do that without a process to debug\."
534 # The middle case accommodated the obsolete a29k
, where doing the
"ni"
535 # above causes an initial stack to be created.
536 gdb_test
"return" "No selected frame..*"
540 gdb_test
"reverse-search" "No previous regular expression.*|There is no previous regular expression.*"
541 #test step
"s" abbreviation
542 gdb_test
"s" "The program is not being run." "step \"s\" abbreviation #1"
544 gdb_test
"step" "The program is not being run." "step #1"
546 gdb_test
"search" "No previous regular expression.*|There is no previous regular expression.*"
548 gdb_test
"section" "Must specify section name and its virtual address.*"
550 gdb_test
"set annotate" "Argument required .integer to set it to.*"
552 gdb_test_no_output
"set args" "set args"
554 # Test
set check abbreviations
555 foreach x
{"c" "ch" "check"} {
556 gdb_test
"set $x" "List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
557 "set check \"$x\" abbreviation"
560 #test
set check range
561 gdb_test
"set check range" ".*"
563 gdb_test
"set check type" ".*"
565 gdb_test
"set complaints" "Argument required .integer to set it to.*"
567 gdb_test_no_output
"set confirm" "set confirm"
568 # Don
't test set editing. What if we're talking to a gdb that
569 # won
't do editing correctly while we're talking to it?
570 # gdb_test
"set editing" "" "set editing"
572 #test
set environment
573 gdb_test
"set environment" "Argument required .environment variable and value.*"
575 gdb_test
"set height" "Argument required .integer to set it to.*"
576 #test
set history expansion
577 gdb_test_no_output
"set history expansion" "set history expansion"
578 # Make sure the history ends up in the right place.
579 gdb_test_no_output
"set history filename [standard_output_file .gdb_history]" \
580 "set the history filename"
581 #test
set history save
582 gdb_test_no_output
"set history save" "set history save"
583 #test
set history size
584 gdb_test
"set history size" "Argument required .integer to set it to.*"
586 gdb_test
"set history" "List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
588 gdb_test
"set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, asm, c, c.., d, fortran, go, minimal, modula-2, objective-c, opencl, pascal, rust."
590 gdb_test
"set listsize" "Argument required .integer to set it to.*"
591 #test
set print
"p" abbreviation
592 gdb_test
"set p" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
593 #test
set print
"pr" abbreviation
594 gdb_test
"set pr" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
596 gdb_test
"set print" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
597 #test
set print address
598 gdb_test_no_output
"set print address" "set print address"
599 #test
set print array
600 gdb_test_no_output
"set print array" "set print array"
601 #test
set print asm
-demangle
602 gdb_test_no_output
"set print asm-demangle" "set print asm-demangle"
603 #test
set print characters
604 gdb_test
"set print characters" \
605 "Argument required \\(integer to set it to, or one of:\
606 \"elements
\", \"unlimited
\"\\)\\.
"
607 #test
set print demangle
608 gdb_test_no_output
"set print demangle" "set print demangle"
609 #test
set print elements
610 gdb_test
"set print elements" \
611 "Argument required \\(integer to set it to, or \"unlimited\"\\)\\."
612 #test
set print object
613 gdb_test_no_output
"set print object" "set print object"
614 #test
set print pretty
615 gdb_test_no_output
"set print pretty" "set print pretty"
616 #test
set print sevenbit
-strings
617 gdb_test_no_output
"set print sevenbit-strings" "set print sevenbit-strings"
618 #test
set print union
619 gdb_test_no_output
"set print union" "set print union"
621 gdb_test_no_output
"set print vtbl" "set print vtbl"
622 # FIXME
-- need a test
for "set prompt"
624 gdb_test
"set radix" "Input and output radices now set to decimal 10, hex a, octal 12.*"
626 gdb_test
"set variable" "Argument required .expression to compute.*"
628 gdb_test_no_output
"set verbose" "set verbose"
630 gdb_test
"set width" "Argument required .integer to set it to.*"
632 # This is only supported
on targets which use exec.o.
633 gdb_test_no_output
"set write" "set write"
635 gdb_test
"set" "Argument required .expression to compute.*"
636 #test
shell echo Hi dad
!
637 gdb_test
"shell echo Hi dad!" "Hi dad!"
639 gdb_test
"show annotate" "Annotation_level is 0."
641 gdb_test
"show args" "Argument list to give program being debugged when it is started is \"\"."
643 # test
show check abbreviations
644 foreach x
{"c" "ch" "check"} {
645 gdb_test
"show $x" "check range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+check type: *Strict type checking is on\..*" \
646 "show check \"$x\" abbreviation"
649 #test
show check range
650 gdb_test
"show check range" "Range checking is \"auto; currently off\"."
651 #test
show check type
652 gdb_test
"show check type" "Strict type checking is on\."
654 gdb_test
"show commands" ".*"
655 #test
show complaints
656 gdb_test
"show complaints" "Max number of complaints about incorrect symbols is 0."
658 gdb_test
"show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*."
660 #test
show convenience
661 # This is trickier as there are multiple internal convenience vars and
662 # functions and we can
't assume any particular order.
663 # And we have to handle the extra convenience funs provided by Python.
671 {$_inferior_thread_count = 0} \
672 {$_exception = <error: No frame selected>} \
673 {$_probe_argc = <error: No frame selected>} \
674 {$_probe_arg0 = <error: No frame selected>} \
675 {$_probe_arg1 = <error: No frame selected>} \
676 {$_probe_arg2 = <error: No frame selected>} \
677 {$_probe_arg3 = <error: No frame selected>} \
678 {$_probe_arg4 = <error: No frame selected>} \
679 {$_probe_arg5 = <error: No frame selected>} \
680 {$_probe_arg6 = <error: No frame selected>} \
681 {$_probe_arg7 = <error: No frame selected>} \
682 {$_probe_arg8 = <error: No frame selected>} \
683 {$_probe_arg9 = <error: No frame selected>} \
684 {$_probe_arg10 = <error: No frame selected>} \
685 {$_probe_arg11 = <error: No frame selected>} \
686 {$_cimag = <internal function _cimag>} \
687 {$_creal = <internal function _creal>} \
688 {$_isvoid = <internal function _isvoid>} \
689 {$_shell = <internal function _shell>} \
690 {$_gdb_maint_setting_str = <internal function _gdb_maint_setting_str>} \
691 {$_gdb_maint_setting = <internal function _gdb_maint_setting>} \
692 {$_gdb_setting_str = <internal function _gdb_setting_str>} \
693 {$_gdb_setting = <internal function _gdb_setting>} \
696 {$_shell_exitsignal = void} \
697 {$_shell_exitcode = 0} \
699 if [allow_python_tests] {
700 append show_conv_list \
702 {$_memeq = <internal function _memeq>} \
703 {$_regex = <internal function _regex>} \
704 {$_streq = <internal function _streq>} \
705 {$_strlen = <internal function _strlen>} \
706 {$_as_string = <internal function _as_string>} \
707 {$_caller_is = <internal function _caller_is>} \
708 {$_caller_matches = <internal function _caller_matches>} \
709 {$_any_caller_is = <internal function _any_caller_is>} \
710 {$_any_caller_matches = <internal function _any_caller_matches>} \
713 gdb_test_list_exact "show convenience" "show convenience" \
714 "\[^\r\n\]+\[\r\n\]+" \
718 #test show directories
719 gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd"
721 gdb_test "show editing" "Editing of command lines as they are typed is o\[a-z\]*."
723 gdb_test "show height" "Number of lines gdb thinks are in a page is.*"
724 #test show history expansion
725 gdb_test "show history expansion" "History expansion on command input is o\[a-z\]*.*"
726 #test show history filename
727 gdb_test "show history filename" "The filename in which to record the command history is.*.gdb_history.*"
728 #test show history save
729 gdb_test "show history save" "Saving of the history record on exit is on."
730 #test show history size
731 gdb_test "show history size" "The size of the command history is.*"
733 gdb_test "show history" "history expansion: *History expansion on command input is o(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to record the command history is.*.gdb_history(\[^\r\n\]*\[\r\n\])+history save: *Saving of the history record on exit is o(\[^\r\n\]*\[\r\n\])+history size: * The size of the command history is.*"
735 gdb_test "show language" "The current source language is \"auto; currently c\"."
737 gdb_test "show listsize" "Number of source lines gdb will list by default is 10."
738 #test show print "p" abbreviation
739 gdb_test "show p" ".*"
740 #test show print "pr" abbreviation
741 gdb_test "show pr" ".*"
743 gdb_test "show print" ".*"
745 gdb_test "show paths" "Executable and object file path:.*"
746 #test show print address
747 gdb_test "show print address" "Printing of addresses is on."
748 #test show print array
749 gdb_test "show print array" "Pretty formatting of arrays is on."
750 #test show print asm-demangle
751 gdb_test "show print asm-demangle" "Demangling of C\[+\]+/ObjC names in disassembly listings is on."
752 #test show print characters
753 gdb_test "show print characters" \
754 "Limit on string characters to print is elements\\."
755 #test show print demangle
756 gdb_test "show print demangle" "Demangling of encoded C\[+\]+/ObjC names when displaying symbols is on."
757 #test show print elements
758 gdb_test "show print elements" "Limit on string chars or array elements to print is 200."
759 #test show print object
760 gdb_test "show print object" "Printing of object's derived type based
on vtable
info is
on.
"
761 #test
show print pretty
762 gdb_test
"show print pretty" "Pretty formatting of structures is on."
763 #test
show print sevenbit
-strings
764 gdb_test
"show print sevenbit-strings" "Printing of 8-bit characters in strings as .nnn is on."
765 #test
show print union
766 gdb_test
"show print union" "Printing of unions interior to structures is on."
767 #test
show print vtbl
768 gdb_test
"show print vtbl" "Printing of C\[+\]+ virtual function tables is on."
770 # In the FAIL case
, can
't just look for $gdb_prompt because that will match
771 # the output, rather than the prompt. So look for $gdb_prompt at the start
773 gdb_test "show prompt" "Gdb's prompt is
\"$gdb_prompt
\".
*"
775 gdb_test
"show radix" "Input and output radices set to decimal 10, hex a, octal 12."
777 gdb_test_no_output
"show user" "show user"
779 gdb_test_no_output
"show values" "show values"
781 gdb_test
"show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*"
783 gdb_test
"show version" "GNU gdb \[0-9\.\]*(\[^\r\n\]*\[\r\n\])+Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc(\[^\r\n\]*\[\r\n\])+License GPLv3\\+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>(\[^\r\n\]*\[\r\n\])+This is free software: you are free to change and redistribute it.(\[^\r\n\]*\[\r\n\])+There is NO WARRANTY, to the extent permitted by law.(\[^\r\n\]*\[\r\n\])+Type \"show copying\" and \"show warranty\" for details..*"
785 gdb_test
"show width" "Number of characters gdb thinks are in a line is.*"
787 # This is only supported
on targets which use exec.o.
788 gdb_test
"show write" "Writing into executable and core files is o.*"
790 set show_confirm_seen
0
791 set show_prompt_seen
0
792 gdb_test_multiple
"show" "show" {
793 -re
"confirm: *Whether to confirm potentially dangerous operations is on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+history save: *Saving of the history record on exit is on.(\[^\r\n\]*\[\r\n\])+history size: *The size of the command history is(\[^\r\n\]*\[\r\n\])+listsize: *Number of source lines gdb will list by default is 10(\[^\r\n]*\[\r\n\])+print elements: *Limit on string chars or array elements to print is 200." {
794 verbose
"Confirm displayed"
795 set show_confirm_seen
1
798 -re
"Gdb's prompt is \"$gdb_prompt \"" {
799 verbose
"GDB prompt displayed"
800 set show_prompt_seen
1
803 -re
"Writing into executable.*$gdb_prompt $" {
804 verbose
"write displayed"
805 if { $show_prompt_seen
&& $show_confirm_seen
} {
808 verbose
"prompt $show_prompt_seen confirm $show_confirm_seen"
809 fail
"show (incomplete output)"
813 #history saving should stay disabled
814 gdb_test_no_output
"set history save off" "set history save off"
815 #test stepi
"si" abbreviation
816 gdb_test
"si" "The program is not being run." "stepi \"si\" abbreviation"
818 gdb_test
"stepi" "The program is not being run."
820 gdb_test
"signal" "The program is not being run."
822 gdb_test
"source" "source command requires file name of file to source..*|No such file or directory.*"
823 #test step
"s" abbreviation
824 gdb_test
"s" "The program is not being run." "step \"s\" abbreviation #2"
826 gdb_test
"step" "The program is not being run." "step #2"
828 gdb_test
"symbol-file" ".*"
831 gdb_test
"target native" "Use the \"run\" command to start a process.*|Undefined target command: \"native\". *Try \"help target\".*"
834 send_gdb
"target core\n"
836 -re
"No core file specified..*$gdb_prompt $" { pass "target core" }
837 -re
".*A program is being debugged already. Kill it. .y or n.*$" {
840 send_user
"\t\tDidn't kill program being debugged\n"
842 gdb_expect
-re
"$gdb_prompt $" { }
845 -re
"Undefined target command: \"core\". Try \"help target\"..*$gdb_prompt $" { pass "target core" }
846 -re
".*$gdb_prompt $" { fail "target core" }
847 timeout
{ fail
"(timeout) target core" }
851 send_gdb
"target exec\n"
853 -re
"No executable file now..*$gdb_prompt $"\
854 { pass
"target exec" }
855 -re
".*A program is being debugged already. Kill it. .y or n.*$" {
858 send_user
"\t\tDidn't kill program being debugged\n"
860 gdb_expect
-re
"$gdb_prompt $" { }
863 -re
".*$gdb_prompt $" { fail "target exec" }
864 timeout
{ fail
"(timeout) target exec" }
868 send_gdb
"target remote\n"
870 -re
"To open a remote debug connection, you need to specify what.*serial.*device is attached to the remote system.*.e.g. .*$gdb_prompt $"\
871 { pass
"target remote" }
872 -re
".*A program is being debugged already. Kill it. .y or n.*$" {
875 send_user
"\t\tDidn't kill program being debugged\n"
877 gdb_expect
-re
"$gdb_prompt $" { }
880 -re
".*$gdb_prompt $" { fail "target remote" }
881 timeout
{ fail
"(timeout) target remote" }
885 gdb_test
"target" "List of target subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help target\" followed by target subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
887 gdb_test
"tbreak" "No default breakpoint address now."
889 gdb_test
"thread" "No thread selected"
891 gdb_test
"thread apply" "Please specify a thread ID list"
893 gdb_test
"thread find" "Command requires an argument."
895 gdb_test
"thread name" "No thread selected"
896 #test until
"u" abbreviation
897 gdb_test
"u" "The program is not being run." "until \"u\" abbreviation"
899 gdb_test
"until" "The program is not being run."
901 # FIXME
-- need to dump full output to detailed
log
903 gdb_test
"undisplay" \
906 "Delete all auto-display expressions.*y or n. $" \
909 #test unset environment
911 gdb_test
"unset environment" \
913 "unset environment prompt" \
914 "Delete all environment variables?.*y or n. $" \
918 gdb_test
"unset" "List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by unset subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
921 gdb_test
"up-silently" "No stack."
923 gdb_test
"watch" "Argument required .expression to compute.*"
925 gdb_test
"whatis" "The history is empty."
927 gdb_test
"where" "No stack."
929 gdb_test
"x" "Argument required .starting display address.*"
933 set timeout $prev_timeout