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]

Re: [RFC] PR 15075 dprintf interferes with "next"


On 05/28/2013 08:01 AM, Hui Zhu wrote:
+gdb_test_multiple $test $test {
>>+    -re "interrupt\r\n$gdb_prompt " {
>>+     pass $test
>>+    }
>>+}
>>+
>>+set test "inferior stopped"
>>+gdb_test_multiple "" $test {
>>+    -re "\r\n\\\[.* \[0-9\]+\\\] #1 stopped\\\.\r\n" {
>>+     pass $test
>>+    }
>>+}
>
>This leaves the prompt in the expect buffer.  I think
>this is likely to confuse the following test that runs.
>
After change this part to:
gdb_test_multiple "" $test {
     -re "\r\n\\\[.* \[0-9\]+\\\] #1 stopped\\\.\r\n$gdb_prompt" {
	pass $test
     }
}
I got:
Running ../../../src/gdb/testsuite/gdb.base/dprintf-non-stop.exp ...
FAIL: gdb.base/dprintf-non-stop.exp: inferior stopped (timeout)


because the gdb_prompt has been consumed by the previous matching:

gdb_test_multiple $test $test {
    -re "interrupt\r\n$gdb_prompt " {
                      ^^^^^^^^^^^^
     pass $test
    }
}

+set test "interrupt"
+gdb_test_multiple $test $test {
+    -re "interrupt\r\n$gdb_prompt " {
+	pass $test
+    }
+}
+
+set test "inferior stopped"
+gdb_test_multiple "" $test {
+    -re "\r\n\\\[.* \[0-9\]+\\\] #1 stopped\\\.\r\n" {
+	pass $test
+    }
+}

I raise a question here that no one asked before, why don't combine these two gdb_test_multiple into one? like:

set test "interrupt inferior"
gdb_test_multiple "interrupt" $test {
    -re "interrupt\r\n.*\\\[.* \[0-9\]+\\\] #1 stopped\\\." {
	pass $test
    }
}
--
Yao (éå)


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