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