]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* lib/mi-support.exp (mi_run_to_main): Use MIFLAGS to figure
authorKeith Seitz <keiths@redhat.com>
Wed, 19 Jun 2002 18:50:30 +0000 (18:50 +0000)
committerKeith Seitz <keiths@redhat.com>
Wed, 19 Jun 2002 18:50:30 +0000 (18:50 +0000)
        out what version of MI is running. Use this to determine the proper
        output of setting a breakpoint.

gdb/testsuite/ChangeLog
gdb/testsuite/lib/mi-support.exp

index c033fa374fe86d002183581f8dbcc646cf6fff48..44f0aa197456f08552398dcd950e2787b1460ee2 100644 (file)
@@ -1,3 +1,9 @@
+2002-06-19  Keith Seitz  <keiths@redhat.com>
+
+       * lib/mi-support.exp (mi_run_to_main): Use MIFLAGS to figure
+       out what version of MI is running. Use this to determine the proper
+       output of setting a breakpoint.
+
 2002-05-27  Michael Chastain  <mec@shout.net>
 From Benjamin Kosnik  <bkoz@redhat.com>
 
index 44679f0a00426267ff419cc0aa9fa8158c696711..b17011d2fa575e2dddf46f832d6359a1dbf69407 100644 (file)
@@ -628,14 +628,24 @@ proc mi_run_to_main { } {
     global subdir
     global binfile
     global srcfile
+    global MIFLAGS
 
     set test "mi run-to-main"
     mi_delete_breakpoints
     mi_gdb_reinitialize_dir $srcdir/$subdir
     mi_gdb_load ${binfile}
 
+    set version 2
+    scan $MIFLAGS "\-i=mi%d" version
+    if {$version < 2} {
+      # MI0 or MI1
+      set bp_result "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}"
+    } else {
+      # MI2+
+      set bp_result "=breakpoint-create,number=\"1\"\r\n200\\^done"
+    }
     mi_gdb_test "200-break-insert main" \
-           "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
+       $bp_result \
            "breakpoint at main"
 
     mi_run_cmd
@@ -714,11 +724,11 @@ proc mi_run_to_helper { cmd reason func args file line extra test } {
     global decimal
     send_gdb "220-$cmd\n"
     gdb_expect {
-       -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
+       -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
            pass "$test"
            return 0
        }
-       -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
+       -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
            fail "$test (stopped at wrong place)"
            return -1
        }