From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] testsuite: pthread_cond_wait.exp: Avoid a race
Date: Tue, 12 Feb 2013 17:04:00 -0000 [thread overview]
Message-ID: <20130212170358.GA5633@host2.jankratochvil.net> (raw)
Hi,
-PASS: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread
+FAIL: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread
-Thread 2 (Thread 0xf7dd6b40 (LWP 4893)):^M
+Thread 2 (Thread 0xf7dd6b40 (LWP 4754)):^M
#0 0xf7fdc430 in __kernel_vsyscall ()^M
-#1 0xf7fc012c in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:172^M
-#2 0x08048683 in cond_wait (cond=0xf7dd6308, mut=0xf7dd6338) at gdb/testsuite/gdb.threads/pthread_cond_wait.c:28^M
-#3 0x080486ce in noreturn () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:43^M
-#4 0x080486db in forever_pthread (unused=0x0) at gdb/testsuite/gdb.threads/pthread_cond_wait.c:49^M
-#5 0xf7fbcadf in start_thread (arg=0xf7dd6b40) at pthread_create.c:309^M
-#6 0xf7ecd42e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133^M
+#1 0xf7fc2dd2 in __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S:98^M
+#2 0xf7fbd7b2 in _L_lock_3175 () from /lib/libpthread.so.0^M
+#3 0xf7fbccc9 in start_thread (arg=0xf7dd6b40) at pthread_create.c:298^M
+#4 0xf7ecd42e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133^M
^M
-Thread 1 (Thread 0xf7dd76c0 (LWP 4745)):^M
+Thread 1 (Thread 0xf7dd76c0 (LWP 4628)):^M
#0 break_me () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:56^M
#1 0x08048738 in main () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:68^M
-(gdb) PASS: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread
+(gdb) FAIL: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread
It is just too racy. I will check in the easy workaround below, it is sure not
a real fix.
Thanks,
Jan
gdb/testsuite/
2013-02-12 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/pthread_cond_wait.c (main): Remove variable ts. Replace
nanosleep by sleep.
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.c b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
index a639e41..3c28e13 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.c
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
@@ -59,12 +59,11 @@ int
main (void)
{
pthread_t forever;
- const struct timespec ts = { 0, 10000000 }; /* 0.01 sec */
pthread_create (&forever, NULL, forever_pthread, NULL);
for (;;)
{
- nanosleep (&ts, NULL);
+ sleep (2);
break_me();
}
next reply other threads:[~2013-02-12 17:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 17:04 Jan Kratochvil [this message]
2013-02-12 17:23 ` Joel Brobecker
2013-02-12 17:30 ` Jan Kratochvil
2013-02-12 17:39 ` Joel Brobecker
2013-02-12 20:13 ` Tom Tromey
2013-02-14 15:25 ` [commit] " Jan Kratochvil
2013-02-12 17:41 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130212170358.GA5633@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox