From 1180d410ca6d834919457dcc1e8f336ebe57d446 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Wed, 19 Jun 2002 18:50:30 +0000 Subject: [PATCH] * 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. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/lib/mi-support.exp | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c033fa374fe..44f0aa19745 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2002-06-19 Keith Seitz + + * 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 From Benjamin Kosnik diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 44679f0a004..b17011d2fa5 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -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 } -- 2.47.2