* lib/gdb.exp(gdb_test): Surround the result pattern with
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / default.exp
CommitLineData
1d30b948
JK
1# Start with a fresh gdb
2
3gdb_exit
4gdb_start
5
787f6220
BM
6match_max 8000
7
1d30b948
JK
8#
9# test default actions of gdb commands
10#
11
787f6220 12#load_lib gdb.exp
1d30b948 13
787f6220 14gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address" "add-symbol-file"
1d30b948
JK
15
16setup_xfail "mips-idt-*"
787f6220 17send_gdb "attach\n"
1d30b948 18expect {
85fbaa74 19 -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
1d30b948 20 { pass "attach" }
85fbaa74 21 -re "You can't do that when your target is `None'.*$gdb_prompt $"\
1d30b948 22 { pass "attach" }
85fbaa74 23 -re "Don't know how to attach. Try \"help target\"..*$gdb_prompt $"\
1d30b948
JK
24 { pass "attach" }
25 -re "Kill it. .y or n." {
787f6220 26 send_gdb "y\n"
1d30b948
JK
27 exp_continue
28 }
85fbaa74 29 -re "$gdb_prompt $" { fail "attach" }
1d30b948
JK
30 timeout { fail "(timeout) attach" }
31}
32
33# FIXME: attach kills the udi connection
787f6220 34if { [istarget "a29k-*-udi"] } {
1d30b948
JK
35 gdb_exit
36 gdb_start
37}
38
787f6220
BM
39if ![target_info exists use_gdb_stub] {
40 gdb_test "break" "No default breakpoint address now." "break"
41 foreach i "b br bre brea" {
42 gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation"
43 }
1d30b948 44
787f6220
BM
45
46 setup_xfail "mips-idt-*" "a29k-*-udi"
47 gdb_test "backtrace" "No stack."
48 foreach i "bt ba bac" {
49 setup_xfail "mips-idt-*" "a29k-*-udi"
50 gdb_test $i "No stack." "backtrace \"$i\" abbreviation"
51 }
52} else {
53 warning "Skipping backtrace and break tests because of GDB stub."
1d30b948
JK
54}
55
56# This works on the MIPS IDT board, but confuses future tests.
57if ![istarget "mips-idt-*"] then {
58 setup_xfail "a29k-*-udi"
787f6220 59 gdb_test "continue" "The program is not being run." "continue"
1d30b948
JK
60 setup_xfail "a29k-*-udi"
61 gdb_test "c" "The program is not being run." "continue \"c\" abbreviation"
62}
63
64# FIXME: continue kills the udi connection
65if [istarget "a29k-*-udi"] then {
66 gdb_exit
67 gdb_start
68}
69
70#test call
787f6220 71gdb_test "call" "The history is empty..*" "call"
1d30b948
JK
72
73
74#test catch
787f6220 75gdb_test "catch" "No selected frame..*" "catch"
1d30b948
JK
76
77#test cd
787f6220 78gdb_test "cd" "Argument required .new working directory.*" "cd"
1d30b948
JK
79
80#test clear
787f6220 81gdb_test "clear" "No source file specified..*" "clear"
1d30b948
JK
82
83#test commands
787f6220 84gdb_test "commands" "No breakpoint number 0..*" "commands"
1d30b948
JK
85
86#test condition
787f6220 87gdb_test "condition" "Argument required .breakpoint number.*" "condition"
1d30b948
JK
88
89#test core-file
787f6220 90gdb_test "core-file" "No core file now.|GDB can't read core files on this machine." "core-file"
1d30b948 91#test delete "d" abbreviation
787f6220 92gdb_test "d" "" "delete \"d\" abbreviation"
1d30b948 93#test delete
787f6220 94gdb_test "delete" "" "delete"
1d30b948 95#test define
787f6220 96gdb_test "define" "Argument required \[(\]name of command to define\[)\]." "define"
1d30b948 97#test delete breakpoints
787f6220 98gdb_test "delete breakpoints" "" "delete breakpoints"
1d30b948
JK
99#test delete display
100# FIXME -- need to dump full output to detailed log
787f6220 101send_gdb "delete display\n"
1d30b948 102expect {
787f6220
BM
103 -re "Delete all auto-display expressions.*y or n. $" {
104 send_gdb "y\n"
105 expect {
85fbaa74 106 -re "$gdb_prompt $" { pass "delete display prompt" }
787f6220 107 timeout { fail "(timeout) delete display prompt" }
1d30b948 108 }
787f6220
BM
109 }
110 timeout { fail "(timeout) delete display prompt" }
1d30b948 111
787f6220 112}
1d30b948
JK
113
114#test detach
787f6220 115gdb_test "detach" "" "detach"
1d30b948
JK
116
117# FIXME: continue kills the udi connection
118if [istarget "a29k-*-udi"] then {
119 gdb_exit
120 gdb_start
121}
122if [istarget "h8300-*-hms"] then {
123 gdb_exit
124 gdb_start
125}
126
127#test directory
128# FIXME -- need to dump full output to detailed log
1d30b948 129
787f6220 130send_gdb "directory\n"
1d30b948 131expect {
787f6220
BM
132 -re "Reinitialize source path to empty.*y or n. $" {
133 send_gdb "y\n"
134 expect {
85fbaa74 135 -re "Source directories searched: .cdir:.cwd.*$gdb_prompt $"\
787f6220
BM
136 { pass "directory prompt" }
137 timeout { fail "(timeout) directory prompt" }
1d30b948 138 }
787f6220
BM
139 }
140}
1d30b948 141
787f6220
BM
142#test disable "dis" abbreviation
143gdb_test "dis" "" "disable \"dis\" abbreviation"
1d30b948 144#test disable "disa" abbreviation
787f6220 145gdb_test "disa" "" "disable \"disa\" abbreviation"
1d30b948 146#test disable
787f6220 147gdb_test "disable" "" "disable"
1d30b948 148#test disable breakpoints
787f6220 149gdb_test "disable breakpoints" "" "disable breakpoints"
1d30b948 150#test disable display
787f6220 151gdb_test "disable display" "" "disable display"
1d30b948 152#test disassemble
787f6220 153gdb_test "disassemble" "No frame selected." "disassemble"
1d30b948 154#test display
787f6220 155gdb_test "display" "" "display"
1d30b948 156#test do
787f6220 157gdb_test "do" "No stack." "do"
1d30b948 158#test document
787f6220 159gdb_test "document" "Argument required .name of command to define.*" "document"
1d30b948 160#test down
787f6220 161gdb_test "down" "No stack.*" "down"
1d30b948 162#test down-silently
787f6220 163gdb_test "down-silently" "No stack." "down-silently"
1d30b948 164#test echo
787f6220 165gdb_test "echo" "" "echo"
1d30b948 166#test enable breakpoints delete
787f6220 167gdb_test "enable breakpoints delete" "Argument required .one or more breakpoint numbers.*" "enable breakpoints delete"
1d30b948 168#test enable breakpoints once
787f6220 169gdb_test "enable breakpoints once" "Argument required .one or more breakpoint numbers.*" "enable breakpoints once"
1d30b948 170#test enable breakpoints
787f6220 171gdb_test "enable breakpoints" "" "enable breakpoints"
1d30b948 172#test enable delete
787f6220 173gdb_test "enable delete" "Argument required .one or more breakpoint numbers.*" "enable delete"
1d30b948 174#test enable display
787f6220 175gdb_test "enable display" "" "enable display"
1d30b948 176#test enable once
787f6220 177gdb_test "enable once" "Argument required .one or more breakpoint numbers.*" "enable once"
1d30b948 178#test enable
787f6220 179gdb_test "enable" "" "enable"
1d30b948 180#test exec-file
787f6220 181send_gdb "exec-file\n"
1d30b948 182expect {
85fbaa74 183 -re "No exec file now..*$gdb_prompt $" {
1d30b948
JK
184 pass "exec-file"
185 }
186 -re "exec-file.*A program is being debugged already. Kill it. .y or n.*$" {
787f6220 187 send_gdb "n\n"
1d30b948
JK
188 if $verbose>1 then {
189 send_user "\tDidn't kill program being debugged\n"
190 }
85fbaa74 191 expect -re "$gdb_prompt $" { }
1d30b948
JK
192 pass "exec-file"
193 }
85fbaa74 194 -re "$gdb_prompt $" { fail "exec-file" }
787f6220
BM
195 timeout { fail "(timeout) exec-file" }
196}
1d30b948
JK
197
198#test frame "f" abbreviation
199setup_xfail "a29k-*-udi"
787f6220 200gdb_test "f" "No stack." "frame \"f\" abbreviation"
1d30b948
JK
201#test frame
202setup_xfail "a29k-*-udi"
787f6220 203gdb_test "frame" "No stack." "frame"
1d30b948
JK
204#test fg
205setup_xfail "a29k-*-udi"
787f6220 206gdb_test "fg" "The program is not being run." "fg"
1d30b948 207# FIXME: fg kills the udi connection
1d30b948 208#test file
787f6220 209send_gdb "file\n"
1d30b948 210expect {
85fbaa74 211 -re "No exec file now..*$gdb_prompt $"\
787f6220
BM
212 { pass "file" }
213 -re ".*A program is being debugged already. Kill it. .y or n.*$" {
214 send_gdb "n\n"
215 if $verbose>1 then {
216 send_user "\t\tDidn't kill program being debugged\n"
1d30b948 217 }
85fbaa74 218 expect -re "$gdb_prompt $" { }
787f6220
BM
219 pass "file"
220 }
85fbaa74 221 -re ".*$gdb_prompt $" { fail "file" }
787f6220
BM
222 timeout { fail "(timeout) file" }
223}
1d30b948
JK
224
225#test finish
226setup_xfail "a29k-*-udi"
787f6220 227gdb_test "finish" "The program is not running." "finish"
1d30b948
JK
228#test forward-search
229# The message here comes from the regexp library, not gdb, and so can
230# vary on different systems.
787f6220 231gdb_test "forward-search" "No previous regular expression.*|There is no previous regular expression.*" "forward-search"
1d30b948 232#test help "h" abbreviation
787f6220 233gdb_test "h" "List of classes of commands:.*\[\r\n\]+running -- Running the program.*\[\r\n\]+stack -- Examining the stack.*\[\r\n\]+data -- Examining data.*\[\r\n\]+breakpoints -- Making program stop at certain points.*\[\r\n\]+files -- Specifying and examining files.*\[\r\n\]+status -- Status inquiries.*\[\r\n\]+support -- Support facilities.*\[\r\n\]+user-defined -- User-defined commands.*\[\r\n\]+aliases -- Aliases of other commands.*\[\r\n\]+obscure -- Obscure features.*\[\r\n\]+Type \"help\" followed by a class name for a list of commands in that class..*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help \"h\" abbreviation"
1d30b948 234#test help
787f6220 235gdb_test "help" "List of classes of commands:.*\[\r\n\]+running -- Running the program.*\[\r\n\]+stack -- Examining the stack.*\[\r\n\]+data -- Examining data.*\[\r\n\]+breakpoints -- Making program stop at certain points.*\[\r\n\]+files -- Specifying and examining files.*\[\r\n\]+status -- Status inquiries.*\[\r\n\]+support -- Support facilities.*\[\r\n\]+user-defined -- User-defined commands.*\[\r\n\]+aliases -- Aliases of other commands.*\[\r\n\]+obscure -- Obscure features.*\[\r\n\]+Type \"help\" followed by a class name for a list of commands in that class..*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help"
1d30b948 236#test handle
787f6220 237gdb_test "handle" "Argument required .signal to handle.*" "handle"
1d30b948 238#test info "i" abbreviation
787f6220 239gdb_test "i" "\"info\" must be followed by the name of an info command..*\[\r\n\]+List of info subcommands:.*\[\r\n\]+Type \"help info\" followed by info subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
1d30b948 240#test info
787f6220 241gdb_test "info" "\"info\" must be followed by the name of an info command..*\[\r\n\]+List of info subcommands:.*\[\r\n\]+Type \"help info\" followed by info subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "info"
1d30b948 242#test ignore
787f6220 243gdb_test "ignore" "Argument required .a breakpoint number.*" "ignore"
1d30b948 244#test info address
787f6220 245gdb_test "info address" "Argument required." "info address"
1d30b948
JK
246#test info all-registers
247setup_xfail "a29k-*-udi"
787f6220 248gdb_test "info all-registers" "The program has no registers now." "info all-registers"
1d30b948 249#test info args
787f6220 250gdb_test "info args" "No frame selected." "info args"
1d30b948 251#test info bogus-gdb-command
787f6220 252gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\". Try \"help info\".*" "info bogus-gdb-command"
1d30b948 253#test info breakpoints
787f6220 254gdb_test "info breakpoints" "No breakpoints or watchpoints." "info breakpoints"
1d30b948 255#test info catch
787f6220 256gdb_test "info catch" "No frame selected." "info catch"
1d30b948
JK
257#test info copying
258# FIXME -- doesn't work worth a shit
787f6220
BM
259#send_gdb "info copying"
260# -re "GNU GENERAL PUBLIC LICENSE.*#of preserving the free status of all derivatives of our free software and.*#of promoting the sharing and reuse of software generally."#
261gdb_test "info copying"
1d30b948
JK
262# }
263#
264#
1d30b948 265#test info display
787f6220 266gdb_test "info display" "There are no auto-display expressions now." "info display"
1d30b948 267#test info frame "f" abbreviation
787f6220 268gdb_test "info f" "No stack.*|No selected frame.*" "info frame \"f\" abbreviation"
1d30b948 269#test info frame
787f6220 270gdb_test "info frame" "No stack.|No selected frame." "info frame"
1d30b948 271#test info files
787f6220 272gdb_test "info files" "" "info files"
1d30b948 273#test info float
787f6220 274gdb_test "info float" "No floating point info available for this processor." "info float"
1d30b948 275#test info functions
787f6220 276gdb_test "info functions" "All defined functions:" "info functions"
1d30b948 277#test info locals
787f6220 278gdb_test "info locals" "No frame selected." "info locals"
1d30b948
JK
279#test info program
280setup_xfail "a29k-*-udi"
787f6220 281gdb_test "info program" "The program being debugged is not being run." "info program"
1d30b948
JK
282#test info registers
283setup_xfail "a29k-*-udi"
787f6220 284gdb_test "info registers" "The program has no registers now." "info registers"
1d30b948
JK
285#test info stack "s" abbreviation
286setup_xfail "a29k-*-udi"
787f6220 287gdb_test "info s" "No stack." "info stack \"s\" abbreviation"
1d30b948
JK
288#test info stack
289setup_xfail "a29k-*-udi"
787f6220 290gdb_test "info stack" "No stack." "info stack"
1d30b948
JK
291#test info set
292# FIXME -- needs to match the entire output
787f6220 293gdb_test "info set" "confirm: Whether to confirm potentially dangerous operations is o\[a-z\]*..*\[\r\n\]+history filename: The filename in which to record the command history is .*\[\r\n\]+listsize: Number of source lines gdb will list by default is 10.*" "info set"
1d30b948 294#test info source
787f6220 295gdb_test "info source" "No current source file..*" "info source"
1d30b948 296#test info sources
787f6220 297gdb_test "info sources" "No symbol table is loaded. Use the \"file\" command.*" "info sources"
1d30b948 298#test info target
787f6220 299gdb_test "info target" "" "info target"
1d30b948 300#test info terminal
787f6220 301gdb_test "info terminal" "No saved terminal information." "info terminal"
1d30b948 302#test info types
787f6220 303gdb_test "info types" "All defined types:" "info types"
1d30b948 304#test info variables
787f6220 305gdb_test "info variables" "All defined variables:" "info variables"
1d30b948 306#test info warranty
787f6220 307gdb_test "info warranty" "NO WARRANTY.*\[\r\n\]+ *11. *BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY.*\[\r\n\]+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN.*\[\r\n\]+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES.*\[\r\n\]+PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED.*\[\r\n\]+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF.*\[\r\n\]+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS.*\[\r\n\]+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE.*\[\r\n\]+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,.*\[\r\n\]+REPAIR OR CORRECTION..*\[\r\n\]+ *12. *IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING.*\[\r\n\]+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR.*\[\r\n\]+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,.*\[\r\n\]+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING.*\[\r\n\]+OUT OF THE USE OR INABILITY TO USE THE PROGRAM .INCLUDING BUT NOT LIMITED.*\[\r\n\]+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY.*\[\r\n\]+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER.*\[\r\n\]+PROGRAMS., EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE.*\[\r\n\]+POSSIBILITY OF SUCH DAMAGES.*" "info warranty"
1d30b948 308#test info watchpoints
787f6220 309gdb_test "info watchpoints" "No breakpoints or watchpoints." "info watchpoints"
1d30b948 310#test inspect
787f6220 311gdb_test "inspect" "The history is empty." "inspect"
1d30b948
JK
312#test jump
313setup_xfail "a29k-*-udi"
787f6220 314gdb_test "jump" "The program is not being run." "jump"
1d30b948 315#test kill
787f6220 316gdb_test "kill" "The program is not being run." "kill"
1d30b948 317#test list "l" abbreviation
787f6220 318gdb_test "l" "No symbol table is loaded. Use the \"file\" command.*" "list \"l\" abbreviation"
1d30b948 319#test list
787f6220 320gdb_test "list" "No symbol table is loaded. Use the \"file\" command.*" "list"
1d30b948
JK
321#test load
322# The ``takes a file name'' case is for vxgdb.
323# The ``Use the "file" command'' case is for newer GDB versions which try
324# to deduce the filename from the exec file.
787f6220 325gdb_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.*" "load"
1d30b948
JK
326#test next "n" abbreviation
327setup_xfail "a29k-*-udi"
787f6220 328gdb_test "n" "The program is not being run." "next \"n\" abbreviation"
1d30b948
JK
329#test next
330setup_xfail "a29k-*-udi"
787f6220 331gdb_test "next" "The program is not being run." "next"
1d30b948
JK
332#test nexti "ni" abbreviation
333setup_xfail "a29k-*-udi"
787f6220 334gdb_test "ni" "The program is not being run." "nexti \"ni\" abbreviation"
1d30b948
JK
335#test nexti
336setup_xfail "a29k-*-udi"
787f6220 337gdb_test "nexti" "The program is not being run." "nexti"
1d30b948 338#test output
787f6220 339gdb_test "output" "Argument required .expression to compute.*" "output"
1d30b948 340#test print "p" abbreviation
787f6220 341gdb_test "p" "The history is empty." "print \"p\" abbreviation"
1d30b948 342#test print
787f6220 343gdb_test "print" "The history is empty." "print"
1d30b948 344#test printf
787f6220 345gdb_test "printf" "Argument required .format-control string and values to print.*" "printf"
1d30b948 346#test ptype
787f6220 347gdb_test "ptype" "The history is empty." "ptype"
1d30b948 348#test pwd
787f6220 349gdb_test "pwd" "Working directory .*" "pwd"
1d30b948
JK
350
351#test run "r" abbreviation
787f6220 352if [istarget "*-*-vxworks*"] then {
0d8017ba
BM
353 gdb_test "set args" "" ""
354
1d30b948
JK
355 gdb_test "r" "Starting program: .*
356You must specify a function name to run, and arguments if any"\
357 "run \"r\" abbreviation"
0d8017ba
BM
358 gdb_test "set args main" "" ""
359
1d30b948 360} else {
787f6220 361 send_gdb "r\n"
1d30b948
JK
362 expect {
363 -re "Starting program: .*
85fbaa74 364You can't do that when your target is `None'.*$gdb_prompt $"\
1d30b948
JK
365 { pass "run \"r\" abbreviation" }
366 -re "Starting program: .*
367No executable file specified.*
85fbaa74 368Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
1d30b948
JK
369 { pass "run \"r\" abbreviation" }
370 -re "Starting program: .*
85fbaa74 371No image loaded into target.*$gdb_prompt $"\
1d30b948 372 { pass "run \"r\" abbreviation" }
787f6220 373 -re "Starting program: .*
85fbaa74 374No program loaded.*$gdb_prompt $"\
787f6220 375 { pass "run \"r\" abbreviation" }
85fbaa74 376 -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
1d30b948 377 { pass "run \"r\" abbreviation" }
85fbaa74 378 -re ".*$gdb_prompt $" { fail "run \"r\" abbreviation" }
1d30b948
JK
379 timeout { fail "(timeout) run \"r\" abbreviation" }
380 }
381}
382
383#test run
787f6220 384if [istarget "*-*-vxworks*"] then {
0d8017ba
BM
385 gdb_test "set args" "" ""
386
1d30b948
JK
387 gdb_test "run" "Starting program: .*
388You must specify a function name to run, and arguments if any"
0d8017ba
BM
389 gdb_test "set args main" "" ""
390
1d30b948 391} else {
787f6220 392 send_gdb "run\n"
1d30b948 393 expect {
85fbaa74 394 -re "Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $" { pass "run" }
1d30b948
JK
395 -re "Starting program: .*
396No executable file specified.*
85fbaa74 397Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
1d30b948
JK
398 { pass "run" }
399 -re "Starting program: .*
85fbaa74 400No image loaded into target.*$gdb_prompt $"\
1d30b948 401 { pass "run" }
787f6220 402 -re "Starting program: .*
85fbaa74 403No program loaded.*$gdb_prompt $"\
787f6220 404 { pass "run \"r\" abbreviation" }
85fbaa74 405 -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
1d30b948 406 { pass "run" }
85fbaa74 407 -re ".*$gdb_prompt $" { fail "run" }
1d30b948
JK
408 timeout { fail "(timeout) run" }
409 }
410}
411
412#test rbreak
787f6220 413gdb_test "rbreak" "" "rbreak"
1d30b948
JK
414
415#test return
416# The middle case accommodates the a29k, where doing the "ni" above causes
417# an initial stack to be created.
0d8017ba
BM
418gdb_test "return" "No selected frame..*" "return" "Make .* return now.*y or n. $" "y"
419
1d30b948 420
1d30b948 421#test reverse-search
787f6220 422gdb_test "reverse-search" "No previous regular expression.*|There is no previous regular expression.*" "reverse-search"
1d30b948
JK
423#test step "s" abbreviation
424setup_xfail "a29k-*-udi"
787f6220 425gdb_test "s" "The program is not being run." "step \"s\" abbreviation"
1d30b948
JK
426#test step
427setup_xfail "a29k-*-udi"
787f6220 428gdb_test "step" "The program is not being run." "step"
1d30b948 429#test search
787f6220 430gdb_test "search" "No previous regular expression.*|There is no previous regular expression.*" "search"
1d30b948 431#test section
787f6220
BM
432gdb_test "section" "Must specify section name and its virtual address.*" "section"
433#test set annotate
434gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate"
1d30b948 435#test set args
787f6220 436gdb_test "set args" "" "set args"
1d30b948 437#test set check "c" abbreviation
787f6220 438gdb_test "set c" "\"set check\" must be followed by the name of a check subcommand..*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set check \"c\" abbreviation"
1d30b948 439#test set check "ch" abbreviation
787f6220 440gdb_test "set ch" "\"set check\" must be followed by the name of a check subcommand..*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set check \"ch\" abbreviation"
1d30b948 441#test set check
787f6220 442gdb_test "set check" "\"set check\" must be followed by the name of a check subcommand..*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set check"
1d30b948 443#test set check range
787f6220 444gdb_test "set check range" "" "set check range"
1d30b948 445#test set check type
787f6220 446gdb_test "set check type" "" "set check type"
1d30b948 447#test set complaints
787f6220 448gdb_test "set complaints" "Argument required .integer to set it to.*" "set complaints"
1d30b948 449#test set confirm
787f6220
BM
450gdb_test "set confirm" "" "set confirm"
451# Don't test set editing. What if we're talking to a gdb that
452# won't do editing correctly while we're talking to it?
453# gdb_test "set editing" "" "set editing"
1d30b948
JK
454
455#test set environment
787f6220 456gdb_test "set environment" "Argument required .environment variable and value.*" "set environment"
1d30b948 457#test set height
787f6220 458gdb_test "set height" "Argument required .integer to set it to.*" "set height"
1d30b948 459#test set history expansion
787f6220 460gdb_test "set history expansion" "" "set history expansion"
1d30b948 461#test set history filename
787f6220 462gdb_test "set history filename" "Argument required .filename to set it to.*" "set history filename"
1d30b948 463#test set history save
787f6220 464gdb_test "set history save" "" "set history save"
1d30b948 465#test set history size
787f6220 466gdb_test "set history size" "Argument required .integer to set it to.*" "set history size"
1d30b948 467#test set history
787f6220 468gdb_test "set history" "\"set history\" must be followed by the name of a history subcommand..*\[\r\n\]+List of set history subcommands:.*\[\r\n\]+set history filename -- Set the filename in which to record the command history.*\[\r\n\]+set history size -- Set the size of the command history.*\[\r\n\]+set history save -- Set saving of the history record on exit.*\[\r\n\]+set history expansion -- Set history expansion on command input.*\[\r\n\]+Type \"help set history\" followed by set history subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set history"
1d30b948 469#test set language
787f6220 470gdb_test "set language" "The currently understood settings are:.*\[\r\n\]+local or auto *Automatic setting based on source file.*\[\r\n\]+c *Use the C language.*\[\r\n\]+c\[+\]+ *Use the C\[+\]+ language.*\[\r\n\]+modula-2 *Use the Modula-2 language.*" "set language"
1d30b948 471#test set listsize
787f6220 472gdb_test "set listsize" "Argument required .integer to set it to.*" "set listsize"
1d30b948 473#test set print "p" abbreviation
787f6220 474gdb_test "set p" "\"set print\" must be followed by the name of a print subcommand..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
1d30b948 475#test set print "pr" abbreviation
787f6220 476gdb_test "set pr" "\"set print\" must be followed by the name of a print subcommand..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
1d30b948 477#test set print
787f6220 478gdb_test "set print" "\"set print\" must be followed by the name of a print subcommand..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set print"
1d30b948 479#test set print address
787f6220 480gdb_test "set print address" "" "set print address"
1d30b948 481#test set print array
787f6220 482gdb_test "set print array" "" "set print array"
1d30b948 483#test set print asm-demangle
787f6220 484gdb_test "set print asm-demangle" "" "set print asm-demangle"
1d30b948 485#test set print demangle
787f6220 486gdb_test "set print demangle" "" "set print demangle"
1d30b948 487#test set print elements
787f6220 488gdb_test "set print elements" "Argument required .integer to set it to.*" "set print elements"
1d30b948 489#test set print object
787f6220 490gdb_test "set print object" "" "set print object"
1d30b948 491#test set print pretty
787f6220 492gdb_test "set print pretty" "" "set print pretty"
1d30b948 493#test set print sevenbit-strings
787f6220 494gdb_test "set print sevenbit-strings" "" "set print sevenbit-strings"
1d30b948 495#test set print union
787f6220 496gdb_test "set print union" "" "set print union"
1d30b948 497#test set print vtbl
787f6220 498gdb_test "set print vtbl" "" "set print vtbl"
1d30b948
JK
499# FIXME -- need a test for "set prompt"
500#test set radix
787f6220 501gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12.*" "set radix"
1d30b948 502#test set symbol-reloading
787f6220 503gdb_test "set symbol-reloading" "" "set symbol-reloading"
1d30b948 504#test set variable
787f6220 505gdb_test "set variable" "Argument required .expression to compute.*" "set variable"
1d30b948 506#test set verbose
787f6220 507gdb_test "set verbose" "" "set verbose"
1d30b948 508#test set width
787f6220 509gdb_test "set width" "Argument required .integer to set it to.*" "set width"
1d30b948
JK
510#test set write
511# This is only supported on targets which use exec.o.
787f6220 512gdb_test "set write" "" "set write"
1d30b948 513#test set
787f6220 514gdb_test "set" "Argument required .expression to compute.*" "set"
1d30b948 515#test shell echo Hi dad!
787f6220
BM
516gdb_test "shell echo Hi dad!" "Hi dad!" "shell echo Hi dad!"
517#test show annotate
518gdb_test "show annotate" "Annotation_level is 0." "show annotate"
1d30b948 519#test show args
787f6220 520gdb_test "show args" "Arguments to give program being debugged when it is started is \"\"." "show args"
1d30b948 521#test show check "c" abbreviation
787f6220 522gdb_test "show c" "range: *Range checking is \"auto; currently off\"..*\[\r\n\]+type: *Type checking is \"auto; currently off\".*" "show check \"c\" abbreviation"
1d30b948 523#test show check "ch" abbreviation
787f6220 524gdb_test "show ch" "range: *Range checking is \"auto; currently off\"..*\[\r\n\]+type: *Type checking is \"auto; currently off\"." "show check \"ch\" abbreviation"
1d30b948 525#test show check
787f6220 526gdb_test "show check" "range: *Range checking is \"auto; currently off\"..*\[\r\n\]+type: *Type checking is \"auto; currently off\"." "show check"
1d30b948 527#test show check range
787f6220 528gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range"
1d30b948 529#test show check type
787f6220 530gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type"
1d30b948 531#test show commands
787f6220 532gdb_test "show commands" "" "show commands"
1d30b948 533#test show complaints
787f6220 534gdb_test "show complaints" "Max number of complaints about incorrect symbols is 0." "show complaints"
1d30b948 535#test show confirm
787f6220 536gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm"
1d30b948 537#test show convenience
787f6220 538gdb_test "show convenience" "No debugger convenience variables now defined..*\[\r\n\]+Convenience variables have names starting with \".\";.*\[\r\n\]+use \"set\" as in \"set .foo = 5\" to define them." "show convenience"
1d30b948 539#test show directories
787f6220 540gdb_test "show directories" "Source directories searched: .cdir:.cwd" "show directories"
1d30b948 541#test show editing
787f6220 542gdb_test "show editing" "Editing of command lines as they are typed is o\[a-z\]*." "show editing"
1d30b948 543#test show height
787f6220 544gdb_test "show height" "Number of lines gdb thinks are in a page is.*" "show height"
1d30b948 545#test show history expansion
787f6220 546gdb_test "show history expansion" "History expansion on command input is o\[a-z\]*.*" "show history expansion"
1d30b948 547#test show history filename
787f6220 548gdb_test "show history filename" "The filename in which to record the command history is.*.gdb_history.*" "show history filename"
1d30b948 549#test show history save
787f6220 550gdb_test "show history save" "Saving of the history record on exit is on." "show history save"
1d30b948 551#test show history size
787f6220 552gdb_test "show history size" "The size of the command history is.*" "show history size"
1d30b948 553#test show history
787f6220 554gdb_test "show history" "filename: *The filename in which to record the command history is.*.gdb_history.*\[\r\n\]+size: * The size of the command history is.*\[\r\n\]+save: *Saving of the history record on exit is o.*\[\r\n\]+expansion: *History expansion on command input is o.*" "show history"
1d30b948 555#test show language
787f6220 556gdb_test "show language" "The current source language is \"auto; currently c\"." "show language"
1d30b948 557#test show listsize
787f6220 558gdb_test "show listsize" "Number of source lines gdb will list by default is 10." "show listsize"
1d30b948 559#test show print "p" abbreviation
787f6220 560gdb_test "show p" ".*" "show p"
1d30b948 561#test show print "pr" abbreviation
787f6220 562gdb_test "show pr" ".*" "show pr"
1d30b948 563#test show print
787f6220 564gdb_test "show print" "" "show print"
1d30b948 565#test show paths
787f6220 566gdb_test "show paths" "Executable and object file path:.*" "show paths"
1d30b948 567#test show print address
787f6220 568gdb_test "show print address" "Printing of addresses is on." "show print address"
1d30b948 569#test show print array
787f6220 570gdb_test "show print array" "Prettyprinting of arrays is on." "show print array"
1d30b948 571#test show print asm-demangle
787f6220 572gdb_test "show print asm-demangle" "Demangling of C\[+\]+ names in disassembly listings is on." "show print asm-demangle"
1d30b948 573#test show print demangle
787f6220 574gdb_test "show print demangle" "Demangling of encoded C\[+\]+ names when displaying symbols is on." "show print demangle"
1d30b948 575#test show print elements
787f6220 576gdb_test "show print elements" "Limit on string chars or array elements to print is 200." "show print elements"
1d30b948 577#test show print object
787f6220 578gdb_test "show print object" "Printing of object's derived type based on vtable info is on." "show print object"
1d30b948 579#test show print pretty
787f6220 580gdb_test "show print pretty" "Prettyprinting of structures is on." "show print pretty"
1d30b948 581#test show print sevenbit-strings
787f6220 582gdb_test "show print sevenbit-strings" "Printing of 8-bit characters in strings as .nnn is on." "show print sevenbit-strings"
1d30b948 583#test show print union
787f6220 584gdb_test "show print union" "Printing of unions interior to structures is on." "show print union"
1d30b948 585#test show print vtbl
787f6220 586gdb_test "show print vtbl" "Printing of C\[+\]+ virtual function tables is on." "show print vtbl"
1d30b948 587#test show prompt
85fbaa74
BM
588# In the FAIL case, can't just look for $gdb_prompt because that will match
589# the output, rather than the prompt. So look for $gdb_prompt at the start
1d30b948 590# of a line.
85fbaa74 591gdb_test "show prompt" "Gdb's prompt is \"$gdb_prompt \".*" "show prompt"
1d30b948 592#test show radix
787f6220 593gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12." "show radix"
1d30b948 594#test show symbol-reloading
787f6220 595gdb_test "show symbol-reloading" "Dynamic symbol table reloading multiple times in one run is on." "show symbol-reloading"
1d30b948 596#test show user
787f6220 597gdb_test "show user" "" "show user"
1d30b948 598#test show values
787f6220 599gdb_test "show values" "" "show values"
1d30b948 600#test show verbose
787f6220 601gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose"
1d30b948 602#test show version
1d30b948 603
787f6220 604gdb_test "show version" "GNU gdb \[0-9\.\]*.*\[\r\n\]+Copyright \[0-9\]* Free Software Foundation, Inc.*\[\r\n\]+GDB is free software, covered by the GNU General Public License, and you are.*\[\r\n\]+welcome to change it and/or distribute copies of it under certain conditions.*\[\r\n\]+Type \"show copying\" to see the conditions.*\[\r\n\]+There is absolutely no warranty for GDB. Type \"show warranty\" for details.*\[\r\n\]+This GDB was configured as .*|GDB is free software and you are welcome to distribute copies of it.*\[\r\n\]+ under certain conditions; type \"show copying\" to see the conditions..*\[\r\n\]+There is absolutely no warranty for GDB; type \"show warranty\" for details..*\[\r\n\]+GDB.*Copyright \[0-9\]* Free Software Foundation, Inc.*" "show version"
1d30b948 605#test show width
787f6220 606gdb_test "show width" "Number of characters gdb thinks are in a line is.*" "show width"
1d30b948
JK
607#test show write
608# This is only supported on targets which use exec.o.
787f6220 609gdb_test "show write" "Writing into executable and core files is o.*" "show write"
1d30b948 610#test show
787f6220 611gdb_test "show" "confirm: *Whether to confirm potentially dangerous operations is on..*\[\r\n\]+history filename: *The filename in which to record the command history is .*\[\r\n\]+history size: *The size of the command history is.*\[\r\n\]+history save: *Saving of the history record on exit is on..*\[\r\n\]+print elements: *Limit on string chars or array elements to print is 200..*\[\r\n\]+listsize: *Number of source lines gdb will list by default is 10.*" "show"
1d30b948
JK
612#test stepi "si" abbreviation
613setup_xfail "a29k-*-udi"
787f6220 614gdb_test "si" "The program is not being run." "stepi \"si\" abbreviation"
1d30b948
JK
615#test stepi
616setup_xfail "a29k-*-udi"
787f6220 617gdb_test "stepi" "The program is not being run." "stepi"
1d30b948
JK
618#test signal
619setup_xfail "a29k-*-udi"
787f6220 620gdb_test "signal" "The program is not being run." "signal"
1d30b948 621#test source
787f6220 622gdb_test "source" "source command requires pathname of file to source..*|No such file or directory.*" "source"
1d30b948
JK
623#test step "s" abbreviation
624setup_xfail "a29k-*-udi"
787f6220 625gdb_test "s" "The program is not being run." "step \"s\" abbreviation"
1d30b948
JK
626#test step
627setup_xfail "a29k-*-udi"
787f6220 628gdb_test "step" "The program is not being run." "step"
1d30b948 629#test symbol-file
787f6220 630gdb_test "symbol-file" "" "symbol-file"
1d30b948
JK
631
632#test target child
787f6220 633gdb_test "target child" "Use the \"run\" command to start a Unix child process.*|Undefined target command: \"child\". *Try \"help target\".*" "target child"
1d30b948
JK
634
635#test target procfs
787f6220 636gdb_test "target procfs" "Use the \"run\" command to start a Unix child process.*|Undefined target command: \"procfs\". *Try \"help target\".*" "target procfs"
1d30b948
JK
637
638#test target core
787f6220 639send_gdb "target core\n"
1d30b948 640expect {
85fbaa74 641 -re "No core file specified..*$gdb_prompt $" { pass "target core" }
787f6220
BM
642 -re ".*A program is being debugged already. Kill it. .y or n.*$" {
643 send_gdb "n\n"
644 if $verbose>1 then {
645 send_user "\t\tDidn't kill program being debugged\n"
1d30b948 646 }
85fbaa74 647 expect -re "$gdb_prompt $" { }
787f6220
BM
648 pass "target core"
649 }
85fbaa74
BM
650 -re "Undefined target command: \"core\". Try \"help target\"..*$gdb_prompt $" { pass "target core" }
651 -re ".*$gdb_prompt $" { fail "target core" }
787f6220
BM
652 timeout { fail "(timeout) target core" }
653}
1d30b948
JK
654
655#test target exec
787f6220 656send_gdb "target exec\n"
1d30b948 657expect {
85fbaa74 658 -re "No exec file now..*$gdb_prompt $"\
1d30b948
JK
659 { pass "target exec" }
660 -re ".*A program is being debugged already. Kill it. .y or n.*$" {
787f6220 661 send_gdb "n\n"
1d30b948
JK
662 if $verbose>1 then {
663 send_user "\t\tDidn't kill program being debugged\n"
664 }
85fbaa74 665 expect -re "$gdb_prompt $" { }
1d30b948
JK
666 pass "target exec"
667 }
85fbaa74 668 -re ".*$gdb_prompt $" { fail "target exec" }
1d30b948
JK
669 timeout { fail "(timeout) target exec" }
670 }
671
1d30b948
JK
672#test target remote
673if ![istarget "*-*-udi*"] then {
787f6220 674 send_gdb "target remote\n"
1d30b948
JK
675 expect {
676 -re "To open a remote debug connection, you need to specify what serial.*
85fbaa74 677device is attached to the remote system .e.g. /dev/ttya.*$gdb_prompt $"\
1d30b948
JK
678 { pass "target remote" }
679 -re ".*A program is being debugged already. Kill it. .y or n.*$" {
787f6220 680 send_gdb "n\n"
1d30b948
JK
681 if $verbose>1 then {
682 send_user "\t\tDidn't kill program being debugged\n"
683 }
85fbaa74 684 expect -re "$gdb_prompt $" { }
1d30b948
JK
685 pass "target remote"
686 }
85fbaa74 687 -re ".*$gdb_prompt $" { fail "target remote" }
1d30b948
JK
688 timeout { fail "(timeout) target remote" }
689 }
690}
691
692#test target
787f6220 693gdb_test "target" "Argument required .target name.*" "target"
1d30b948 694#test tbreak
787f6220 695gdb_test "tbreak" "No default breakpoint address now." "tbreak"
1d30b948 696#test tty
787f6220 697gdb_test "tty" "Argument required .terminal name for running target process.*" "tty"
1d30b948
JK
698#test until "u" abbreviation
699setup_xfail "a29k-*-udi"
787f6220 700gdb_test "u" "The program is not running." "until \"u\" abbreviation"
1d30b948
JK
701#test until
702setup_xfail "a29k-*-udi"
787f6220 703gdb_test "until" "The program is not running." "until"
1d30b948
JK
704#test undisplay
705# FIXME -- need to dump full output to detailed log
787f6220 706send_gdb "undisplay\n"
1d30b948 707expect {
787f6220
BM
708 -re "Delete all auto-display expressions.*y or n. $" {
709 send_gdb "y\n"
710 expect {
85fbaa74 711 -re "$gdb_prompt $" { pass "undisplay prompt" }
787f6220 712 timeout { fail "(timeout) (timeout) undisplay prompt" }
1d30b948 713 }
787f6220
BM
714 }
715 timeout { fail "(timeout) (timeout) undisplay prompt" }
716}
1d30b948
JK
717
718#test unset environment
787f6220
BM
719send_gdb "unset environment\n"
720expect {
721 -re "Delete all environment variables?.*y or n. $" {
722 send_gdb "y\n"
723 expect {
85fbaa74 724 -re "$gdb_prompt $" { pass "unset environmentprompt" }
787f6220
BM
725 timeout {
726 fail "(timeout) (timeout) unset environment prompt"
727 }
1d30b948 728 }
787f6220
BM
729 }
730 timeout {
731 fail "(timeout) (timeout) unset environment prompt"
732 }
733}
1d30b948
JK
734
735#test unset
787f6220 736gdb_test "unset" "\"unset\" must be followed by the name of an unset subcommand..*\[\r\n\]+List of unset subcommands:.*\[\r\n\]+unset environment -- Cancel environment variable VAR for the program.*\[\r\n\]+Type \"help unset\" followed by unset subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "unset"
1d30b948 737#test up
1d30b948 738#test up-silently
787f6220 739gdb_test "up-silently" "No stack." "up-silently"
1d30b948 740#test watch
787f6220 741gdb_test "watch" "Argument required .expression to compute.*" "watch"
1d30b948 742#test whatis
787f6220 743gdb_test "whatis" "The history is empty." "whatis"
1d30b948
JK
744#test where
745setup_xfail "a29k-*-udi"
787f6220 746gdb_test "where" "No stack." "where"
1d30b948
JK
747#test x
748#The case in which it prints a number is for vxgdb.
787f6220 749gdb_test "x" "0x0:.*0x\[0-9\]*|0x0:.*Cannot access memory at address 0x0." "x"
1d30b948 750
787f6220 751gdb_exit
This page took 0.148983 seconds and 4 git commands to generate.