This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

fix gdb.mi/mi-break.exp in async mode


Running ../../../src/gdb/testsuite/gdb.mi/mi-break.exp ...
FAIL: gdb.mi/mi-break.exp: test hitting breakpoint with commands (timeout)

Easier to see the sync log:

-exec-continue
^running
*running,thread-id="all"
(gdb) 
=breakpoint-modified,bkpt={number="9",type="breakpoint",disp="keep",enabled="y",addr="0x000000000040052b",func="callee2",file="../../../src/gdb/testsuite/gdb.
mi/basics.c",fullname="/home/pedro/gdb/async_default/src/gdb/testsuite/gdb.mi/basics.c",line="40",times="1",script={"set $i=0","while $i<10","print $i","set $
i=$i+1","end","continue"},original-location="basics.c:callee2"}
*stopped,reason="breakpoint-hit",disp="keep",bkptno="9",frame={addr="0x000000000040052b",func="callee2",args=[{name="intarg",value="2"},{name="strarg",value="
0x4006c0 \"A string argument.\""}],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/async_default/src/gdb/testsuite/gdb.mi/basics.c
",line="40"},thread-id="1",stopped-threads="all",core="4"
~"$1 = 0"
~"\n"
~"$2 = 1"
~"\n"
~"$3 = 2"
~"\n"
~"$4 = 3"
~"\n"
~"$5 = 4"
~"\n"
~"$6 = 5"
~"\n"
~"$7 = 6"
~"\n"
~"$8 = 7"
~"\n"
~"$9 = 8"
~"\n"
~"$10 = 9"
~"\n"
*running,thread-id="1"
=breakpoint-modified,bkpt={number="9",type="breakpoint",disp="keep",enabled="y",addr="0x000000000040052b",func="callee2",file="../../../src/gdb/testsuite/gdb.
mi/basics.c",fullname="/home/pedro/gdb/async_default/src/gdb/testsuite/gdb.mi/basics.c",line="40",times="2",script={"set $i=0","while $i<10","print $i","set $
i=$i+1","end","continue"},original-location="basics.c:callee2"}
*stopped,reason="breakpoint-hit",disp="keep",bkptno="9",frame={addr="0x000000000040052b",func="callee2",args=[{name="intarg",value="2"},{name="strarg",value="
0x4006c0 \"A string argument.\""}],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/async_default/src/gdb/testsuite/gdb.mi/basics.c
",line="40"},thread-id="1",stopped-threads="all",core="4"
~"$11 = 0"
~"\n"
~"$12 = 1"
~"\n"
~"$13 = 2"
~"\n"
~"$14 = 3"
~"\n"
~"$15 = 4"
~"\n"
~"$16 = 5"
~"\n"
~"$17 = 6"
~"\n"
~"$18 = 7"
~"\n"
~"$19 = 8"
~"\n"
~"$20 = 9"
~"\n"
*running,thread-id="1"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1"
*stopped,reason="exited-normally"
(gdb)   <<<< === there's no such prompt in async mode. === 
Expecting: ^([
]+)?(.*\$1 = 0.*\$10 = 9.*\*running.*\*stopped,reason="exited-normally".*[
]+[(]gdb[)] 
[ ]*)
PASS: gdb.mi/mi-break.exp: test hitting breakpoint with commands

In async mode, there's no prompt output after *stopped
(by design), so mi_gdb_test times out waiting for it.

The correct procedure one should use to wait for a *stop is
mi_expect_stop, which handles the sync vs async differences.

Applied.

-- 
Pedro Alves

2011-05-20  Pedro Alves  <pedro@codesourcery.com>

	Cope with async mode.

	gdb/testsuite/
	* gdb.mi/mi-break.exp (test_breakpoint_commands): Split gdb_test
	into gdb_test + mi_expect_stop.

---
 gdb/testsuite/gdb.mi/mi-break.exp |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Index: src/gdb/testsuite/gdb.mi/mi-break.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-break.exp	2011-05-20 18:44:40.998818999 +0100
+++ src/gdb/testsuite/gdb.mi/mi-break.exp	2011-05-20 18:48:11.038819000 +0100
@@ -232,10 +232,19 @@ proc test_breakpoint_commands {} {
         "\\^done" \
         "breakpoint commands: set commands"
 
-    mi_send_resuming_command "exec-continue" "test hitting breakpoint with commands"
-    mi_gdb_test "" \
-        ".*\\\$1 = 0.*\\\$10 = 9.*\\*running.*\\*stopped,reason=\"exited-normally\".*" \
-        "test hitting breakpoint with commands"
+    mi_send_resuming_command "exec-continue" "breakpoint commands: continue"
+
+    set test "intermediate stop and continue"
+    gdb_expect {
+        -re ".*\\\$1 = 0.*\\\$10 = 9.*\\*running" {
+	    pass $test
+	}
+        timeout {
+	    fail $test
+        }
+    }
+
+    mi_expect_stop "exited-normally" "" "" "" "" "" "test hitting breakpoint with commands"
 }
 
 test_tbreak_creation_and_listing


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