[patch] Fix racy FAILs due to "read1" [Re: [PATCH] add -s option to make -break-insert support dprintf]

Jan Kratochvil
2013-05-21T08:10:25Z

On Tue, 21 May 2013 06:24:16 +0200, Hui Zhu wrote:
> Checked in http://sourceware.org/ml/gdb-cvs/2013-05/msg00193.html

It has random FAILs during normal run:

+PASS: gdb.mi/mi-dprintf.exp: fprintf: mi 1st dprintf
+FAIL: gdb.mi/mi-dprintf.exp: fprintf: mi 1st dprintf stop (timeout)
+PASS: gdb.mi/mi-dprintf.exp: fprintf: mi 2nd dprintf

and when I tested it with:
reproducer for races of expect incomplete reads
http://sourceware.org/bugzilla/show_bug.cgi?id=12649

it FAILs reproducibly, could you review the proposed fix?

Thanks,
Jan

gdb/testsuite/
2013-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>

PR testsuite/12649
* gdb.mi/mi-dprintf.exp (mi_continue_dprintf): Fix expect strings for
racy matches.

diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp
index 457f332..ea8b3a8 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp
@@ -68,7 +68,7 @@ proc mi_continue_dprintf {args} {
mi_run_cmd
set msg "mi 1st dprintf"
gdb_expect {
- -re ".*At foo entry.*arg=1234, g=1234.*" {
+ -re ".*At foo entry.*arg=1234, g=1234" {
pass $msg
}
-re ".*$mi_gdb_prompt$" {
@@ -83,7 +83,7 @@ proc mi_continue_dprintf {args} {
set msg "mi 2nd dprintf"
mi_send_resuming_command "exec-continue" "$msg continue"
gdb_expect {
- -re ".*At foo entry.*arg=1235, g=2222.*" {
+ -re ".*At foo entry.*arg=1235, g=2222.*$mi_gdb_prompt$" {
pass $msg
}
-re ".*$mi_gdb_prompt$" {