This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[rfa/testsuite/mi] More timeout fixes


ARM/Linux has an entirely different set of failures than my other test
targets did, and found a whole new set of timeout bugs in the MI testsuite. 
Rather than add the fearsome number of regular expressions, I added some
utility functions to lib/mi-support.exp for stepping, continuing, etc.  I've
tested these on both ARM/Linux (which fails many of them) and i386/Linux
(which passes them all), so I'm pretty confident in them; none the less, I
wouldn't mind if a TCL guru cared to look them over.

Is this OK to commit?  With it, my ARM/Linux testsuite run goes from two and
a half hours down to a much more acceptable half hour.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2001-10-27  Daniel Jacobowitz  <drow@mvista.com>

	* lib/mi-support.exp: (mi_run_to_helper, mi_run_to,
	mi_step_to, mi_next_to, mi_continue_to, mi_finish_to,
	mi0_step_to, mi0_next_to, mi0_continue_to, mi0_finish_to,
	mi0_run_to): New functions.
	* gdb.mi/mi-simplerun.exp: Use them.
	* gdb.mi/mi0-simplerun.exp: Likewise.
	* gdb.mi/mi-var-cmd.exp: Likewise.
	* gdb.mi/mi0-var-cmd.exp: Likewise.
	
Index: gdb/testsuite//gdb.mi/mi-simplerun.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-simplerun.exp,v
retrieving revision 1.8
diff -u -p -r1.8 mi-simplerun.exp
--- mi-simplerun.exp	2001/08/19 01:23:43	1.8
+++ mi-simplerun.exp	2001/10/27 05:38:52
@@ -129,55 +129,24 @@ proc test_controlled_execution {} {
     # -exec-step
     # -exec-finish
 
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    send_gdb "220-exec-next\n"
-    gdb_expect {
-	-re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"33\"\}\r\n$mi_gdb_prompt$" {
-	    pass "next at main"
-	}
-	timeout {
-	    fail "next at main (timeout)"
-	}
-    }
+    mi_next_to "main" "" "basics.c" "33" "next at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``\\\\\"'' is for \".
-    send_gdb "221-exec-step\n"
-    gdb_expect {
-	-re "221\\^running\r\n${mi_gdb_prompt}221\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee1\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\],file=\".*basics.c\",line=\"27\"\}\r\n$mi_gdb_prompt$" {
-            pass "step at main"
-	}
-	timeout {
-	    fail "step at main (timeout)"
-        }
-    }
+    mi_step_to "callee1" \
+	"\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
+	"basics.c" "27" "step at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
-    send_gdb "222-exec-step 3\n"
-    gdb_expect 30 {
-	-re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
-            pass "step to callee4"
-	}
-	timeout {
-	    fail "step to callee4 (timeout)"
-	}
-    }
+    mi_run_to "exec-step 3" "end-stepping-range" "callee4" "" \
+	"basics.c" "8" "" "step to callee4"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``.'' is part of ``gdb-result-var="$1"''
-    send_gdb "223-exec-finish\n"
-    gdb_expect 30 {
-	-re "223\\^running\r\n${mi_gdb_prompt}223\\*stopped,reason=\"function-finished\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\},gdb-result-var=\".1\",return-value=\"0\"\r\n$mi_gdb_prompt$" {
-            pass "exec-finish"
-	}
-	timeout {
-	    fail "exec-finish (timeout)"
-	}
-    }
+    mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
 }
 
 proc test_controlling_breakpoints {} {
Index: gdb/testsuite//gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-var-cmd.exp
--- mi-var-cmd.exp	2001/08/30 01:45:30	1.7
+++ mi-var-cmd.exp	2001/10/27 05:38:53
@@ -80,7 +80,7 @@ gdb_expect {
     -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" {
 	pass "run to do_locals_tests"
     }
-    -re ".*$mi_gdb_prompt$" {fail "run todo_locals_tests (2)"}
+    -re ".*$mi_gdb_prompt$" {fail "run to do_locals_tests (2)"}
     timeout {fail "run to do_locals_tests (timeout 2)"}
 }
 
@@ -180,15 +180,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars"
 
 # Step over "linteger = 1234;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"107\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test"
 
 # Test: c_variable-2.2
 # Desc: check whether only linteger changed values
@@ -197,15 +189,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars: linteger changed"
 
 # Step over "lpinteger = &linteger;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"108\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi_step_to "do_locals_tests" "" "var-cmd.c" 108 "step at do_locals_tests (2)"
 
 # Test: c_variable-2.3
 # Desc: check whether only lpinteger changed
@@ -214,15 +198,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars: lpinteger changed"
 
 # Step over "lcharacter = 'a';"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"109\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi_step_to "do_locals_tests" "" "var-cmd.c" "109" "step at do_locals_tests (3)"
 
 # Test: c_variable-2.4
 # Desc: check whether only lcharacter changed
@@ -231,15 +207,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars: lcharacter changed"
 
 # Step over "lpcharacter = &lcharacter;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"110\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi_step_to "do_locals_tests" "" "var-cmd.c" "110" "step at do_locals_tests (4)"
 
 # Test: c_variable-2.5
 # Desc: check whether only lpcharacter changed
@@ -259,15 +227,8 @@ mi_gdb_test "-var-update *" \
 #  lsimple.unsigned_integer = 255;
 #  lsimple.character = 'a';
 
-send_gdb "-exec-step 9\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"119\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi_run_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
+	"var-cmd.c" "119" "" "step at do_locals_tests (5)"
 
 # Test: c_variable-2.6
 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
@@ -282,15 +243,8 @@ mi_gdb_test "-var-update *" \
 #  lpsimple = &lsimple;
 #  func = nothing;
 
-send_gdb "-exec-step 4\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"125\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi_run_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
+	"var-cmd.c" "125" "" "step at do_locals_tests (6)"
 
 # Test: c_variable-2.7
 # Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
@@ -308,15 +262,8 @@ mi_gdb_test "-var-update *" \
 #  lsimple.unsigned_integer = 4321;
 #  lsimple.character = 'b';
 
-send_gdb "-exec-step 8\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"133\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi_run_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
+	"var-cmd.c" "133" "" "step at do_locals_tests (7)"
 
 # Test: c_variable-2.8
 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
@@ -432,15 +379,9 @@ mi_gdb_test "-var-assign lsimple.integer
 mi_gdb_test "-break-insert subroutine1" \
 	"\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \
 	"break-insert subroutine1"
-send_gdb "-exec-continue\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\\\[\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}\\\],file=\".*var-cmd.c\",line=\"146\"\}\r\n$mi_gdb_prompt$" {
-	pass "continue to subroutine1"
-    }
-    timeout {
-	fail "continue to subroutine1 (timeout)"
-    }
-}
+mi_continue_to "2" "subroutine1" \
+	"\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \
+	"var-cmd.c" "146" "continue to subroutine1"
 
 # Test: c_variable-2.10
 # Desc: create variable for locals i,l in subroutine1
@@ -458,15 +399,8 @@ mi_gdb_test "-var-create linteger * lint
 	"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
 	"create linteger"
 
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\\\[\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\\\],file=\".*var-cmd.c\",line=\"147\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at subroutine1"
-    }
-    timeout {
-	fail "step at subroutine1 (timeout)"
-    }
-}
+mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
+	"var-cmd.c" "147" "step at subroutine1"
 
 # Test: c_variable-2.12
 # Desc: change global_simple.integer
@@ -481,13 +415,8 @@ mi_gdb_test "-var-update *" \
 	"update all vars: changed FIXME"
 clear_xfail *-*-*
 
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\\\[\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\\\],file=\".*var-cmd.c\",line=\"148\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at subroutine1"
-    }
-    timeout { fail "step at subroutine1 (timeout)" }
-}
+mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
+	"var-cmd.c" "148" "step at subroutine1 (2)"
 
 # Test: c_variable-2.13
 # Desc: change subroutine1 local i
@@ -495,13 +424,8 @@ mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}" \
 	"update all vars: i changed"
 
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\\\[\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\\\],file=\".*var-cmd.c\",line=\"149\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at subroutine1"
-    }
-    timeout { fail "step at subroutine1 (timeout)" }
-}
+mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
+	"var-cmd.c" "149" "step at subroutine1 (3)"
 
 # Test: c_variable-2.14
 # Desc: change do_locals_tests local llong
@@ -509,13 +433,7 @@ mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \
 	"update all vars: llong changed"
 
-send_gdb "-exec-next\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"136\"\}\r\n$mi_gdb_prompt$" {
-	pass "next out of subroutine1"
-    }
-    timeout { fail "next out of subroutine1 (timeout)" }
-}
+mi_next_to "do_locals_tests" ""	"var-cmd.c" "136" "next out of subroutine1"
 
 # Test: c_variable-2.15
 # Desc: check for out of scope subroutine1 locals
Index: gdb/testsuite//gdb.mi/mi0-simplerun.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-simplerun.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-simplerun.exp
--- mi0-simplerun.exp	2001/08/19 01:23:43	1.5
+++ mi0-simplerun.exp	2001/10/27 05:38:53
@@ -131,53 +131,24 @@ proc test_controlled_execution {} {
 
     # mi_gdb_test cannot be used for asynchronous commands because there are
     # two prompts involved and this can lead to a race condition.
-    send_gdb "220-exec-next\n"
-    gdb_expect {
-	-re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"33\"\}\r\n$mi_gdb_prompt$" {
-	    pass "next at main"
-	}
-	timeout {
-	    fail "next at main (timeout)"
-	}
-    }
+    mi0_next_to "main" "" "basics.c" "33" "next at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``\\\\\"'' is for \".
-    send_gdb "221-exec-step\n"
-    gdb_expect {
-	-re "221\\^running\r\n${mi_gdb_prompt}221\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee1\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\},file=\".*basics.c\",line=\"27\"\}\r\n$mi_gdb_prompt$" {
-            pass "step at main"
-	}
-	timeout {
-	    fail "step at main (timeout)"
-        }
-    }
+    mi0_step_to "callee1" \
+	"\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
+	"basics.c" "27" "step at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
-    send_gdb "222-exec-step 3\n"
-    gdb_expect 30 {
-	-re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
-            pass "step to callee4"
-	}
-	timeout {
-	    fail "step to callee4 (timeout)"
-	}
-    }
+    mi0_run_to "exec-step 3" "end-stepping-range" "callee4" "" \
+	"basics.c" "8" "" "step to callee4"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``.'' is part of ``gdb-result-var="$1"''
-    send_gdb "223-exec-finish\n"
-    gdb_expect 30 {
-	-re "223\\^running\r\n${mi_gdb_prompt}223\\*stopped,reason=\"function-finished\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\{.*\},file=\".*basics.c\",line=\"18\"\},gdb-result-var=\".1\",return-value=\"0\"\r\n$mi_gdb_prompt$" {
-            pass "exec-finish"
-	}
-	timeout {
-	    fail "exec-finish (timeout)"
-	}
-    }
+    mi0_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
 }
 
 proc test_controlling_breakpoints {} {
Index: gdb/testsuite//gdb.mi/mi0-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-cmd.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-var-cmd.exp
--- mi0-var-cmd.exp	2001/08/30 01:45:30	1.5
+++ mi0-var-cmd.exp	2001/10/27 05:39:04
@@ -180,15 +180,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars"
 
 # Step over "linteger = 1234;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"107\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi0_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test"
 
 # Test: c_variable-2.2
 # Desc: check whether only linteger changed values
@@ -197,15 +189,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars: linteger changed"
 
 # Step over "lpinteger = &linteger;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"108\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi0_step_to "do_locals_tests" "" "var-cmd.c" 108 "step at do_locals_tests (2)"
 
 # Test: c_variable-2.3
 # Desc: check whether only lpinteger changed
@@ -214,15 +198,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars: lpinteger changed"
 
 # Step over "lcharacter = 'a';"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"109\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi0_step_to "do_locals_tests" "" "var-cmd.c" "109" "step at do_locals_tests (3)"
 
 # Test: c_variable-2.4
 # Desc: check whether only lcharacter changed
@@ -231,15 +207,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars: lcharacter changed"
 
 # Step over "lpcharacter = &lcharacter;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"110\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi0_step_to "do_locals_tests" "" "var-cmd.c" "110" "step at do_locals_tests (4)"
 
 # Test: c_variable-2.5
 # Desc: check whether only lpcharacter changed
@@ -259,15 +227,8 @@ mi_gdb_test "-var-update *" \
 #  lsimple.unsigned_integer = 255;
 #  lsimple.character = 'a';
 
-send_gdb "-exec-step 9\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"119\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi0_run_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
+	"var-cmd.c" "119" "" "step at do_locals_tests (5)"
 
 # Test: c_variable-2.6
 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
@@ -282,15 +243,8 @@ mi_gdb_test "-var-update *" \
 #  lpsimple = &lsimple;
 #  func = nothing;
 
-send_gdb "-exec-step 4\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"125\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi0_run_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
+	"var-cmd.c" "125" "" "step at do_locals_tests (6)"
 
 # Test: c_variable-2.7
 # Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
@@ -308,15 +262,8 @@ mi_gdb_test "-var-update *" \
 #  lsimple.unsigned_integer = 4321;
 #  lsimple.character = 'b';
 
-send_gdb "-exec-step 8\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"133\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at do_locals_tests"
-    }
-    timeout {
-	fail "step at do_locals_tests (timeout)"
-    }
-}
+mi0_run_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
+	"var-cmd.c" "133" "" "step at do_locals_tests (7)"
 
 # Test: c_variable-2.8
 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
@@ -432,15 +379,9 @@ mi_gdb_test "-var-assign lsimple.integer
 mi_gdb_test "-break-insert subroutine1" \
 	"\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \
 	"break-insert subroutine1"
-send_gdb "-exec-continue\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}\},file=\".*var-cmd.c\",line=\"146\"\}\r\n$mi_gdb_prompt$" {
-	pass "continue to subroutine1"
-    }
-    timeout {
-	fail "continue to subroutine1 (timeout)"
-    }
-}
+mi0_continue_to "2" "subroutine1" \
+	"\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \
+	"var-cmd.c" "146" "continue to subroutine1"
 
 # Test: c_variable-2.10
 # Desc: create variable for locals i,l in subroutine1
@@ -458,15 +399,8 @@ mi_gdb_test "-var-create linteger * lint
 	"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
 	"create linteger"
 
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"147\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at subroutine1"
-    }
-    timeout {
-	fail "step at subroutine1 (timeout)"
-    }
-}
+mi0_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
+	"var-cmd.c" "147" "step at subroutine1"
 
 # Test: c_variable-2.12
 # Desc: change global_simple.integer
@@ -481,13 +415,8 @@ mi_gdb_test "-var-update *" \
 	"update all vars: changed FIXME"
 clear_xfail *-*-*
 
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"148\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at subroutine1"
-    }
-    timeout { fail "step at subroutine1 (timeout)" }
-}
+mi0_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
+	"var-cmd.c" "148" "step at subroutine1 (2)"
 
 # Test: c_variable-2.13
 # Desc: change subroutine1 local i
@@ -495,13 +424,8 @@ mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}" \
 	"update all vars: i changed"
 
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"149\"\}\r\n$mi_gdb_prompt$" {
-	pass "step at subroutine1"
-    }
-    timeout { fail "step at subroutine1 (timeout)" }
-}
+mi0_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
+	"var-cmd.c" "149" "step at subroutine1 (3)"
 
 # Test: c_variable-2.14
 # Desc: change do_locals_tests local llong
@@ -509,13 +433,7 @@ mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \
 	"update all vars: llong changed"
 
-send_gdb "-exec-next\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"136\"\}\r\n$mi_gdb_prompt$" {
-	pass "next out of subroutine1"
-    }
-    timeout { fail "next out of subroutine1 (timeout)" }
-}
+mi0_next_to "do_locals_tests" "" "var-cmd.c" "136" "next out of subroutine1"
 
 # Test: c_variable-2.15
 # Desc: check for out of scope subroutine1 locals
Index: gdb/testsuite//lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.10
diff -u -p -r1.10 mi-support.exp
--- mi-support.exp	2001/08/19 01:02:58	1.10
+++ mi-support.exp	2001/10/27 05:39:05
@@ -670,7 +670,7 @@ proc mi_next { test } {
     global mi_gdb_prompt
     send_gdb "220-exec-next\n"
     gdb_expect {
-	-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$" {
+	-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$" {
 	    pass "$test"
 	    return 0
 	}
@@ -692,7 +692,7 @@ proc mi_step { test } {
     global mi_gdb_prompt
     send_gdb "220-exec-step\n"
     gdb_expect {
-	-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$" {
+	-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$" {
 	    pass "$test"
 	    return 0
 	}
@@ -701,4 +701,94 @@ proc mi_step { test } {
 	    return -1
 	}
     }
+}
+
+# cmd should not include the number or newline (i.e. "exec-step 3", not
+# "220-exec-step 3\n"
+
+proc mi_run_to_helper { cmd reason func args file line extra test } {
+    global suppress_flag
+    if { $suppress_flag } {
+	return -1
+    }
+    global mi_gdb_prompt
+    global hex
+    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$" {
+	    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$" {
+	    fail "$test (stopped at wrong place)"
+	    return -1
+	}
+	-re "220\\^running\r\n${mi_gdb_prompt}.*\r\n${mi_gdb_prompt}$" {
+	    fail "$test (unknown output after running)"
+	    return -1
+	}
+	-re ".*\r\n${mi_gdb_prompt}" {
+	    fail "$test (unknown output)"
+	    return -1
+	}
+	timeout {
+	    fail "$test (timeout)"
+	    return -1
+	}
+    }
+}
+
+proc mi_run_to { cmd reason func args file line extra test } {
+    mi_run_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \
+	"$file" "$line" "$extra" "$test"
+}
+
+proc mi_next_to { func args file line test } {
+    mi_run_to "exec-next" "end-stepping-range" "$func" "$args" \
+	"$file" "$line" "" "$test"
+}
+
+proc mi_step_to { func args file line test } {
+    mi_run_to "exec-step" "end-stepping-range" "$func" "$args" \
+	"$file" "$line" "" "$test"
+}
+
+proc mi_finish_to { func args file line result ret test } {
+    mi_run_to "exec-finish" "function-finished" "$func" "$args" \
+	"$file" "$line" \
+	",gdb-result-var=\"$result\",return-value=\"$ret\"" \
+	"$test"
+}
+
+proc mi_continue_to { bkptno func args file line test } {
+    mi_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
+	"$func" "$args" "$file" "$line" "" "$test"
+}
+
+proc mi0_run_to { cmd reason func args file line extra test } {
+    mi_run_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
+	"$file" "$line" "$extra" "$test"
+}
+
+proc mi0_next_to { func args file line test } {
+    mi0_run_to "exec-next" "end-stepping-range" "$func" "$args" \
+	"$file" "$line" "" "$test"
+}
+
+proc mi0_step_to { func args file line test } {
+    mi0_run_to "exec-step" "end-stepping-range" "$func" "$args" \
+	"$file" "$line" "" "$test"
+}
+
+proc mi0_finish_to { func args file line result ret test } {
+    mi0_run_to "exec-finish" "function-finished" "$func" "$args" \
+	"$file" "$line" \
+	",gdb-result-var=\"$result\",return-value=\"$ret\"" \
+	"$test"
+}
+
+proc mi0_continue_to { bkptno func args file line test } {
+    mi0_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
+	"$func" "$args" "$file" "$line" "" "$test"
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]