Commit | Line | Data |
---|---|---|
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 | ||
23 | gdb_exit | |
24 | gdb_start | |
25 | ||
26 | set timeout 60 | |
27 | ||
28 | # | |
29 | # test default actions of gdb commands | |
30 | # | |
31 | ||
32 | #load_lib gdb.exp | |
33 | ||
34 | gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address" "add-symbol-file" | |
35 | ||
36 | setup_xfail "mips-idt-*" | |
37 | send_gdb "attach\n" | |
38 | gdb_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 | |
54 | if { [istarget "a29k-*-udi"] } { | |
55 | gdb_exit | |
56 | gdb_start | |
57 | } | |
58 | ||
59 | if ![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. | |
77 | if ![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 | |
85 | if [istarget "a29k-*-udi"] then { | |
86 | gdb_exit | |
87 | gdb_start | |
88 | } | |
89 | ||
90 | #test call | |
91 | gdb_test "call" "The history is empty..*" "call" | |
92 | ||
93 | ||
94 | #test catch | |
95 | gdb_test "catch" "Catch requires an event name..*" "catch" | |
96 | ||
97 | #test cd | |
98 | gdb_test "cd" "Argument required .new working directory.*" "cd" | |
99 | ||
100 | #test clear | |
101 | gdb_test "clear" "No source file specified..*" "clear" | |
102 | ||
103 | #test commands | |
104 | gdb_test "commands" "No breakpoint number 0..*" "commands" | |
105 | ||
106 | #test condition | |
107 | gdb_test "condition" "Argument required .breakpoint number.*" "condition" | |
108 | ||
109 | #test core-file | |
110 | gdb_test "core-file" "No core file now.|GDB can't read core files on this machine." "core-file" | |
111 | #test delete "d" abbreviation | |
112 | gdb_test "d" "" "delete \"d\" abbreviation" | |
113 | #test delete | |
114 | gdb_test "delete" "" "delete" | |
115 | #test define | |
116 | gdb_test "define" "Argument required \[(\]name of command to define\[)\]." "define" | |
117 | #test delete breakpoints | |
118 | gdb_test "delete breakpoints" "" "delete breakpoints" | |
119 | #test delete display | |
120 | # FIXME -- need to dump full output to detailed log | |
121 | send_gdb "delete display\n" | |
122 | gdb_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 | |
135 | gdb_test "detach" "" "detach" | |
136 | ||
137 | # FIXME: continue kills the udi connection | |
138 | if [istarget "a29k-*-udi"] then { | |
139 | gdb_exit | |
140 | gdb_start | |
141 | } | |
142 | if [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 | ||
150 | send_gdb "directory\n" | |
151 | gdb_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 | |
163 | gdb_test "dis" "" "disable \"dis\" abbreviation" | |
164 | #test disable "disa" abbreviation | |
165 | gdb_test "disa" "" "disable \"disa\" abbreviation" | |
166 | #test disable | |
167 | gdb_test "disable" "" "disable" | |
168 | #test disable breakpoints | |
169 | gdb_test "disable breakpoints" "" "disable breakpoints" | |
170 | #test disable display | |
171 | gdb_test "disable display" "" "disable display" | |
172 | #test disassemble | |
173 | gdb_test "disassemble" "No frame selected." "disassemble" | |
174 | #test display | |
175 | gdb_test "display" "" "display" | |
176 | #test do | |
177 | gdb_test "do" "No stack." "do" | |
178 | #test document | |
179 | gdb_test "document" "Argument required .name of command to define.*" "document" | |
180 | #test down | |
181 | gdb_test "down" "No stack.*" "down" | |
182 | #test down-silently | |
183 | gdb_test "down-silently" "No stack." "down-silently" | |
184 | #test echo | |
185 | gdb_test "echo" "" "echo" | |
186 | #test enable breakpoints delete | |
187 | gdb_test "enable breakpoints delete" "Argument required .one or more breakpoint numbers.*" "enable breakpoints delete" | |
188 | #test enable breakpoints once | |
189 | gdb_test "enable breakpoints once" "Argument required .one or more breakpoint numbers.*" "enable breakpoints once" | |
190 | #test enable breakpoints | |
191 | gdb_test "enable breakpoints" "" "enable breakpoints" | |
192 | #test enable delete | |
193 | gdb_test "enable delete" "Argument required .one or more breakpoint numbers.*" "enable delete" | |
194 | #test enable display | |
195 | gdb_test "enable display" "" "enable display" | |
196 | #test enable once | |
197 | gdb_test "enable once" "Argument required .one or more breakpoint numbers.*" "enable once" | |
198 | #test enable | |
199 | gdb_test "enable" "" "enable" | |
200 | #test exec-file | |
201 | send_gdb "exec-file\n" | |
202 | gdb_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 | |
219 | setup_xfail "a29k-*-udi" | |
220 | gdb_test "f" "No stack." "frame \"f\" abbreviation" | |
221 | #test frame | |
222 | setup_xfail "a29k-*-udi" | |
223 | gdb_test "frame" "No stack." "frame" | |
224 | #test fg | |
225 | setup_xfail "a29k-*-udi" | |
226 | gdb_test "fg" "The program is not being run." "fg" | |
227 | # FIXME: fg kills the udi connection | |
228 | #test file | |
229 | send_gdb "file\n" | |
230 | gdb_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 | |
246 | setup_xfail "a29k-*-udi" | |
247 | gdb_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. | |
251 | gdb_test "forward-search" "No previous regular expression.*|There is no previous regular expression.*" "forward-search" | |
252 | #test help "h" abbreviation | |
253 | gdb_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 | |
255 | gdb_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 | |
257 | gdb_test "handle" "Argument required .signal to handle.*" "handle" | |
258 | #test info "i" abbreviation | |
259 | gdb_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 | |
261 | gdb_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 | |
263 | gdb_test "ignore" "Argument required .a breakpoint number.*" "ignore" | |
264 | #test info address | |
265 | gdb_test "info address" "Argument required." "info address" | |
266 | #test info all-registers | |
267 | setup_xfail "a29k-*-udi" | |
268 | gdb_test "info all-registers" "The program has no registers now." "info all-registers" | |
269 | #test info args | |
270 | gdb_test "info args" "No frame selected." "info args" | |
271 | #test info bogus-gdb-command | |
272 | gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\". Try \"help info\".*" "info bogus-gdb-command" | |
273 | #test info breakpoints | |
274 | gdb_test "info breakpoints" "No breakpoints or watchpoints." "info breakpoints" | |
275 | #test info catch | |
276 | gdb_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."# | |
281 | gdb_test "info copying" | |
282 | # } | |
283 | # | |
284 | # | |
285 | #test info display | |
286 | gdb_test "info display" "There are no auto-display expressions now." "info display" | |
287 | #test info frame "f" abbreviation | |
288 | gdb_test "info f" "No stack.*|No selected frame.*" "info frame \"f\" abbreviation" | |
289 | #test info frame | |
290 | gdb_test "info frame" "No stack.|No selected frame." "info frame" | |
291 | #test info files | |
292 | gdb_test "info files" "" "info files" | |
293 | #test info float | |
294 | if [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 | |
302 | gdb_test "info functions" "All defined functions:" "info functions" | |
303 | #test info locals | |
304 | gdb_test "info locals" "No frame selected." "info locals" | |
305 | #test info program | |
306 | setup_xfail "a29k-*-udi" | |
307 | gdb_test "info program" "The program being debugged is not being run." "info program" | |
308 | #test info registers | |
309 | setup_xfail "a29k-*-udi" | |
310 | gdb_test "info registers" "The program has no registers now." "info registers" | |
311 | #test info stack "s" abbreviation | |
312 | setup_xfail "a29k-*-udi" | |
313 | gdb_test "info s" "No stack." "info stack \"s\" abbreviation" | |
314 | #test info stack | |
315 | setup_xfail "a29k-*-udi" | |
316 | gdb_test "info stack" "No stack." "info stack" | |
317 | #test info set | |
318 | # FIXME -- needs to match the entire output | |
319 | gdb_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" | |
320 | gdb_test "info symbol" "Argument required .address.." | |
321 | #test info source | |
322 | gdb_test "info source" "No current source file..*" "info source" | |
323 | #test info sources | |
324 | gdb_test "info sources" "No symbol table is loaded. Use the \"file\" command.*" "info sources" | |
325 | #test info target | |
326 | gdb_test "info target" "" "info target" | |
327 | #test info terminal | |
328 | gdb_test "info terminal" "No saved terminal information." "info terminal" | |
329 | #test info types | |
330 | gdb_test "info types" "All defined types:" "info types" | |
331 | #test info variables | |
332 | gdb_test "info variables" "All defined variables:" "info variables" | |
333 | #test info warranty | |
334 | gdb_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 | |
336 | gdb_test "info watchpoints" "No breakpoints or watchpoints." "info watchpoints" | |
337 | #test inspect | |
338 | gdb_test "inspect" "The history is empty." "inspect" | |
339 | #test jump | |
340 | setup_xfail "a29k-*-udi" | |
341 | gdb_test "jump" "The program is not being run." "jump" | |
342 | #test kill | |
343 | gdb_test "kill" "The program is not being run." "kill" | |
344 | #test list "l" abbreviation | |
345 | gdb_test "l" "No symbol table is loaded. Use the \"file\" command.*" "list \"l\" abbreviation" | |
346 | #test list | |
347 | gdb_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. | |
352 | gdb_test "load" "You can't do that when your target is `None'.*|The load command takes a file name.*|Must specify at least a file name with the load command.*|.*Use the .file. or .exec-file. command.*" "load" | |
353 | #test next "n" abbreviation | |
354 | setup_xfail "a29k-*-udi" | |
355 | gdb_test "n" "The program is not being run." "next \"n\" abbreviation" | |
356 | #test next | |
357 | setup_xfail "a29k-*-udi" | |
358 | gdb_test "next" "The program is not being run." "next" | |
359 | #test nexti "ni" abbreviation | |
360 | setup_xfail "a29k-*-udi" | |
361 | gdb_test "ni" "The program is not being run." "nexti \"ni\" abbreviation" | |
362 | #test nexti | |
363 | setup_xfail "a29k-*-udi" | |
364 | gdb_test "nexti" "The program is not being run." "nexti" | |
365 | #test output | |
366 | gdb_test "output" "Argument required .expression to compute.*" "output" | |
367 | ||
368 | #test overlay | |
369 | gdb_test "overlay" "\"overlay\" must be followed by the name of .*" | |
370 | #test a non-existant overlay subcommand | |
371 | gdb_test "overlay on" "Undefined overlay command.* Try \"help overlay\"." | |
372 | gdb_test "overlay manual" "" "overlay manual #1" | |
373 | gdb_test "overlay auto" "" | |
374 | gdb_test "overlay off" "" | |
375 | gdb_test "overlay list" "No sections are mapped." | |
376 | gdb_test "overlay map" "Overlay debugging not enabled.*" "overlay map #1" | |
377 | gdb_test "overlay unmap" "Overlay debugging not enabled.*" "overlay unmap #2" | |
378 | gdb_test "overlay manual" "" "overlay manual #2" | |
379 | gdb_test "overlay map" "Argument required: name of an overlay section." "overlay map #2" | |
380 | gdb_test "overlay unmap" "Argument required: name of an overlay section." "overlay unmap #2" | |
381 | ||
382 | #test print "p" abbreviation | |
383 | gdb_test "p" "The history is empty." "print \"p\" abbreviation" | |
384 | #test print | |
385 | gdb_test "print" "The history is empty." "print" | |
386 | #test printf | |
387 | gdb_test "printf" "Argument required .format-control string and values to print.*" "printf" | |
388 | #test ptype | |
389 | gdb_test "ptype" "The history is empty." "ptype" | |
390 | #test pwd | |
391 | gdb_test "pwd" "Working directory .*" "pwd" | |
392 | ||
393 | #test run "r" abbreviation | |
394 | if [istarget "*-*-vxworks*"] then { | |
395 | gdb_test "set args" "" "" | |
396 | ||
397 | gdb_test "r" "Starting program: .* | |
398 | You 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: .* | |
406 | You can't do that when your target is `None'.*$gdb_prompt $"\ | |
407 | { pass "run \"r\" abbreviation" } | |
408 | -re "Starting program: .* | |
409 | No executable file specified.* | |
410 | Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\ | |
411 | { pass "run \"r\" abbreviation" } | |
412 | -re "Starting program: .* | |
413 | No image loaded into target.*$gdb_prompt $"\ | |
414 | { pass "run \"r\" abbreviation" } | |
415 | -re "Starting program: .* | |
416 | No 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 | |
426 | if [istarget "*-*-vxworks*"] then { | |
427 | gdb_test "set args" "" "" | |
428 | ||
429 | gdb_test "run" "Starting program: .* | |
430 | You 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: .* | |
438 | No executable file specified.* | |
439 | Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\ | |
440 | { pass "run" } | |
441 | -re "Starting program: .* | |
442 | No image loaded into target.*$gdb_prompt $"\ | |
443 | { pass "run" } | |
444 | -re "Starting program: .* | |
445 | No 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 | |
455 | gdb_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. | |
460 | gdb_test "return" "No selected frame..*" "return" "Make .* return now.*y or n. $" "y" | |
461 | ||
462 | ||
463 | #test reverse-search | |
464 | gdb_test "reverse-search" "No previous regular expression.*|There is no previous regular expression.*" "reverse-search" | |
465 | #test step "s" abbreviation | |
466 | setup_xfail "a29k-*-udi" | |
467 | gdb_test "s" "The program is not being run." "step \"s\" abbreviation #1" | |
468 | #test step | |
469 | setup_xfail "a29k-*-udi" | |
470 | gdb_test "step" "The program is not being run." "step #1" | |
471 | #test search | |
472 | gdb_test "search" "No previous regular expression.*|There is no previous regular expression.*" "search" | |
473 | #test section | |
474 | gdb_test "section" "Must specify section name and its virtual address.*" "section" | |
475 | #test set annotate | |
476 | gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate" | |
477 | #test set args | |
478 | gdb_test "set args" "" "set args" | |
479 | #test set check "c" abbreviation | |
480 | gdb_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 | |
482 | gdb_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 | |
484 | gdb_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 | |
486 | gdb_test "set check range" "" "set check range" | |
487 | #test set check type | |
488 | gdb_test "set check type" "" "set check type" | |
489 | #test set complaints | |
490 | gdb_test "set complaints" "Argument required .integer to set it to.*" "set complaints" | |
491 | #test set confirm | |
492 | gdb_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 | |
498 | gdb_test "set environment" "Argument required .environment variable and value.*" "set environment" | |
499 | #test set height | |
500 | gdb_test "set height" "Argument required .integer to set it to.*" "set height" | |
501 | #test set history expansion | |
502 | gdb_test "set history expansion" "" "set history expansion" | |
503 | #test set history filename | |
504 | gdb_test "set history filename" "Argument required .filename to set it to.*" "set history filename" | |
505 | #test set history save | |
506 | gdb_test "set history save" "" "set history save" | |
507 | #test set history size | |
508 | gdb_test "set history size" "Argument required .integer to set it to.*" "set history size" | |
509 | #test set history | |
510 | gdb_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 | |
512 | gdb_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 | |
514 | gdb_test "set listsize" "Argument required .integer to set it to.*" "set listsize" | |
515 | #test set print "p" abbreviation | |
516 | gdb_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 | |
518 | gdb_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 | |
520 | gdb_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 | |
522 | gdb_test "set print address" "" "set print address" | |
523 | #test set print array | |
524 | gdb_test "set print array" "" "set print array" | |
525 | #test set print asm-demangle | |
526 | gdb_test "set print asm-demangle" "" "set print asm-demangle" | |
527 | #test set print demangle | |
528 | gdb_test "set print demangle" "" "set print demangle" | |
529 | #test set print elements | |
530 | gdb_test "set print elements" "Argument required .integer to set it to.*" "set print elements" | |
531 | #test set print object | |
532 | gdb_test "set print object" "" "set print object" | |
533 | #test set print pretty | |
534 | gdb_test "set print pretty" "" "set print pretty" | |
535 | #test set print sevenbit-strings | |
536 | gdb_test "set print sevenbit-strings" "" "set print sevenbit-strings" | |
537 | #test set print union | |
538 | gdb_test "set print union" "" "set print union" | |
539 | #test set print vtbl | |
540 | gdb_test "set print vtbl" "" "set print vtbl" | |
541 | # FIXME -- need a test for "set prompt" | |
542 | #test set radix | |
543 | gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12.*" "set radix" | |
544 | #test set symbol-reloading | |
545 | gdb_test "set symbol-reloading" "" "set symbol-reloading" | |
546 | #test set variable | |
547 | gdb_test "set variable" "Argument required .expression to compute.*" "set variable" | |
548 | #test set verbose | |
549 | gdb_test "set verbose" "" "set verbose" | |
550 | #test set width | |
551 | gdb_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. | |
554 | gdb_test "set write" "" "set write" | |
555 | #test set | |
556 | gdb_test "set" "Argument required .expression to compute.*" "set" | |
557 | #test shell echo Hi dad! | |
558 | gdb_test "shell echo Hi dad!" "Hi dad!" "shell echo Hi dad!" | |
559 | #test show annotate | |
560 | gdb_test "show annotate" "Annotation_level is 0." "show annotate" | |
561 | #test show args | |
562 | gdb_test "show args" "Argument list to give program being debugged when it is started is \"\"." "show args" | |
563 | #test show check "c" abbreviation | |
564 | gdb_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 | |
566 | gdb_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 | |
568 | gdb_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 | |
570 | gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range" | |
571 | #test show check type | |
572 | gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type" | |
573 | #test show commands | |
574 | gdb_test "show commands" "" "show commands" | |
575 | #test show complaints | |
576 | gdb_test "show complaints" "Max number of complaints about incorrect symbols is 0." "show complaints" | |
577 | #test show confirm | |
578 | gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm" | |
579 | #test show convenience | |
580 | gdb_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 | |
582 | gdb_test "show directories" "Source directories searched: .cdir:.cwd" "show directories" | |
583 | #test show editing | |
584 | gdb_test "show editing" "Editing of command lines as they are typed is o\[a-z\]*." "show editing" | |
585 | #test show height | |
586 | gdb_test "show height" "Number of lines gdb thinks are in a page is.*" "show height" | |
587 | #test show history expansion | |
588 | gdb_test "show history expansion" "History expansion on command input is o\[a-z\]*.*" "show history expansion" | |
589 | #test show history filename | |
590 | gdb_test "show history filename" "The filename in which to record the command history is.*.gdb_history.*" "show history filename" | |
591 | #test show history save | |
592 | gdb_test "show history save" "Saving of the history record on exit is on." "show history save" | |
593 | #test show history size | |
594 | gdb_test "show history size" "The size of the command history is.*" "show history size" | |
595 | #test show history | |
596 | gdb_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 | |
598 | gdb_test "show language" "The current source language is \"auto; currently c\"." "show language" | |
599 | #test show listsize | |
600 | gdb_test "show listsize" "Number of source lines gdb will list by default is 10." "show listsize" | |
601 | #test show print "p" abbreviation | |
602 | gdb_test "show p" ".*" "show p" | |
603 | #test show print "pr" abbreviation | |
604 | gdb_test "show pr" ".*" "show pr" | |
605 | #test show print | |
606 | gdb_test "show print" "" "show print" | |
607 | #test show paths | |
608 | gdb_test "show paths" "Executable and object file path:.*" "show paths" | |
609 | #test show print address | |
610 | gdb_test "show print address" "Printing of addresses is on." "show print address" | |
611 | #test show print array | |
612 | gdb_test "show print array" "Prettyprinting of arrays is on." "show print array" | |
613 | #test show print asm-demangle | |
614 | gdb_test "show print asm-demangle" "Demangling of C\[+\]+ names in disassembly listings is on." "show print asm-demangle" | |
615 | #test show print demangle | |
616 | gdb_test "show print demangle" "Demangling of encoded C\[+\]+ names when displaying symbols is on." "show print demangle" | |
617 | #test show print elements | |
618 | gdb_test "show print elements" "Limit on string chars or array elements to print is 200." "show print elements" | |
619 | #test show print object | |
620 | gdb_test "show print object" "Printing of object's derived type based on vtable info is on." "show print object" | |
621 | #test show print pretty | |
622 | gdb_test "show print pretty" "Prettyprinting of structures is on." "show print pretty" | |
623 | #test show print sevenbit-strings | |
624 | gdb_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 | |
626 | gdb_test "show print union" "Printing of unions interior to structures is on." "show print union" | |
627 | #test show print vtbl | |
628 | gdb_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. | |
633 | gdb_test "show prompt" "Gdb's prompt is \"$gdb_prompt \".*" "show prompt" | |
634 | #test show radix | |
635 | gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12." "show radix" | |
636 | #test show symbol-reloading | |
637 | gdb_test "show symbol-reloading" "Dynamic symbol table reloading multiple times in one run is on." "show symbol-reloading" | |
638 | #test show user | |
639 | gdb_test "show user" "" "show user" | |
640 | #test show values | |
641 | gdb_test "show values" "" "show values" | |
642 | #test show verbose | |
643 | gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose" | |
644 | #test show version | |
645 | ||
646 | gdb_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 | |
648 | gdb_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. | |
651 | gdb_test "show write" "Writing into executable and core files is o.*" "show write" | |
652 | #test show | |
653 | gdb_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 | |
655 | setup_xfail "a29k-*-udi" | |
656 | gdb_test "si" "The program is not being run." "stepi \"si\" abbreviation" | |
657 | #test stepi | |
658 | setup_xfail "a29k-*-udi" | |
659 | gdb_test "stepi" "The program is not being run." "stepi" | |
660 | #test signal | |
661 | setup_xfail "a29k-*-udi" | |
662 | gdb_test "signal" "The program is not being run." "signal" | |
663 | #test source | |
664 | gdb_test "source" "source command requires pathname of file to source..*|No such file or directory.*" "source" | |
665 | #test step "s" abbreviation | |
666 | setup_xfail "a29k-*-udi" | |
667 | gdb_test "s" "The program is not being run." "step \"s\" abbreviation #2" | |
668 | #test step | |
669 | setup_xfail "a29k-*-udi" | |
670 | gdb_test "step" "The program is not being run." "step #2" | |
671 | #test symbol-file | |
672 | gdb_test "symbol-file" "" "symbol-file" | |
673 | ||
674 | #test target child | |
675 | gdb_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 | |
678 | gdb_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 | |
681 | send_gdb "target core\n" | |
682 | gdb_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 | |
698 | send_gdb "target exec\n" | |
699 | gdb_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 | |
715 | if ![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.* | |
719 | serial 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 | |
735 | gdb_test "target" "Argument required .target name.*" "target" | |
736 | #test tbreak | |
737 | gdb_test "tbreak" "No default breakpoint address now." "tbreak" | |
738 | #test tty | |
739 | gdb_test "tty" "Argument required .terminal name for running target process.*" "tty" | |
740 | #test until "u" abbreviation | |
741 | setup_xfail "a29k-*-udi" | |
742 | gdb_test "u" "The program is not running." "until \"u\" abbreviation" | |
743 | #test until | |
744 | setup_xfail "a29k-*-udi" | |
745 | gdb_test "until" "The program is not running." "until" | |
746 | #test undisplay | |
747 | # FIXME -- need to dump full output to detailed log | |
748 | send_gdb "undisplay\n" | |
749 | gdb_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 | |
761 | send_gdb "unset environment\n" | |
762 | gdb_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 | |
778 | gdb_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 | |
781 | gdb_test "up-silently" "No stack." "up-silently" | |
782 | #test watch | |
783 | gdb_test "watch" "Argument required .expression to compute.*" "watch" | |
784 | #test whatis | |
785 | gdb_test "whatis" "The history is empty." "whatis" | |
786 | #test where | |
787 | setup_xfail "a29k-*-udi" | |
788 | gdb_test "where" "No stack." "where" | |
789 | #test x | |
790 | #The case in which it prints a number is for vxgdb. | |
791 | gdb_test "x" "0x0:.*0x\[0-9\]*|0x0:.*Cannot access memory at address 0x0." "x" | |
792 | ||
793 | gdb_exit |