Commit | Line | Data |
---|---|---|
fb40c209 AC |
1 | # Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
2 | ||
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 2 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program; if not, write to the Free Software | |
15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | # This file was based on a file written by Fred Fish. (fnf@cygnus.com) | |
21 | ||
22 | # Test setup routines that work with the MI interpreter. | |
23 | ||
24 | # The variable mi_gdb_prompt is a regexp which matches the gdb mi prompt. | |
25 | # Set it if it is not already set. | |
26 | global mi_gdb_prompt | |
27 | if ![info exists mi_gdb_prompt] then { | |
28 | set mi_gdb_prompt "\[(\]gdb\[)\] \r\n" | |
29 | } | |
30 | ||
31 | set MIFLAGS "-i=mi" | |
32 | ||
33 | # | |
34 | # mi_gdb_exit -- exit the GDB, killing the target program if necessary | |
35 | # | |
36 | proc mi_gdb_exit {} { | |
37 | catch mi_uncatched_gdb_exit | |
38 | } | |
39 | ||
40 | proc mi_uncatched_gdb_exit {} { | |
41 | global GDB | |
42 | global GDBFLAGS | |
43 | global verbose | |
44 | global gdb_spawn_id; | |
45 | global gdb_prompt | |
46 | global mi_gdb_prompt | |
47 | global MIFLAGS | |
48 | ||
49 | gdb_stop_suppressing_tests; | |
50 | ||
51 | if { [info procs sid_exit] != "" } { | |
52 | sid_exit | |
53 | } | |
54 | ||
55 | if ![info exists gdb_spawn_id] { | |
56 | return; | |
57 | } | |
58 | ||
59 | verbose "Quitting $GDB $GDBFLAGS $MIFLAGS" | |
60 | ||
61 | if { [is_remote host] && [board_info host exists fileid] } { | |
62 | send_gdb "999-gdb-exit\n"; | |
63 | gdb_expect 10 { | |
64 | -re "y or n" { | |
65 | send_gdb "y\n"; | |
66 | exp_continue; | |
67 | } | |
68 | -re "Undefined command.*$gdb_prompt $" { | |
69 | send_gdb "quit\n" | |
70 | exp_continue; | |
71 | } | |
72 | -re "DOSEXIT code" { } | |
73 | default { } | |
74 | } | |
75 | } | |
76 | ||
77 | if ![is_remote host] { | |
78 | remote_close host; | |
79 | } | |
80 | unset gdb_spawn_id | |
81 | } | |
82 | ||
83 | # | |
84 | # start gdb -- start gdb running, default procedure | |
85 | # | |
86 | # When running over NFS, particularly if running many simultaneous | |
87 | # tests on different hosts all using the same server, things can | |
88 | # get really slow. Give gdb at least 3 minutes to start up. | |
89 | # | |
90 | proc mi_gdb_start { } { | |
91 | global verbose | |
92 | global GDB | |
93 | global GDBFLAGS | |
94 | global gdb_prompt | |
95 | global mi_gdb_prompt | |
96 | global timeout | |
97 | global gdb_spawn_id; | |
98 | global MIFLAGS | |
99 | ||
100 | gdb_stop_suppressing_tests; | |
101 | ||
102 | verbose "Spawning $GDB -nw $GDBFLAGS $MIFLAGS" | |
103 | ||
104 | if [info exists gdb_spawn_id] { | |
105 | return 0; | |
106 | } | |
107 | ||
108 | if ![is_remote host] { | |
109 | if { [which $GDB] == 0 } then { | |
110 | perror "$GDB does not exist." | |
111 | exit 1 | |
112 | } | |
113 | } | |
114 | set res [remote_spawn host "$GDB -nw $GDBFLAGS $MIFLAGS [host_info gdb_opts]"]; | |
115 | if { $res < 0 || $res == "" } { | |
116 | perror "Spawning $GDB failed." | |
117 | return 1; | |
118 | } | |
119 | gdb_expect { | |
120 | -re ".*UI_OUT.*$mi_gdb_prompt$" { | |
121 | verbose "GDB initialized." | |
122 | } | |
123 | -re ".*$mi_gdb_prompt$" { | |
124 | untested "Skip mi tests (output not in headless format)." | |
125 | remote_close host; | |
126 | return -1; | |
127 | } | |
128 | -re ".*$gdb_prompt $" { | |
129 | untested "Skip mi tests (got non-mi prompt)." | |
130 | remote_close host; | |
131 | return -1; | |
132 | } | |
133 | timeout { | |
134 | perror "(timeout) GDB never initialized after 10 seconds." | |
135 | remote_close host; | |
136 | return -1 | |
137 | } | |
138 | } | |
139 | set gdb_spawn_id -1; | |
140 | ||
141 | # FIXME: mi output does not go through pagers, so these can be removed. | |
142 | # force the height to "unlimited", so no pagers get used | |
143 | send_gdb "100-gdb-set height 0\n" | |
144 | gdb_expect 10 { | |
145 | -re ".*100-gdb-set height 0\r\n100\\\^done\r\n$mi_gdb_prompt$" { | |
146 | verbose "Setting height to 0." 2 | |
147 | } | |
148 | timeout { | |
149 | warning "Couldn't set the height to 0" | |
150 | } | |
151 | } | |
152 | # force the width to "unlimited", so no wraparound occurs | |
153 | send_gdb "101-gdb-set width 0\n" | |
154 | gdb_expect 10 { | |
155 | -re ".*101-gdb-set width 0\r\n101\\\^done\r\n$mi_gdb_prompt$" { | |
156 | verbose "Setting width to 0." 2 | |
157 | } | |
158 | timeout { | |
159 | warning "Couldn't set the width to 0." | |
160 | } | |
161 | } | |
162 | ||
163 | # Finally start SID. | |
164 | if { [info procs sid_start] != "" } { | |
165 | verbose "Spawning SID" | |
166 | sid_start | |
167 | } | |
168 | ||
169 | return 0; | |
170 | } | |
171 | ||
172 | # Many of the tests depend on setting breakpoints at various places and | |
173 | # running until that breakpoint is reached. At times, we want to start | |
174 | # with a clean-slate with respect to breakpoints, so this utility proc | |
175 | # lets us do this without duplicating this code everywhere. | |
176 | # | |
177 | ||
178 | proc mi_delete_breakpoints {} { | |
179 | global mi_gdb_prompt | |
180 | ||
181 | # FIXME: The mi operation won't accept a prompt back and will use the 'all' arg | |
182 | send_gdb "102-break-delete\n" | |
183 | gdb_expect 30 { | |
184 | -re "Delete all breakpoints.*y or n.*$" { | |
185 | send_gdb "y\n"; | |
186 | exp_continue | |
187 | } | |
188 | -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" { | |
189 | # This happens if there were no breakpoints | |
190 | } | |
191 | timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return } | |
192 | } | |
193 | ||
194 | # The correct output is not "No breakpoints or watchpoints." but an | |
195 | # empty BreakpointTable. Also, a query is not acceptable with mi. | |
196 | send_gdb "103-break-list\n" | |
197 | gdb_expect 30 { | |
198 | -re "103-break-list\r\n103\\\^done,BreakpointTable=\{\}\r\n$mi_gdb_prompt$" {} | |
199 | -re "103-break-list\r\n103\\\^doneNo breakpoints or watchpoints.\r\n\r\n$mi_gdb_prompt$" {warning "Unexpected console text received"} | |
200 | -re "$mi_gdb_prompt$" { perror "Breakpoints not deleted" ; return } | |
201 | -re "Delete all breakpoints.*or n.*$" { | |
202 | warning "Unexpected prompt for breakpoints deletion"; | |
203 | send_gdb "y\n"; | |
204 | exp_continue | |
205 | } | |
206 | timeout { perror "-break-list (timeout)" ; return } | |
207 | } | |
208 | } | |
209 | ||
210 | proc mi_gdb_reinitialize_dir { subdir } { | |
211 | global mi_gdb_prompt | |
212 | ||
213 | global suppress_flag | |
214 | if { $suppress_flag } { | |
215 | return | |
216 | } | |
217 | ||
218 | if [is_remote host] { | |
219 | return ""; | |
220 | } | |
221 | ||
222 | send_gdb "104-environment-directory\n" | |
223 | gdb_expect 60 { | |
224 | -re ".*Reinitialize source path to empty.*y or n. " { | |
225 | warning "Got confirmation prompt for dir reinitialization." | |
226 | send_gdb "y\n" | |
227 | gdb_expect 60 { | |
228 | -re "$mi_gdb_prompt$" {} | |
229 | timeout {error "Dir reinitialization failed (timeout)"} | |
230 | } | |
231 | } | |
232 | -re "$mi_gdb_prompt$" {} | |
233 | timeout {error "Dir reinitialization failed (timeout)"} | |
234 | } | |
235 | ||
236 | send_gdb "105-environment-directory $subdir\n" | |
237 | gdb_expect 60 { | |
238 | -re "Source directories searched.*$mi_gdb_prompt$" { | |
239 | verbose "Dir set to $subdir" | |
240 | } | |
241 | -re "105\\\^done\r\n$mi_gdb_prompt$" { | |
242 | # FIXME: We return just the prompt for now. | |
243 | verbose "Dir set to $subdir" | |
244 | # perror "Dir \"$subdir\" failed." | |
245 | } | |
246 | } | |
247 | } | |
248 | ||
249 | # | |
250 | # load a file into the debugger. | |
251 | # return a -1 if anything goes wrong. | |
252 | # | |
253 | proc mi_gdb_load { arg } { | |
254 | global verbose | |
255 | global loadpath | |
256 | global loadfile | |
257 | global GDB | |
258 | global mi_gdb_prompt | |
259 | upvar timeout timeout | |
260 | ||
261 | # ``gdb_unload'' | |
262 | ||
263 | # ``gdb_file_cmd'' | |
264 | # FIXME: Several of these patterns are only acceptable for console | |
265 | # output. Queries are an error for mi. | |
266 | send_gdb "105-file-exec-and-symbols $arg\n" | |
267 | gdb_expect 120 { | |
268 | -re "Reading symbols from.*done.*$mi_gdb_prompt$" { | |
269 | verbose "\t\tLoaded $arg into the $GDB" | |
270 | # All OK | |
271 | } | |
272 | -re "has no symbol-table.*$mi_gdb_prompt$" { | |
273 | perror "$arg wasn't compiled with \"-g\"" | |
274 | return -1 | |
275 | } | |
276 | -re "A program is being debugged already.*Kill it.*y or n. $" { | |
277 | send_gdb "y\n" | |
278 | verbose "\t\tKilling previous program being debugged" | |
279 | exp_continue | |
280 | } | |
281 | -re "Load new symbol table from \".*\".*y or n. $" { | |
282 | send_gdb "y\n" | |
283 | gdb_expect 120 { | |
284 | -re "Reading symbols from.*done.*$mi_gdb_prompt$" { | |
285 | verbose "\t\tLoaded $arg with new symbol table into $GDB" | |
286 | # All OK | |
287 | } | |
288 | timeout { | |
289 | perror "(timeout) Couldn't load $arg, other program already loaded." | |
290 | return -1 | |
291 | } | |
292 | } | |
293 | } | |
294 | -re "No such file or directory.*$mi_gdb_prompt$" { | |
295 | perror "($arg) No such file or directory\n" | |
296 | return -1 | |
297 | } | |
298 | -re "105-file-exec-and-symbols .*\r\n105\\\^done\r\n$mi_gdb_prompt$" { | |
299 | # We are just giving the prompt back for now | |
300 | # All OK | |
301 | } | |
302 | timeout { | |
303 | perror "couldn't load $arg into $GDB (timed out)." | |
304 | return -1 | |
305 | } | |
306 | eof { | |
307 | # This is an attempt to detect a core dump, but seems not to | |
308 | # work. Perhaps we need to match .* followed by eof, in which | |
309 | # gdb_expect does not seem to have a way to do that. | |
310 | perror "couldn't load $arg into $GDB (end of file)." | |
311 | return -1 | |
312 | } | |
313 | } | |
314 | ||
315 | # ``load'' | |
316 | if { [info procs send_target_sid] != "" } { | |
317 | # For SID, things get complex | |
318 | send_target_sid | |
319 | gdb_expect 60 { | |
320 | -re "\\^done,.*$mi_gdb_prompt$" { | |
321 | } | |
322 | timeout { | |
323 | perror "Unable to connect to SID target" | |
324 | return -1 | |
325 | } | |
326 | } | |
327 | send_gdb "48-target-download\n" | |
328 | gdb_expect 10 { | |
329 | -re "48\\^done.*$mi_gdb_prompt$" { | |
330 | } | |
331 | timeout { | |
332 | perror "Unable to download to SID target" | |
333 | return -1 | |
334 | } | |
335 | } | |
336 | } elseif { [target_info protocol] == "sim" } { | |
337 | # For the simulator, just connect to it directly. | |
338 | send_gdb "47-target-select sim\n" | |
339 | gdb_expect 10 { | |
340 | -re "47\\^connected.*$mi_gdb_prompt$" { | |
341 | } | |
342 | timeout { | |
343 | perror "Unable to select sim target" | |
344 | return -1 | |
345 | } | |
346 | } | |
347 | send_gdb "48-target-download\n" | |
348 | gdb_expect 10 { | |
349 | -re "48\\^done.*$mi_gdb_prompt$" { | |
350 | } | |
351 | timeout { | |
352 | perror "Unable to download to sim target" | |
353 | return -1 | |
354 | } | |
355 | } | |
356 | } | |
357 | return 0 | |
358 | } | |
359 | ||
360 | # mi_gdb_test COMMAND PATTERN MESSAGE -- send a command to gdb; test the result. | |
361 | # | |
362 | # COMMAND is the command to execute, send to GDB with send_gdb. If | |
363 | # this is the null string no command is sent. | |
364 | # PATTERN is the pattern to match for a PASS, and must NOT include | |
365 | # the \r\n sequence immediately before the gdb prompt. | |
366 | # MESSAGE is an optional message to be printed. If this is | |
367 | # omitted, then the pass/fail messages use the command string as the | |
368 | # message. (If this is the empty string, then sometimes we don't | |
369 | # call pass or fail at all; I don't understand this at all.) | |
370 | # | |
371 | # Returns: | |
372 | # 1 if the test failed, | |
373 | # 0 if the test passes, | |
374 | # -1 if there was an internal error. | |
375 | # | |
376 | proc mi_gdb_test { args } { | |
377 | global verbose | |
378 | global mi_gdb_prompt | |
379 | global GDB | |
380 | upvar timeout timeout | |
381 | ||
382 | if [llength $args]>2 then { | |
383 | set message [lindex $args 2] | |
384 | } else { | |
385 | set message [lindex $args 0] | |
386 | } | |
387 | set command [lindex $args 0] | |
388 | set pattern [lindex $args 1] | |
389 | ||
390 | if [llength $args]==5 { | |
391 | set question_string [lindex $args 3]; | |
392 | set response_string [lindex $args 4]; | |
393 | } else { | |
394 | set question_string "^FOOBAR$" | |
395 | } | |
396 | ||
397 | if $verbose>2 then { | |
398 | send_user "Sending \"$command\" to gdb\n" | |
399 | send_user "Looking to match \"$pattern\"\n" | |
400 | send_user "Message is \"$message\"\n" | |
401 | } | |
402 | ||
403 | set result -1 | |
404 | set string "${command}\n"; | |
405 | if { $command != "" } { | |
406 | while { "$string" != "" } { | |
407 | set foo [string first "\n" "$string"]; | |
408 | set len [string length "$string"]; | |
409 | if { $foo < [expr $len - 1] } { | |
410 | set str [string range "$string" 0 $foo]; | |
411 | if { [send_gdb "$str"] != "" } { | |
412 | global suppress_flag; | |
413 | ||
414 | if { ! $suppress_flag } { | |
415 | perror "Couldn't send $command to GDB."; | |
416 | } | |
417 | fail "$message"; | |
418 | return $result; | |
419 | } | |
420 | gdb_expect 2 { | |
421 | -re "\[\r\n\]" { } | |
422 | timeout { } | |
423 | } | |
424 | set string [string range "$string" [expr $foo + 1] end]; | |
425 | } else { | |
426 | break; | |
427 | } | |
428 | } | |
429 | if { "$string" != "" } { | |
430 | if { [send_gdb "$string"] != "" } { | |
431 | global suppress_flag; | |
432 | ||
433 | if { ! $suppress_flag } { | |
434 | perror "Couldn't send $command to GDB."; | |
435 | } | |
436 | fail "$message"; | |
437 | return $result; | |
438 | } | |
439 | } | |
440 | } | |
441 | ||
442 | if [info exists timeout] { | |
443 | set tmt $timeout; | |
444 | } else { | |
445 | global timeout; | |
446 | if [info exists timeout] { | |
447 | set tmt $timeout; | |
448 | } else { | |
449 | set tmt 60; | |
450 | } | |
451 | } | |
452 | gdb_expect $tmt { | |
453 | -re "\\*\\*\\* DOSEXIT code.*" { | |
454 | if { $message != "" } { | |
455 | fail "$message"; | |
456 | } | |
457 | gdb_suppress_entire_file "GDB died"; | |
458 | return -1; | |
459 | } | |
460 | -re "Ending remote debugging.*$mi_gdb_prompt\[ \]*$" { | |
461 | if ![isnative] then { | |
462 | warning "Can`t communicate to remote target." | |
463 | } | |
464 | gdb_exit | |
465 | gdb_start | |
466 | set result -1 | |
467 | } | |
468 | -re "(${question_string})$" { | |
469 | send_gdb "$response_string\n"; | |
470 | exp_continue; | |
471 | } | |
472 | -re "Undefined.* command:.*$mi_gdb_prompt\[ \]*$" { | |
473 | perror "Undefined command \"$command\"." | |
474 | fail "$message" | |
475 | set result 1 | |
476 | } | |
477 | -re "Ambiguous command.*$mi_gdb_prompt\[ \]*$" { | |
478 | perror "\"$command\" is not a unique command name." | |
479 | fail "$message" | |
480 | set result 1 | |
481 | } | |
482 | -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" { | |
483 | if ![string match "" $message] then { | |
484 | pass "$message" | |
485 | } | |
486 | set result 0 | |
487 | } | |
488 | -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" { | |
489 | if ![string match "" $message] then { | |
490 | set errmsg "$message: the program exited" | |
491 | } else { | |
492 | set errmsg "$command: the program exited" | |
493 | } | |
494 | fail "$errmsg" | |
495 | return -1 | |
496 | } | |
497 | -re "The program is not being run.*$mi_gdb_prompt\[ \]*$" { | |
498 | if ![string match "" $message] then { | |
499 | set errmsg "$message: the program is no longer running" | |
500 | } else { | |
501 | set errmsg "$command: the program is no longer running" | |
502 | } | |
503 | fail "$errmsg" | |
504 | return -1 | |
505 | } | |
506 | -re ".*$mi_gdb_prompt\[ \]*$" { | |
507 | if ![string match "" $message] then { | |
508 | fail "$message" | |
509 | } | |
510 | set result 1 | |
511 | } | |
512 | "<return>" { | |
513 | send_gdb "\n" | |
514 | perror "Window too small." | |
515 | fail "$message" | |
516 | } | |
517 | -re "\\(y or n\\) " { | |
518 | send_gdb "n\n" | |
519 | perror "Got interactive prompt." | |
520 | fail "$message" | |
521 | } | |
522 | eof { | |
523 | perror "Process no longer exists" | |
524 | if { $message != "" } { | |
525 | fail "$message" | |
526 | } | |
527 | return -1 | |
528 | } | |
529 | full_buffer { | |
530 | perror "internal buffer is full." | |
531 | fail "$message" | |
532 | } | |
533 | timeout { | |
534 | if ![string match "" $message] then { | |
535 | fail "$message (timeout)" | |
536 | } | |
537 | set result 1 | |
538 | } | |
539 | } | |
540 | return $result | |
541 | } | |
542 | ||
543 | # | |
544 | # MI run command. (A modified version of gdb_run_cmd) | |
545 | # | |
546 | ||
547 | # In patterns, the newline sequence ``\r\n'' is matched explicitly as | |
548 | # ``.*$'' could swallow up output that we attempt to match elsewhere. | |
549 | ||
550 | proc mi_run_cmd {args} { | |
551 | global suppress_flag | |
552 | if { $suppress_flag } { | |
553 | return -1 | |
554 | } | |
555 | global mi_gdb_prompt | |
556 | ||
557 | if [target_info exists gdb_init_command] { | |
558 | send_gdb "[target_info gdb_init_command]\n"; | |
559 | gdb_expect 30 { | |
560 | -re "$mi_gdb_prompt$" { } | |
561 | default { | |
562 | perror "gdb_init_command for target failed"; | |
563 | return; | |
564 | } | |
565 | } | |
566 | } | |
567 | ||
568 | if [target_info exists use_gdb_stub] { | |
569 | if [target_info exists gdb,do_reload_on_run] { | |
570 | # Specifying no file, defaults to the executable | |
571 | # currently being debugged. | |
572 | if { [mi_gdb_load ""] < 0 } { | |
573 | return; | |
574 | } | |
575 | send_gdb "000-exec-continue\n"; | |
576 | gdb_expect 60 { | |
577 | -re "Continu\[^\r\n\]*\[\r\n\]" {} | |
578 | default {} | |
579 | } | |
580 | return; | |
581 | } | |
582 | } | |
583 | ||
584 | send_gdb "000-exec-run $args\n" | |
585 | gdb_expect { | |
586 | -re "000\\^running\r\n${mi_gdb_prompt}" { | |
587 | } | |
588 | timeout { | |
589 | perror "Unable to start target" | |
590 | return | |
591 | } | |
592 | } | |
593 | # NOTE: Shortly after this there will be a ``000*stopping,...(gdb)'' | |
594 | } | |
595 | ||
596 | # | |
597 | # Just like run-to-main but works with the MI interface | |
598 | # | |
599 | ||
600 | proc mi_run_to_main { } { | |
601 | global suppress_flag | |
602 | if { $suppress_flag } { | |
603 | return -1 | |
604 | } | |
605 | ||
606 | global mi_gdb_prompt | |
607 | global hex | |
608 | global decimal | |
609 | global srcdir | |
610 | global subdir | |
611 | global binfile | |
612 | global srcfile | |
613 | ||
614 | set test "mi run-to-main" | |
615 | mi_delete_breakpoints | |
616 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
617 | mi_gdb_load ${binfile} | |
618 | ||
619 | mi_gdb_test "200-break-insert main" \ | |
620 | "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \ | |
621 | "breakpoint at main" | |
622 | ||
623 | mi_run_cmd | |
624 | gdb_expect { | |
625 | -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" { | |
626 | pass "$test" | |
627 | return 0 | |
628 | } | |
629 | timeout { | |
630 | fail "$test (timeout)" | |
631 | return -1 | |
632 | } | |
633 | } | |
634 | } | |
635 | ||
636 | ||
637 | # Next to the next statement | |
638 | ||
639 | proc mi_next { test } { | |
640 | global suppress_flag | |
641 | if { $suppress_flag } { | |
642 | return -1 | |
643 | } | |
644 | global mi_gdb_prompt | |
645 | send_gdb "220-exec-next\n" | |
646 | gdb_expect { | |
647 | -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\{.*\},,file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" { | |
648 | pass "$test" | |
649 | return 0 | |
650 | } | |
651 | timeout { | |
652 | fail "$test" | |
653 | return -1 | |
654 | } | |
655 | } | |
656 | } | |
657 | ||
658 | ||
659 | # Step to the next statement | |
660 | ||
661 | proc mi_step { test } { | |
662 | global suppress_flag | |
663 | if { $suppress_flag } { | |
664 | return -1 | |
665 | } | |
666 | global mi_gdb_prompt | |
667 | send_gdb "220-exec-step\n" | |
668 | gdb_expect { | |
669 | -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\{.*\},,file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" { | |
670 | pass "$test" | |
671 | return 0 | |
672 | } | |
673 | timeout { | |
674 | fail "$test" | |
675 | return -1 | |
676 | } | |
677 | } | |
678 | } | |
679 | ||
680 | ||
681 | # Local variables: | |
682 | # change-log-default-name: "../gdb.mi/ChangeLog-mi" | |
683 | # End: |