aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog11
-rw-r--r--gdb/testsuite/gdb.mi/mi-simplerun.exp45
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-cmd.exp124
-rw-r--r--gdb/testsuite/gdb.mi/mi0-simplerun.exp43
-rw-r--r--gdb/testsuite/gdb.mi/mi0-var-cmd.exp122
-rw-r--r--gdb/testsuite/lib/mi-support.exp96
6 files changed, 160 insertions, 281 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8e9d151..dc808fb 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2001-11-11 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.
+
2001-11-10 Andrew Cagney <ac131313@redhat.com>
* gdb.asm/asmsrc1.s: Add ``gdbasm_'' prefix to all macros.
diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp
index 562f1f7..a6f82fc 100644
--- a/gdb/testsuite/gdb.mi/mi-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp
@@ -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 {} {
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 03540b4..d8f9607 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -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 333" \
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 * linteger" \
"&\"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
diff --git a/gdb/testsuite/gdb.mi/mi0-simplerun.exp b/gdb/testsuite/gdb.mi/mi0-simplerun.exp
index 3c8bdca..9113e1f 100644
--- a/gdb/testsuite/gdb.mi/mi0-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi0-simplerun.exp
@@ -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 {} {
diff --git a/gdb/testsuite/gdb.mi/mi0-var-cmd.exp b/gdb/testsuite/gdb.mi/mi0-var-cmd.exp
index c3ed0b2..05db481 100644
--- a/gdb/testsuite/gdb.mi/mi0-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi0-var-cmd.exp
@@ -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 333" \
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 * linteger" \
"&\"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
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 8727ae5..09801d4 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -665,7 +665,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
}
@@ -687,7 +687,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
}
@@ -697,3 +697,95 @@ proc mi_step { test } {
}
}
}
+
+# 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
+ }
+# Can not check for this, because of false positives after half of a running
+# prompt.
+# -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"
+}