1 # Copyright 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
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.
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.
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.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was based on a file written by Fred Fish. (fnf@cygnus.com)
22 # Test setup routines that work with the MI interpreter.
24 # The variable mi_gdb_prompt is a regexp which matches the gdb mi prompt.
25 # Set it if it is not already set.
27 if ![info exists mi_gdb_prompt] then {
28 set mi_gdb_prompt "\[(\]gdb\[)\] \r\n"
31 global mi_inferior_spawn_id
32 global mi_inferior_tty_name
37 # mi_gdb_exit -- exit the GDB, killing the target program if necessary
40 catch mi_uncatched_gdb_exit
43 proc mi_uncatched_gdb_exit {} {
52 gdb_stop_suppressing_tests;
54 if { [info procs sid_exit] != "" } {
58 if ![info exists gdb_spawn_id] {
62 verbose "Quitting $GDB $GDBFLAGS $MIFLAGS"
64 if { [is_remote host] && [board_info host exists fileid] } {
65 send_gdb "999-gdb-exit\n";
71 -re "Undefined command.*$gdb_prompt $" {
75 -re "DOSEXIT code" { }
80 if ![is_remote host] {
87 # mi_gdb_start [INFERIOR_PTY] -- start gdb running, default procedure
89 # INFERIOR_PTY should be set to separate-inferior-tty to have the inferior work
90 # with it's own PTY. If set to same-inferior-tty, the inferior shares GDB's PTY.
91 # The default value is same-inferior-tty.
93 # When running over NFS, particularly if running many simultaneous
94 # tests on different hosts all using the same server, things can
95 # get really slow. Give gdb at least 3 minutes to start up.
97 proc mi_gdb_start { args } {
107 gdb_stop_suppressing_tests;
108 set inferior_pty no-tty
110 if { [llength $args] == 1} {
111 set inferior_pty [lindex $args 0]
114 set separate_inferior_pty [string match $inferior_pty separate-inferior-tty]
117 if { [info procs sid_start] != "" } {
118 verbose "Spawning SID"
122 verbose "Spawning $GDB -nw $GDBFLAGS $MIFLAGS"
124 if [info exists gdb_spawn_id] {
128 if ![is_remote host] {
129 if { [which $GDB] == 0 } then {
130 perror "$GDB does not exist."
135 # Create the new PTY for the inferior process.
136 if { $separate_inferior_pty } {
138 global mi_inferior_spawn_id
139 global mi_inferior_tty_name
140 set mi_inferior_spawn_id $spawn_id
141 set mi_inferior_tty_name $spawn_out(slave,name)
144 set res [remote_spawn host "$GDB -nw $GDBFLAGS $MIFLAGS [host_info gdb_opts]"];
145 if { $res < 0 || $res == "" } {
146 perror "Spawning $GDB failed."
150 -re "~\"GNU.*\r\n~\".*$mi_gdb_prompt$" {
151 # We have a new format mi startup prompt. If we are
152 # running mi1, then this is an error as we should be
153 # using the old-style prompt.
154 if { $MIFLAGS == "-i=mi1" } {
155 perror "(mi startup) Got unexpected new mi prompt."
159 verbose "GDB initialized."
161 -re "\[^~\].*$mi_gdb_prompt$" {
162 # We have an old format mi startup prompt. If we are
163 # not running mi1, then this is an error as we should be
164 # using the new-style prompt.
165 if { $MIFLAGS != "-i=mi1" } {
166 perror "(mi startup) Got unexpected old mi prompt."
170 verbose "GDB initialized."
172 -re ".*$gdb_prompt $" {
173 untested "Skip mi tests (got non-mi prompt)."
177 -re ".*unrecognized option.*for a complete list of options." {
178 untested "Skip mi tests (not compiled with mi support)."
182 -re ".*Interpreter `mi' unrecognized." {
183 untested "Skip mi tests (not compiled with mi support)."
188 perror "(timeout) GDB never initialized after 10 seconds."
195 # FIXME: mi output does not go through pagers, so these can be removed.
196 # force the height to "unlimited", so no pagers get used
197 send_gdb "100-gdb-set height 0\n"
199 -re ".*100-gdb-set height 0\r\n100\\\^done\r\n$mi_gdb_prompt$" {
200 verbose "Setting height to 0." 2
203 warning "Couldn't set the height to 0"
206 # force the width to "unlimited", so no wraparound occurs
207 send_gdb "101-gdb-set width 0\n"
209 -re ".*101-gdb-set width 0\r\n101\\\^done\r\n$mi_gdb_prompt$" {
210 verbose "Setting width to 0." 2
213 warning "Couldn't set the width to 0."
216 # If allowing the inferior to have its own PTY then assign the inferior
217 # its own terminal device here.
218 if { $separate_inferior_pty } {
219 send_gdb "102-inferior-tty-set $mi_inferior_tty_name\n"
221 -re ".*102\\\^done\r\n$mi_gdb_prompt$" {
222 verbose "redirect inferior output to new terminal device."
225 warning "Couldn't redirect inferior output." 2
233 # Many of the tests depend on setting breakpoints at various places and
234 # running until that breakpoint is reached. At times, we want to start
235 # with a clean-slate with respect to breakpoints, so this utility proc
236 # lets us do this without duplicating this code everywhere.
239 proc mi_delete_breakpoints {} {
242 # FIXME: The mi operation won't accept a prompt back and will use the 'all' arg
243 send_gdb "102-break-delete\n"
245 -re "Delete all breakpoints.*y or n.*$" {
249 -re "102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {
250 # This happens if there were no breakpoints
252 timeout { perror "Delete all breakpoints in mi_delete_breakpoints (timeout)" ; return }
255 # The correct output is not "No breakpoints or watchpoints." but an
256 # empty BreakpointTable. Also, a query is not acceptable with mi.
257 send_gdb "103-break-list\n"
259 -re "103-break-list\r\n103\\\^done,BreakpointTable=\{\}\r\n$mi_gdb_prompt$" {}
260 -re "103-break-list\r\n103\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[\\\]\}" {}
261 -re "103-break-list\r\n103\\\^doneNo breakpoints or watchpoints.\r\n\r\n$mi_gdb_prompt$" {warning "Unexpected console text received"}
262 -re "$mi_gdb_prompt$" { perror "Breakpoints not deleted" ; return }
263 -re "Delete all breakpoints.*or n.*$" {
264 warning "Unexpected prompt for breakpoints deletion";
268 timeout { perror "-break-list (timeout)" ; return }
272 proc mi_gdb_reinitialize_dir { subdir } {
277 if { $suppress_flag } {
281 if [is_remote host] {
285 if { $MIFLAGS == "-i=mi1" } {
286 send_gdb "104-environment-directory\n"
288 -re ".*Reinitialize source path to empty.*y or n. " {
289 warning "Got confirmation prompt for dir reinitialization."
292 -re "$mi_gdb_prompt$" {}
293 timeout {error "Dir reinitialization failed (timeout)"}
296 -re "$mi_gdb_prompt$" {}
297 timeout {error "Dir reinitialization failed (timeout)"}
300 send_gdb "104-environment-directory -r\n"
302 -re "104\\\^done,source-path=.*\r\n$mi_gdb_prompt$" {}
303 -re "$mi_gdb_prompt$" {}
304 timeout {error "Dir reinitialization failed (timeout)"}
308 send_gdb "105-environment-directory $subdir\n"
310 -re "Source directories searched.*$mi_gdb_prompt$" {
311 verbose "Dir set to $subdir"
313 -re "105\\\^done.*\r\n$mi_gdb_prompt$" {
314 # FIXME: We return just the prompt for now.
315 verbose "Dir set to $subdir"
316 # perror "Dir \"$subdir\" failed."
321 # Send GDB the "target" command.
322 # FIXME: Some of these patterns are not appropriate for MI. Based on
323 # config/monitor.exp:gdb_target_command.
324 proc mi_gdb_target_cmd { targetname serialport } {
327 for {set i 1} {$i <= 3} {incr i} {
328 send_gdb "47-target-select $targetname $serialport\n"
330 -re "47\\^connected.*$mi_gdb_prompt$" {
331 verbose "Set target to $targetname";
334 -re "Couldn't establish connection to remote.*$mi_gdb_prompt$" {
335 verbose "Connection failed";
337 -re "Remote MIPS debugging.*$mi_gdb_prompt$" {
338 verbose "Set target to $targetname";
341 -re "Remote debugging using .*$serialport.*$mi_gdb_prompt$" {
342 verbose "Set target to $targetname";
345 -re "Remote target $targetname connected to.*$mi_gdb_prompt$" {
346 verbose "Set target to $targetname";
349 -re "Connected to.*$mi_gdb_prompt$" {
350 verbose "Set target to $targetname";
353 -re "Ending remote.*$mi_gdb_prompt$" { }
354 -re "Connection refused.*$mi_gdb_prompt$" {
355 verbose "Connection refused by remote target. Pausing, and trying again."
359 -re "Timeout reading from remote system.*$mi_gdb_prompt$" {
360 verbose "Got timeout error from gdb.";
372 # load a file into the debugger (file command only).
373 # return a -1 if anything goes wrong.
375 proc mi_gdb_file_cmd { arg } {
381 global last_mi_gdb_file
382 global last_mi_remote_file
383 upvar timeout timeout
386 set arg $last_mi_gdb_file;
388 set last_mi_gdb_file $arg
389 if { [ info exists last_mi_remote_file ] } {
390 unset last_mi_remote_file
394 if [is_remote host] {
395 set arg [remote_download host $arg];
397 error "download failed"
402 # FIXME: Several of these patterns are only acceptable for console
403 # output. Queries are an error for mi.
404 send_gdb "105-file-exec-and-symbols $arg\n"
406 -re "Reading symbols from.*done.*$mi_gdb_prompt$" {
407 verbose "\t\tLoaded $arg into the $GDB"
410 -re "has no symbol-table.*$mi_gdb_prompt$" {
411 perror "$arg wasn't compiled with \"-g\""
414 -re "Load new symbol table from \".*\".*y or n. $" {
417 -re "Reading symbols from.*done.*$mi_gdb_prompt$" {
418 verbose "\t\tLoaded $arg with new symbol table into $GDB"
422 perror "(timeout) Couldn't load $arg, other program already loaded."
427 -re "No such file or directory.*$mi_gdb_prompt$" {
428 perror "($arg) No such file or directory\n"
431 -re "105-file-exec-and-symbols .*\r\n105\\\^done\r\n$mi_gdb_prompt$" {
432 # We (MI) are just giving the prompt back for now, instead of giving
433 # some acknowledgement.
437 perror "couldn't load $arg into $GDB (timed out)."
441 # This is an attempt to detect a core dump, but seems not to
442 # work. Perhaps we need to match .* followed by eof, in which
443 # gdb_expect does not seem to have a way to do that.
444 perror "couldn't load $arg into $GDB (end of file)."
451 # load a file into the debugger.
452 # return a -1 if anything goes wrong.
454 proc mi_gdb_load { arg } {
460 upvar timeout timeout
468 if { [info procs gdbserver_gdb_load] != "" } {
469 global last_mi_gdb_file
470 global last_mi_remote_file
472 if { ! [info exists last_mi_remote_file] } {
473 if [is_remote target] {
474 set last_mi_remote_file [remote_download target $arg /tmp/[file tail $arg].[pid]]
476 set last_mi_remote_file $last_mi_gdb_file
480 set res [gdbserver_gdb_load $last_mi_remote_file]
481 set protocol [lindex $res 0]
482 set gdbport [lindex $res 1]
484 if { [mi_gdb_target_cmd $protocol $gdbport] != 0 } {
487 } elseif { [info procs send_target_sid] != "" } {
488 # For SID, things get complex
491 -re "\\^done.*$mi_gdb_prompt$" {
494 perror "Unable to connect to SID target"
498 send_gdb "48-target-download\n"
500 -re "48\\^done.*$mi_gdb_prompt$" {
503 perror "Unable to download to SID target"
507 } elseif { [target_info protocol] == "sim" } {
508 # For the simulator, just connect to it directly.
509 send_gdb "47-target-select sim\n"
511 -re "47\\^connected.*$mi_gdb_prompt$" {
514 perror "Unable to select sim target"
518 send_gdb "48-target-download\n"
520 -re "48\\^done.*$mi_gdb_prompt$" {
523 perror "Unable to download to sim target"
527 } elseif { [target_info gdb_protocol] == "remote" } {
529 if { [mi_gdb_target_cmd "remote" [target_info netport]] != 0 } {
530 perror "Unable to connect to remote target"
533 send_gdb "48-target-download\n"
535 -re "48\\^done.*$mi_gdb_prompt$" {
538 perror "Unable to download to remote target"
546 # mi_gdb_test COMMAND PATTERN MESSAGE [IPATTERN] -- send a command to gdb;
549 # COMMAND is the command to execute, send to GDB with send_gdb. If
550 # this is the null string no command is sent.
551 # PATTERN is the pattern to match for a PASS, and must NOT include
552 # the \r\n sequence immediately before the gdb prompt.
553 # MESSAGE is the message to be printed. (If this is the empty string,
554 # then sometimes we don't call pass or fail at all; I don't
555 # understand this at all.)
556 # IPATTERN is the pattern to match for the inferior's output. This parameter
557 # is optional. If present, it will produce a PASS if the match is
558 # successful, and a FAIL if unsuccessful.
561 # 1 if the test failed,
562 # 0 if the test passes,
563 # -1 if there was an internal error.
565 proc mi_gdb_test { args } {
568 global GDB expect_out
569 upvar timeout timeout
571 set command [lindex $args 0]
572 set pattern [lindex $args 1]
573 set message [lindex $args 2]
575 if [llength $args]==4 {
576 set ipattern [lindex $args 3]
579 if [llength $args]==5 {
580 set question_string [lindex $args 3];
581 set response_string [lindex $args 4];
583 set question_string "^FOOBAR$"
587 send_user "Sending \"$command\" to gdb\n"
588 send_user "Looking to match \"$pattern\"\n"
589 send_user "Message is \"$message\"\n"
593 set string "${command}\n";
594 set string_regex [string_to_regexp $command]
596 if { $command != "" } {
597 while { "$string" != "" } {
598 set foo [string first "\n" "$string"];
599 set len [string length "$string"];
600 if { $foo < [expr $len - 1] } {
601 set str [string range "$string" 0 $foo];
602 if { [send_gdb "$str"] != "" } {
603 global suppress_flag;
605 if { ! $suppress_flag } {
606 perror "Couldn't send $command to GDB.";
615 set string [string range "$string" [expr $foo + 1] end];
620 if { "$string" != "" } {
621 if { [send_gdb "$string"] != "" } {
622 global suppress_flag;
624 if { ! $suppress_flag } {
625 perror "Couldn't send $command to GDB.";
633 if [info exists timeout] {
637 if [info exists timeout] {
644 -re "\\*\\*\\* DOSEXIT code.*" {
645 if { $message != "" } {
648 gdb_suppress_entire_file "GDB died";
651 -re "Ending remote debugging.*$mi_gdb_prompt\[ \]*$" {
652 if ![isnative] then {
653 warning "Can`t communicate to remote target."
659 -re "^($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" {
660 # At this point, $expect_out(1,string) is the MI input command.
661 # and $expect_out(2,string) is the MI output command.
662 # If $expect_out(1,string) is "", then there was no MI input command here.
664 # NOTE, there is no trailing anchor because with GDB/MI,
665 # asynchronous responses can happen at any point, causing more
666 # data to be available. Normally an anchor is used to make
667 # sure the end of the output is matched, however, $mi_gdb_prompt
668 # is just as good of an anchor since mi_gdb_test is meant to
669 # match a single mi output command. If a second GDB/MI output
670 # response is sent, it will be in the buffer for the next
671 # time mi_gdb_test is called.
672 if ![string match "" $message] then {
677 -re "(${question_string})$" {
678 send_gdb "$response_string\n";
681 -re "Undefined.* command:.*$mi_gdb_prompt\[ \]*$" {
682 perror "Undefined command \"$command\"."
686 -re "Ambiguous command.*$mi_gdb_prompt\[ \]*$" {
687 perror "\"$command\" is not a unique command name."
691 -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
692 if ![string match "" $message] then {
693 set errmsg "$message (the program exited)"
695 set errmsg "$command (the program exited)"
700 -re "The program is not being run.*$mi_gdb_prompt\[ \]*$" {
701 if ![string match "" $message] then {
702 set errmsg "$message (the program is no longer running)"
704 set errmsg "$command (the program is no longer running)"
709 -re ".*$mi_gdb_prompt\[ \]*$" {
710 if ![string match "" $message] then {
717 perror "Window too small."
720 -re "\\(y or n\\) " {
722 perror "Got interactive prompt."
726 perror "Process no longer exists"
727 if { $message != "" } {
733 perror "internal buffer is full."
737 if ![string match "" $message] then {
738 fail "$message (timeout)"
744 # If the GDB output matched, compare the inferior output.
745 if { $result == 0 } {
746 if [ info exists ipattern ] {
747 global mi_inferior_spawn_id
749 -i $mi_inferior_spawn_id -re "$ipattern" {
750 pass "inferior_output:$message"
753 fail "inferior output timeout"
764 # MI run command. (A modified version of gdb_run_cmd)
767 # In patterns, the newline sequence ``\r\n'' is matched explicitly as
768 # ``.*$'' could swallow up output that we attempt to match elsewhere.
770 proc mi_run_cmd {args} {
772 if { $suppress_flag } {
777 if [target_info exists gdb_init_command] {
778 send_gdb "[target_info gdb_init_command]\n";
780 -re "$mi_gdb_prompt$" { }
782 perror "gdb_init_command for target failed";
788 if [target_info exists use_gdb_stub] {
789 if [target_info exists gdb,do_reload_on_run] {
790 # Specifying no file, defaults to the executable
791 # currently being debugged.
792 if { [mi_gdb_load ""] < 0 } {
795 send_gdb "000-exec-continue\n";
797 -re "000\\^running\[\r\n\]+$mi_gdb_prompt$" {}
803 if [target_info exists gdb,start_symbol] {
804 set start [target_info gdb,start_symbol];
809 # HACK: Should either use 000-jump or fix the target code
810 # to better handle RUN.
811 send_gdb "jump *$start\n"
812 warning "Using CLI jump command, expect run-to-main FAIL"
816 send_gdb "000-exec-run $args\n"
818 -re "000\\^running\r\n${mi_gdb_prompt}" {
821 perror "Unable to start target"
825 # NOTE: Shortly after this there will be a ``000*stopping,...(gdb)''
829 # Just like run-to-main but works with the MI interface
832 proc mi_run_to_main { } {
834 if { $suppress_flag } {
843 mi_delete_breakpoints
844 mi_gdb_reinitialize_dir $srcdir/$subdir
845 mi_gdb_load ${binfile}
851 # Just like gdb's "runto" proc, it will run the target to a given
852 # function. The big difference here between mi_runto and mi_execute_to
853 # is that mi_execute_to must have the inferior running already. This
854 # proc will (like gdb's runto) (re)start the inferior, too.
856 # FUNC is the linespec of the place to stop (it inserts a breakpoint here).
858 # -1 if test suppressed, failed, timedout
861 proc mi_runto {func} {
863 if { $suppress_flag } {
867 global mi_gdb_prompt expect_out
868 global hex decimal fullname_syntax
870 set test "mi runto $func"
871 mi_gdb_test "200-break-insert $func" \
872 "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
873 "breakpoint at $func"
875 if {![regexp {number="[0-9]+"} $expect_out(buffer) str]
876 || ![scan $str {number="%d"} bkptno]} {
882 -re ".*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"$bkptno\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
886 -re ".*$mi_gdb_prompt$" {
890 fail "$test (timeout)"
897 # Next to the next statement
898 # For return values, see mi_execute_to_helper
900 proc mi_next { test } {
901 return [mi_next_to {.*} {.*} {.*} {.*} $test]
905 # Step to the next statement
906 # For return values, see mi_execute_to_helper
908 proc mi_step { test } {
909 return [mi_step_to {.*} {.*} {.*} {.*} $test]
912 # cmd should not include the number or newline (i.e. "exec-step 3", not
913 # "220-exec-step 3\n"
915 # Can not match -re ".*\r\n${mi_gdb_prompt}", because of false positives
916 # after the first prompt is printed.
918 proc mi_execute_to_helper { cmd reason func args file line extra test } {
920 if { $suppress_flag } {
926 global fullname_syntax
927 send_gdb "220-$cmd\n"
929 -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
933 -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
934 fail "$test (stopped at wrong place)"
937 -re "220\\^running\r\n${mi_gdb_prompt}.*\r\n${mi_gdb_prompt}$" {
938 fail "$test (unknown output after running)"
942 fail "$test (timeout)"
948 proc mi_execute_to { cmd reason func args file line extra test } {
949 mi_execute_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \
950 "$file" "$line" "$extra" "$test"
953 proc mi_next_to { func args file line test } {
954 mi_execute_to "exec-next" "end-stepping-range" "$func" "$args" \
955 "$file" "$line" "" "$test"
958 proc mi_step_to { func args file line test } {
959 mi_execute_to "exec-step" "end-stepping-range" "$func" "$args" \
960 "$file" "$line" "" "$test"
963 proc mi_finish_to { func args file line result ret test } {
964 mi_execute_to "exec-finish" "function-finished" "$func" "$args" \
966 ",gdb-result-var=\"$result\",return-value=\"$ret\"" \
970 proc mi_continue_to { bkptno func args file line test } {
971 mi_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
972 "$func" "$args" "$file" "$line" "" "$test"
975 proc mi0_execute_to { cmd reason func args file line extra test } {
976 mi_execute_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
977 "$file" "$line" "$extra" "$test"
980 proc mi0_next_to { func args file line test } {
981 mi0_execute_to "exec-next" "end-stepping-range" "$func" "$args" \
982 "$file" "$line" "" "$test"
985 proc mi0_step_to { func args file line test } {
986 mi0_execute_to "exec-step" "end-stepping-range" "$func" "$args" \
987 "$file" "$line" "" "$test"
990 proc mi0_finish_to { func args file line result ret test } {
991 mi0_execute_to "exec-finish" "function-finished" "$func" "$args" \
993 ",gdb-result-var=\"$result\",return-value=\"$ret\"" \
997 proc mi0_continue_to { bkptno func args file line test } {
998 mi0_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
999 "$func" "$args" "$file" "$line" "" "$test"
1002 # Creates varobj named NAME for EXPRESSION.
1003 # Name cannot be "-".
1004 proc mi_create_varobj { name expression testname } {
1005 mi_gdb_test "-var-create $name * $expression" \
1006 "\\^done,name=\"$name\",numchild=\"\[0-9\]+\",type=.*" \
1010 # Updates varobj named NAME and checks that all varobjs in EXPECTED
1011 # are reported as updated, and no other varobj is updated.
1012 # Assumes that no varobj is out of scope and that no varobj changes
1014 proc mi_varobj_update { name expected testname } {
1015 set er "\\^done,changelist=\\\["
1017 foreach item $expected {
1018 set v "{name=\"$item\",in_scope=\"true\",type_changed=\"false\"}"
1027 verbose -log "Expecting: $er" 2
1028 mi_gdb_test "-var-update $name" $er $testname
1031 proc mi_check_varobj_value { name value testname } {
1033 mi_gdb_test "-var-evaluate-expression $name" \
1034 "\\^done,value=\"$value\"" \