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