This is the mail archive of the 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 gdbserver async+non-stop: Fix racy FAILs

Hi Pedro,

from the patch:
+		# In non-stop/async mode gdbserver sends *running first and
+		# *stopped only after ^connected.

This causes racy testsuite results in gdbserver mode (usually it works because
GDB sends -exec-continue only after *stopped is already sent).

Do you find this solution acceptable or is there going to be rather
PTRACE_SEIZE usage already etc.?

No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu in gdbserver


spawn ../gdbserver/gdbserver --once :2371 /unsafegdb/testsuite.unix.-m32/gdb.mi/mi-nonstop-exit^M
Process /unsafegdb/testsuite.unix.-m32/gdb.mi/mi-nonstop-exit created; pid = 2852^M
Listening on port 2371^M
47-target-select remote localhost:2371^M
Remote debugging from host^M
~"[New Thread 2852]\n"^M
(gdb) ^M
220^error,msg="Cannot execute this command while the selected thread is running."^M
(gdb) ^M
*stopped,reason="signal-received",signal-name="0",signal-meaning="Signal 0",frame={addr="0xf7fde0f0",func="??",args=[]},thread-id="1",stopped-threads=["1"],core="7"^M
&"warning: Skipping deprecated .gdb_index section in /usr/lib/debug/lib/, pass --use-deprecated-index-sections to use them anyway\n"^M
mi_expect_stop: expecting: \*stopped,reason="breakpoint-hit",disp="del",bkptno="[0-9]+",frame={addr="0x[0-9A-Fa-f]+",func="main",args=\[.*\],(?:file="[^
FAIL: gdb.mi/mi-nonstop-exit.exp: mi runto main (timeout)

2012-07-18  Jan Kratochvil  <>

	Fix racy FAILs in async/non-stop gdbserver mode.
	* lib/mi-support.exp (mi_gdb_target_cmd): Wait for *stopped if present
	after ^connected.
	(mi_expect_interrupt): Do not call pass for empty $test.

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 401565d..1f9ecad 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -338,9 +338,20 @@ proc mi_gdb_target_cmd { targetname serialport } {
     for {set i 1} {$i <= 3} {incr i} {
 	send_gdb "47-target-select $targetname $serialport\n"
 	gdb_expect 60 {
-	    -re "47\\^connected.*$mi_gdb_prompt" {
+	    -re "\r\n\\*stopped,.*\r\n47\\^connected.*$mi_gdb_prompt" {
 		verbose "Set target to $targetname";
-		return 0;
+		return 0
+	    }
+	    -re "\r\n47\\^connected.*\r\n\\*stopped,.*$mi_gdb_prompt" {
+		verbose "Set target to $targetname";
+		return 0
+	    }
+	    -re "\r\n47\\^connected.*$mi_gdb_prompt" {
+		verbose "Set target to $targetname";
+		# In non-stop/async mode gdbserver sends *running first and
+		# *stopped only after ^connected.
+		mi_expect_interrupt ""
+		return 0
 	    -re "unknown host.*$mi_gdb_prompt" {
 	        verbose "Couldn't look up $serialport"
@@ -1123,7 +1134,9 @@ proc mi_expect_interrupt { test } {
     verbose -log "mi_expect_interrupt: expecting: \\*stopped,${r}$any\r\n$prompt_re"
     gdb_expect {
 	-re "\\*stopped,${r}$any\r\n$prompt_re" {
-	    pass "$test"
+	    if {$test != ""} {
+		pass "$test"
+	    }
 	    return 0;
 	-re ".*\r\n$mi_gdb_prompt$" {

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