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]

[patch] testsuite: MI: racy results in async mode (PR testsuite/12649)


Hi,

I was looking at some systematic-like regression but it was just a race again.

The fix is ugly but it cannot be done better before there is a generic MI
client parser deployed for the testsuite.

$prompt_re is "" in this case, therefore the =breakpoint-deleted async
notification is randomly left or swallowed by the end of regex in
mi_expect_stop:
        -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {

No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu and with
gdbserver.

I will check it in in some time.


Thanks,
Jan


PASS->FAIL log during a random regression:

 =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0804859b",func="main",file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="55",times="1",original-location="main"}^M
-*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0804859b",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffd004"}],file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="55"},thread-id="1",stopped-threads=["1"],core="7"^M
-=breakpoint-deleted,id="1"^M
+*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0804859b",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffd004"}],file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="55"},thread-id="1",stopped-threads=["1"],core="1"^M
 PASS: gdb.mi/mi-nsmoribund.exp: mi runto main
 Expecting: 222\^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr=".*",func="thread_function",file=".*",fullname=".*",line=".*",times="0",original-location=".*"}
 Expecting: ^(222-break-insert nsmoribund\.c:39[^M
 ]+)?(222\^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr=".*",func="thread_function",file=".*",fullname=".*",line=".*",times="0",original-location=".*"}[^M
 ]+[(]gdb[)] ^M
 [ ]*)
+=breakpoint-deleted,id="1"^M
 222-break-insert nsmoribund.c:39^M
 222^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x08048552",func="thread_function",file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="39",times="0",original-location="nsmoribund.c:39"}^M
 (gdb) ^M
-PASS: gdb.mi/mi-nsmoribund.exp: breakpoint at thread_function
+FAIL: gdb.mi/mi-nsmoribund.exp: breakpoint at thread_function
 -exec-continue --all^M
 ^running^M
 *running,thread-id="1"^M


gdb/testsuite/
2011-10-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/mi-support.exp (breakpoint_re): Suppress match reporting.
	(mi_gdb_test): Import globals thread_selected_re
	and breakpoint_re.  Expect them optionally at the regex start.

--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -32,7 +32,7 @@ set MIFLAGS "-i=mi"
 
 set thread_selected_re "=thread-selected,id=\"\[0-9\]+\"\r\n"
 set library_loaded_re "=library-loaded\[^\n\]+\"\r\n"
-set breakpoint_re "=(breakpoint-created|breakpoint-deleted)\[^\n\]+\"\r\n"
+set breakpoint_re "=(?:breakpoint-created|breakpoint-deleted)\[^\n\]+\"\r\n"
 
 #
 # mi_gdb_exit -- exit the GDB, killing the target program if necessary
@@ -576,7 +576,7 @@ proc mi_gdb_test { args } {
     global verbose
     global mi_gdb_prompt
     global GDB expect_out
-    global inferior_exited_re
+    global inferior_exited_re thread_selected_re breakpoint_re
     upvar timeout timeout
 
     set command [lindex $args 0]
@@ -668,7 +668,7 @@ proc mi_gdb_test { args } {
 	    gdb_start
 	    set result -1
 	}
-	 -re "^($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" {
+	 -re "^(?:$thread_selected_re|$breakpoint_re)*($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" {
 	    # At this point, $expect_out(1,string) is the MI input command.
 	    # and $expect_out(2,string) is the MI output command.
 	    # If $expect_out(1,string) is "", then there was no MI input command here.


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