You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
(25) |
2
(25) |
3
(5) |
4
(13) |
|
5
(4) |
6
(8) |
7
(6) |
8
|
9
(10) |
10
(15) |
11
(9) |
|
12
(14) |
13
(10) |
14
(24) |
15
(41) |
16
(13) |
17
(9) |
18
(3) |
|
19
(10) |
20
(11) |
21
(28) |
22
(36) |
23
(52) |
24
(36) |
25
(12) |
|
26
(31) |
27
(27) |
28
(20) |
29
(15) |
30
(22) |
31
(17) |
|
|
From: Nicholas N. <n.n...@gm...> - 2009-07-26 22:54:12
|
On Sat, Jul 25, 2009 at 11:37 PM, John Reiser<jr...@bi...> wrote: > >> I have a patch that tolerates overlaps such as these, where a custom >> block falls entirely within a malloc()'d block. But there's a design >> choice to be made. In such a case, what do we do with the malloc()'d >> block? >> >> (1) Ignore it completely when leak checking >> (2) Consider it when leak checking > > 0. Have a way for the custom allocator to say, "This interval > will be used as an arena for custom allocation," and "This interval > no longer will be used as such an arena." A custom allocator > must tell memcheck these facts. If not then memcheck may adopt > any policy at all, including random policy. > > 1. Overlap is allowed only for a custom arena and the blocks that > it allocates. Arenas can nest. An arena can be cleared: all blocks > free()d as a group in one operation without specifying each allocated > block separately. > > 2. Each arena is considered to be its own root with respect to blocks > that it allocates, and also each arena is considered to be > an opaque allocated block within its nearest enclosing arena. > Thus the leak report has a separate section for each arena, > and an arena can be leaked within its nearest enclosing arena > yet still contain its own non-leaked blocks. Hmm. That sounds a lot like the existing MEMPOOL client requests, except maybe for the nesting. And I just tested them and found they can handle the given program -- the strategy used is (1) -- any malloc'd block marked as a mempool is ignored by the leak checker. The MEMPOOL requests probably totally subsume MALLOCLIKE/FREELIKE. It's hard to tell without looking deeper as the documentation for the MEMPOOL requests is paltry. I imagine MALLOCLIKE/FREELIKE could be implemented in terms of MEMPOOL. I'll take a look. Thanks for the suggestion. Nick |
|
From: Nicholas N. <n.n...@gm...> - 2009-07-26 22:27:08
|
On Mon, Jul 27, 2009 at 7:36 AM, <sv...@va...> wrote: > Log: > Add a new output file for tc12_rwl_trivial. It unfortunately can't be > the same as the glibc one, because glibc is broken in the sense that > it doesn't return an error code for an attempt to unlock a not-locked > rwlock, and the returned error code affects Helgrind's output. That would be a great comment to have in the .c file. N |
|
From: <sv...@va...> - 2009-07-26 21:59:45
|
Author: sewardj
Date: 2009-07-26 22:59:29 +0100 (Sun, 26 Jul 2009)
New Revision: 10628
Log:
Relatively inconsequential tidying of the Helgrind supps for Darwin.
Modified:
trunk/darwin9.supp
Modified: trunk/darwin9.supp
===================================================================
--- trunk/darwin9.supp 2009-07-26 21:36:24 UTC (rev 10627)
+++ trunk/darwin9.supp 2009-07-26 21:59:29 UTC (rev 10628)
@@ -209,44 +209,44 @@
# I don't know if they're real problems or false positives (njn).
{
- crude1
+ helgrind-darwinlibc-nuke-everything-in-dyld
Helgrind:Race
obj:/usr/lib/dyld
}
+
{
- crude2
+ helgrind-darwinlibc-nuke-everything-in-libSystem.B.dylib
Helgrind:Race
obj:/usr/lib/libSystem.B.dylib
}
+
# This would be better as "fun:\?\?\?" but string matching doesn't seem to
# allow escaping meta-chars.
+#
+# This is very bad .. not only will it hide races in any
+# un-identified piece of code, the ??? also matches any 3-char
+# function name.
{
- crude3
+ helgrind-darwinlibc-nuke-everything-in-???-(unknown-code)
Helgrind:Race
fun:???
}
+
{
- crude4
+ helgrind-darwinlibc--mythread_wrapper-*thread*start*
Helgrind:Race
fun:mythread_wrapper
+ fun:*thread*start*
}
+
{
- crude5
+ helgrind-darwinlibc--pthread_create_WRK-pthread_create
Helgrind:Race
- ...
fun:pthread_create_WRK
fun:pthread_create
}
-# I think this suppresses the same race as helgrind-glibc2X-102,
-# that is, the unavoidable startup race on xargs[2] in hg_intercepts.c.
-{
- helgrind-darwin9-102
- Helgrind:Race
- fun:pthread_create
-}
-
# Thread #9: Bug in libpthread: recursive write lock granted on
# mutex/wrlock which does not support recursion
# at 0x18696: pthread_cond_wait* (hg_intercepts.c:655)
@@ -256,7 +256,7 @@
# no idea what this is about
#
{
- helgrind-darwin9-kludge1
+ helgrind-darwin9--pthread-rwlock-kludgery
Helgrind:Misc
fun:pthread_cond_wait*
fun:pthread_rwlock_*lock*
|
|
From: <sv...@va...> - 2009-07-26 21:36:36
|
Author: sewardj Date: 2009-07-26 22:36:24 +0100 (Sun, 26 Jul 2009) New Revision: 10627 Log: Add a new output file for tc12_rwl_trivial. It unfortunately can't be the same as the glibc one, because glibc is broken in the sense that it doesn't return an error code for an attempt to unlock a not-locked rwlock, and the returned error code affects Helgrind's output. Added: trunk/helgrind/tests/tc12_rwl_trivial.stderr.exp-darwin970 Modified: trunk/helgrind/tests/Makefile.am Modified: trunk/helgrind/tests/Makefile.am =================================================================== --- trunk/helgrind/tests/Makefile.am 2009-07-26 20:15:37 UTC (rev 10626) +++ trunk/helgrind/tests/Makefile.am 2009-07-26 21:36:24 UTC (rev 10627) @@ -42,6 +42,7 @@ tc11_XCHG.vgtest tc11_XCHG.stdout.exp tc11_XCHG.stderr.exp \ tc12_rwl_trivial.vgtest tc12_rwl_trivial.stdout.exp \ tc12_rwl_trivial.stderr.exp \ + tc12_rwl_trivial.stderr.exp-darwin970 \ tc13_laog1.vgtest tc13_laog1.stdout.exp tc13_laog1.stderr.exp \ tc14_laog_dinphils.vgtest tc14_laog_dinphils.stdout.exp \ tc14_laog_dinphils.stderr.exp \ Added: trunk/helgrind/tests/tc12_rwl_trivial.stderr.exp-darwin970 =================================================================== --- trunk/helgrind/tests/tc12_rwl_trivial.stderr.exp-darwin970 (rev 0) +++ trunk/helgrind/tests/tc12_rwl_trivial.stderr.exp-darwin970 2009-07-26 21:36:24 UTC (rev 10627) @@ -0,0 +1,16 @@ + +Thread #x is the program's root thread + +Thread #x unlocked a not-locked lock at 0x........ + at 0x........: pthread_rwlock_unlock* (hg_intercepts.c:...) + by 0x........: main (tc12_rwl_trivial.c:35) + Lock at 0x........ was first observed + at 0x........: pthread_rwlock_init* (hg_intercepts.c:...) + by 0x........: main (tc12_rwl_trivial.c:24) + +Thread #x's call to pthread_rwlock_unlock failed + with error code 22 (EINVAL: Invalid argument) + at 0x........: pthread_rwlock_unlock* (hg_intercepts.c:...) + by 0x........: main (tc12_rwl_trivial.c:35) + +ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) |
|
From: <sv...@va...> - 2009-07-26 20:15:51
|
Author: sewardj
Date: 2009-07-26 21:15:37 +0100 (Sun, 26 Jul 2009)
New Revision: 10626
Log:
Unbreak Helgrind on Linux following recent Darwin hackery.
Modified:
trunk/helgrind/hg_intercepts.c
Modified: trunk/helgrind/hg_intercepts.c
===================================================================
--- trunk/helgrind/hg_intercepts.c 2009-07-26 19:55:18 UTC (rev 10625)
+++ trunk/helgrind/hg_intercepts.c 2009-07-26 20:15:37 UTC (rev 10626)
@@ -208,6 +208,9 @@
// darwin: pthread_create
// darwin: pthread_create_suspended_np (trapped)
//
+/* ensure this has its own frame, so as to make it more distinguishable
+ in suppressions */
+__attribute__((noinline))
static int pthread_create_WRK(pthread_t *thread, const pthread_attr_t *attr,
void *(*start) (void *), void *arg)
{
@@ -1400,6 +1403,7 @@
/*----------------------------------------------------------------*/
#include <semaphore.h>
+#include <fcntl.h> /* O_CREAT */
#define TRACE_SEM_FNS 0
|
|
From: <sv...@va...> - 2009-07-26 19:55:34
|
Author: sewardj
Date: 2009-07-26 20:55:18 +0100 (Sun, 26 Jul 2009)
New Revision: 10625
Log:
Some more baseline suppressions for Darwin.
Modified:
trunk/darwin9.supp
Modified: trunk/darwin9.supp
===================================================================
--- trunk/darwin9.supp 2009-07-26 19:54:43 UTC (rev 10624)
+++ trunk/darwin9.supp 2009-07-26 19:55:18 UTC (rev 10625)
@@ -238,3 +238,27 @@
fun:pthread_create
}
+
+# I think this suppresses the same race as helgrind-glibc2X-102,
+# that is, the unavoidable startup race on xargs[2] in hg_intercepts.c.
+{
+ helgrind-darwin9-102
+ Helgrind:Race
+ fun:pthread_create
+}
+
+# Thread #9: Bug in libpthread: recursive write lock granted on
+# mutex/wrlock which does not support recursion
+# at 0x18696: pthread_cond_wait* (hg_intercepts.c:655)
+# by 0x2300B8: pthread_rwlock_wrlock$UNIX2003 (in /usr/lib/libSystem.B.dylib)
+# by 0x18F41: pthread_rwlock_wrlock* (hg_intercepts.c:1177)
+#
+# no idea what this is about
+#
+{
+ helgrind-darwin9-kludge1
+ Helgrind:Misc
+ fun:pthread_cond_wait*
+ fun:pthread_rwlock_*lock*
+ fun:pthread_rwlock_*lock*
+}
|
|
From: <sv...@va...> - 2009-07-26 19:54:52
|
Author: sewardj Date: 2009-07-26 20:54:43 +0100 (Sun, 26 Jul 2009) New Revision: 10624 Log: Use correct preprocessor symbol for OS-specific code. Modified: trunk/helgrind/tests/tc12_rwl_trivial.c Modified: trunk/helgrind/tests/tc12_rwl_trivial.c =================================================================== --- trunk/helgrind/tests/tc12_rwl_trivial.c 2009-07-26 19:53:42 UTC (rev 10623) +++ trunk/helgrind/tests/tc12_rwl_trivial.c 2009-07-26 19:54:43 UTC (rev 10624) @@ -8,7 +8,7 @@ #include <pthread.h> #include <assert.h> -#ifdef __APPLE__ +#if defined(VGO_darwin) #define OS_IS_DARWIN 1 #else #define OS_IS_DARWIN 0 |
|
From: <sv...@va...> - 2009-07-26 19:53:55
|
Author: sewardj
Date: 2009-07-26 20:53:42 +0100 (Sun, 26 Jul 2009)
New Revision: 10623
Log:
Portability fixes for Darwin (use sem_open and sem_close rather than
sem_init and sem_destroy).
Modified:
trunk/helgrind/tests/tc17_sembar.c
trunk/helgrind/tests/tc23_bogus_condwait.c
trunk/helgrind/tests/tc24_nonzero_sem.c
Modified: trunk/helgrind/tests/tc17_sembar.c
===================================================================
--- trunk/helgrind/tests/tc17_sembar.c 2009-07-26 19:52:06 UTC (rev 10622)
+++ trunk/helgrind/tests/tc17_sembar.c 2009-07-26 19:53:42 UTC (rev 10623)
@@ -1,10 +1,9 @@
-
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>
#include <semaphore.h>
-
+#include <unistd.h>
/* This is really a test of semaphore handling
(sem_{init,destroy,post,wait}). Using semaphores a barrier
function is created. Helgrind-3.3 (p.k.a Thrcheck) does understand
@@ -12,7 +11,6 @@
from happens-before relationships obtained from the component
semaphores. However, it does falsely report one race. Ah well.
Helgrind-3.4 is pure h-b and so reports no races (yay!). */
-
/* This code is derived from
gcc-4.3-20071012/libgomp/config/posix/bar.c, which is
@@ -27,7 +25,9 @@
but it is used to create enough extra inter-thread dependencies
that the barrier-like behaviour of gomp_barrier_t is evident to
Thrcheck. There is no other purpose for the .xxx field. */
-
+static int my_sem_init(sem_t*, char*, int, unsigned);
+static int my_sem_destroy(sem_t*);
+static int my_sem_wait(sem_t*); static int my_sem_post(sem_t*);
typedef struct
{
pthread_mutex_t mutex1;
@@ -46,9 +46,9 @@
{
pthread_mutex_init (&bar->mutex1, NULL);
pthread_mutex_init (&bar->mutex2, NULL);
- sem_init (&bar->sem1, 0, 0);
- sem_init (&bar->sem2, 0, 0);
- sem_init (&bar->xxx, 0, 0);
+ my_sem_init (&bar->sem1, "sem1", 0, 0);
+ my_sem_init (&bar->sem2, "sem2", 0, 0);
+ my_sem_init (&bar->xxx, "xxx", 0, 0);
bar->total = count;
bar->arrived = 0;
}
@@ -62,9 +62,9 @@
pthread_mutex_destroy (&bar->mutex1);
pthread_mutex_destroy (&bar->mutex2);
- sem_destroy (&bar->sem1);
- sem_destroy (&bar->sem2);
- sem_destroy(&bar->xxx);
+ my_sem_destroy (&bar->sem1);
+ my_sem_destroy (&bar->sem2);
+ my_sem_destroy(&bar->xxx);
}
void
@@ -91,20 +91,20 @@
{
{ unsigned int i;
for (i = 0; i < n; i++)
- sem_wait(&bar->xxx); // acquire an obvious dependency from
+ my_sem_wait(&bar->xxx); // acquire an obvious dependency from
// all other threads arriving at the barrier
}
// 1 up n times, 2 down once
// now let all the other threads past the barrier, giving them
// an obvious dependency with this thread.
do
- sem_post (&bar->sem1); // 1 up
+ my_sem_post (&bar->sem1); // 1 up
while (--n != 0);
// and wait till the last thread has left
- sem_wait (&bar->sem2); // 2 down
+ my_sem_wait (&bar->sem2); // 2 down
}
pthread_mutex_unlock (&bar->mutex1);
- /* «Résultats professionnels!» First we made this thread have an
+ /* Resultats professionnels! First we made this thread have an
obvious (Thrcheck-visible) dependency on all other threads
calling gomp_barrier_wait. Then, we released them all again,
so they all have a (visible) dependency on this thread.
@@ -115,16 +115,16 @@
else
{
pthread_mutex_unlock (&bar->mutex1);
- sem_post(&bar->xxx);
+ my_sem_post(&bar->xxx);
// first N-1 threads wind up waiting here
- sem_wait (&bar->sem1); // 1 down
+ my_sem_wait (&bar->sem1); // 1 down
pthread_mutex_lock (&bar->mutex2);
n = --bar->arrived; /* XXX see below */
pthread_mutex_unlock (&bar->mutex2);
if (n == 0)
- sem_post (&bar->sem2); // 2 up
+ my_sem_post (&bar->sem2); // 2 up
}
}
@@ -211,3 +211,65 @@
return 0;
}
+
+
+
+
+
+
+
+static int my_sem_init (sem_t* s, char* identity, int pshared, unsigned count)
+{
+#if defined(VGO_linux)
+ return sem_init(s, pshared, count);
+#elif defined(VGO_darwin)
+ char name[100];
+ sem_t** fakeptr = (sem_t**)s;
+ assert(sizeof(sem_t) >= sizeof(sem_t*));
+ { int i; for (i = 0; i < sizeof(name); i++) name[i] = 0; }
+ sprintf(name, "anonsem_%s_pid%d", identity, (int)getpid());
+ name[ sizeof(name)-1 ] = 0;
+ if (0) printf("name = %s\n", name);
+ *fakeptr = sem_open(name, O_CREAT, 0600, count);
+ if (*fakeptr == (sem_t*)SEM_FAILED)
+ return -1;
+ else
+ return 0;
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_destroy ( sem_t* s )
+{
+#if defined(VGO_linux)
+ return sem_destroy(s);
+#elif defined(VGO_darwin)
+ sem_t** fakeptr = (sem_t**)s;
+ return sem_close(*fakeptr);
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_wait(sem_t* s)
+{
+#if defined(VGO_linux)
+ return sem_wait(s);
+#elif defined(VGO_darwin)
+ return sem_wait( *(sem_t**)s );
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_post(sem_t* s)
+{
+#if defined(VGO_linux)
+ return sem_post(s);
+#elif defined(VGO_darwin)
+ return sem_post( *(sem_t**)s );
+#else
+# error "Unsupported OS"
+#endif
+}
Modified: trunk/helgrind/tests/tc23_bogus_condwait.c
===================================================================
--- trunk/helgrind/tests/tc23_bogus_condwait.c 2009-07-26 19:52:06 UTC (rev 10622)
+++ trunk/helgrind/tests/tc23_bogus_condwait.c 2009-07-26 19:53:42 UTC (rev 10623)
@@ -1,4 +1,3 @@
-
/* Expect 5 errors total (4 re cvs, 1 re exiting w/lock.).
Tests passing bogus mutexes to pthread_cond_wait. */
#define _GNU_SOURCE 1 /* needed by glibc <= 2.3 for pthread_rwlock_* */
@@ -6,13 +5,14 @@
#include <assert.h>
#include <unistd.h>
#include <semaphore.h>
-
+#include <stdio.h>
pthread_mutex_t mx[4];
pthread_cond_t cv;
pthread_rwlock_t rwl;
-
sem_t quit_now;
-
+static int my_sem_init(sem_t*, char*, int, unsigned);
+static int my_sem_destroy(sem_t*);
+static int my_sem_wait(sem_t*); static int my_sem_post(sem_t*);
void* rescue_me ( void* uu )
{
/* wait for, and unblock, the first wait */
@@ -31,14 +31,14 @@
sleep(1);
pthread_cond_signal( &cv );
- sem_wait( &quit_now );
+ my_sem_wait( &quit_now );
return NULL;
}
void* grab_the_lock ( void* uu )
{
int r= pthread_mutex_lock( &mx[2] ); assert(!r);
- sem_wait( &quit_now );
+ my_sem_wait( &quit_now );
r= pthread_mutex_unlock( &mx[2] ); assert(!r);
return NULL;
}
@@ -56,7 +56,7 @@
r= pthread_cond_init(&cv, NULL); assert(!r);
r= pthread_rwlock_init(&rwl, NULL); assert(!r);
- r= sem_init( &quit_now, 0,0 ); assert(!r);
+ r= my_sem_init( &quit_now, "quit_now", 0,0 ); assert(!r);
r= pthread_create( &grabber, NULL, grab_the_lock, NULL ); assert(!r);
sleep(1); /* let the grabber get there first */
@@ -77,10 +77,75 @@
/* mx is held by someone else. */
r= pthread_cond_wait(&cv, &mx[2] );
- r= sem_post( &quit_now ); assert(!r);
- r= sem_post( &quit_now ); assert(!r);
+ r= my_sem_post( &quit_now ); assert(!r);
+ r= my_sem_post( &quit_now ); assert(!r);
r= pthread_join( my_rescuer, NULL ); assert(!r);
r= pthread_join( grabber, NULL ); assert(!r);
+
+ r= my_sem_destroy( &quit_now ); assert(!r);
return 0;
}
+
+
+
+
+
+
+
+
+static int my_sem_init (sem_t* s, char* identity, int pshared, unsigned count)
+{
+#if defined(VGO_linux)
+ return sem_init(s, pshared, count);
+#elif defined(VGO_darwin)
+ char name[100];
+ sem_t** fakeptr = (sem_t**)s;
+ assert(sizeof(sem_t) >= sizeof(sem_t*));
+ { int i; for (i = 0; i < sizeof(name); i++) name[i] = 0; }
+ sprintf(name, "anonsem_%s_pid%d", identity, (int)getpid());
+ name[ sizeof(name)-1 ] = 0;
+ if (0) printf("name = %s\n", name);
+ *fakeptr = sem_open(name, O_CREAT, 0600, count);
+ if (*fakeptr == (sem_t*)SEM_FAILED)
+ return -1;
+ else
+ return 0;
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_destroy ( sem_t* s )
+{
+#if defined(VGO_linux)
+ return sem_destroy(s);
+#elif defined(VGO_darwin)
+ sem_t** fakeptr = (sem_t**)s;
+ return sem_close(*fakeptr);
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_wait(sem_t* s)
+{
+#if defined(VGO_linux)
+ return sem_wait(s);
+#elif defined(VGO_darwin)
+ return sem_wait( *(sem_t**)s );
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_post(sem_t* s)
+{
+#if defined(VGO_linux)
+ return sem_post(s);
+#elif defined(VGO_darwin)
+ return sem_post( *(sem_t**)s );
+#else
+# error "Unsupported OS"
+#endif
+}
Modified: trunk/helgrind/tests/tc24_nonzero_sem.c
===================================================================
--- trunk/helgrind/tests/tc24_nonzero_sem.c 2009-07-26 19:52:06 UTC (rev 10622)
+++ trunk/helgrind/tests/tc24_nonzero_sem.c 2009-07-26 19:53:42 UTC (rev 10623)
@@ -1,20 +1,20 @@
-
/* Check that Helgrind does not complain about semaphores with a
nonzero initial value, when said semaphores are correctly used.
Also useful for generating VCG of simple semaphore activity, for
inspection. */
-
+#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
#include <assert.h>
-
+#include <unistd.h>
#define N_THREADS 3
-
-void* child_fn ( void* semV )
-{
+static int my_sem_init(sem_t*, char*, int, unsigned);
+static int my_sem_destroy(sem_t*);
+static int my_sem_wait(sem_t*); //static int my_sem_post(sem_t*);
+void* child_fn ( void* semV ) {
int r;
sem_t* sem = (sem_t*)semV;
- r= sem_wait(sem); assert(!r);
+ r= my_sem_wait(sem); assert(!r);
return NULL;
}
@@ -24,7 +24,7 @@
sem_t sem;
pthread_t child[N_THREADS];
- r= sem_init(&sem, 0, N_THREADS); assert(!r);
+ r= my_sem_init(&sem, "sem1", 0, N_THREADS); assert(!r);
for (i = 0; i < N_THREADS; i++) {
r= pthread_create( &child[i], NULL, child_fn, (void*)&sem );
@@ -36,6 +36,63 @@
assert(!r);
}
- sem_destroy(&sem);
+ r= my_sem_destroy(&sem); assert(!r);
return 0;
}
+
+
+static int my_sem_init (sem_t* s, char* identity, int pshared, unsigned count)
+{
+#if defined(VGO_linux)
+ return sem_init(s, pshared, count);
+#elif defined(VGO_darwin)
+ char name[100];
+ sem_t** fakeptr = (sem_t**)s;
+ assert(sizeof(sem_t) >= sizeof(sem_t*));
+ { int i; for (i = 0; i < sizeof(name); i++) name[i] = 0; }
+ sprintf(name, "anonsem_%s_pid%d", identity, (int)getpid());
+ name[ sizeof(name)-1 ] = 0;
+ if (0) printf("name = %s\n", name);
+ *fakeptr = sem_open(name, O_CREAT, 0600, count);
+ if (*fakeptr == (sem_t*)SEM_FAILED)
+ return -1;
+ else
+ return 0;
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_destroy ( sem_t* s )
+{
+#if defined(VGO_linux)
+ return sem_destroy(s);
+#elif defined(VGO_darwin)
+ sem_t** fakeptr = (sem_t**)s;
+ return sem_close(*fakeptr);
+#else
+# error "Unsupported OS"
+#endif
+}
+
+static int my_sem_wait(sem_t* s)
+{
+#if defined(VGO_linux)
+ return sem_wait(s);
+#elif defined(VGO_darwin)
+ return sem_wait( *(sem_t**)s );
+#else
+# error "Unsupported OS"
+#endif
+}
+
+//static int my_sem_post(sem_t* s)
+//{
+//#if defined(VGO_linux)
+// return sem_post(s);
+//#elif defined(VGO_darwin)
+// return sem_post( *(sem_t**)s );
+//#else
+//# error "Unsupported OS"
+//#endif
+//}
|
|
From: <sv...@va...> - 2009-07-26 19:52:20
|
Author: sewardj
Date: 2009-07-26 20:52:06 +0100 (Sun, 26 Jul 2009)
New Revision: 10622
Log:
Re-check the symbol names for all pthread intercepts, to find all Linux
and Darwin versions. Add versions for Darwin names that are not so far
supported. Add support for sem_open and sem_close.
Modified:
trunk/helgrind/hg_intercepts.c
Modified: trunk/helgrind/hg_intercepts.c
===================================================================
--- trunk/helgrind/hg_intercepts.c 2009-07-26 19:50:06 UTC (rev 10621)
+++ trunk/helgrind/hg_intercepts.c 2009-07-26 19:52:06 UTC (rev 10622)
@@ -45,6 +45,13 @@
doing something.
*/
+// DDD: for Darwin, need to have non-"@*"-suffixed versions for all pthread
+// functions that currently have them.
+// Note also, in the comments and code below, all Darwin symbols start
+// with a leading underscore, which is not shown either in the comments
+// nor in the redirect specs.
+
+
#include "pub_tool_basics.h"
#include "pub_tool_redir.h"
#include "valgrind.h"
@@ -87,7 +94,7 @@
_arg1,_arg2,0,0,0); \
} while (0)
-#define DO_CREQ_W_WW(_resF, _creqF, _ty1F,_arg1F, _ty2F,_arg2F) \
+#define DO_CREQ_W_WW(_resF, _creqF, _ty1F,_arg1F, _ty2F,_arg2F) \
do { \
Word _res, _arg1, _arg2; \
assert(sizeof(_ty1F) == sizeof(Word)); \
@@ -101,7 +108,7 @@
} while (0)
#define DO_CREQ_v_WWW(_creqF, _ty1F,_arg1F, \
- _ty2F,_arg2F, _ty3F, _arg3F) \
+ _ty2F,_arg2F, _ty3F, _arg3F) \
do { \
Word _unused_res, _arg1, _arg2, _arg3; \
assert(sizeof(_ty1F) == sizeof(Word)); \
@@ -119,7 +126,7 @@
#define DO_PthAPIerror(_fnnameF, _errF) \
do { \
char* _fnname = (char*)(_fnnameF); \
- long _err = (long)(int)(_errF); \
+ long _err = (long)(int)(_errF); \
char* _errstr = lame_strerror(_err); \
DO_CREQ_v_WWW(_VG_USERREQ__HG_PTH_API_ERROR, \
char*,_fnname, \
@@ -194,12 +201,13 @@
return (void*) fn( (void*)arg );
}
-// pthread_create
-// glibc-2.8.90 has "pthread_create@@GLIBC_2.2.5".
-// Darwin has "pthread_create".
+//-----------------------------------------------------------
+// glibc: pthread_create@GLIBC_2.0
+// glibc: pthread_create@@GLIBC_2.1
+// glibc: pthread_create@@GLIBC_2.2.5
+// darwin: pthread_create
+// darwin: pthread_create_suspended_np (trapped)
//
-// DDD: for Darwin, need to have non-"@*"-suffixed versions for all pthread
-// functions that currently have them.
static int pthread_create_WRK(pthread_t *thread, const pthread_attr_t *attr,
void *(*start) (void *), void *arg)
{
@@ -238,20 +246,35 @@
}
return ret;
}
-PTH_FUNC(int, pthreadZucreate, // pthread_create
- pthread_t *thread, const pthread_attr_t *attr,
- void *(*start) (void *), void *arg) {
- return pthread_create_WRK(thread, attr, start, arg);
-}
-PTH_FUNC(int, pthreadZucreateZAZa, // pthread_create@*
- pthread_t *thread, const pthread_attr_t *attr,
- void *(*start) (void *), void *arg) {
- return pthread_create_WRK(thread, attr, start, arg);
-}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZucreateZAZa, // pthread_create@*
+ pthread_t *thread, const pthread_attr_t *attr,
+ void *(*start) (void *), void *arg) {
+ return pthread_create_WRK(thread, attr, start, arg);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZucreate, // pthread_create
+ pthread_t *thread, const pthread_attr_t *attr,
+ void *(*start) (void *), void *arg) {
+ return pthread_create_WRK(thread, attr, start, arg);
+ }
+ PTH_FUNC(int, pthreadZucreateZuZa, // pthread_create_*
+ pthread_t *thread, const pthread_attr_t *attr,
+ void *(*start) (void *), void *arg) {
+ // trap anything else
+ assert(0);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_join
-PTH_FUNC(int, pthreadZujoin, // pthread_join
- pthread_t thread, void** value_pointer)
+
+//-----------------------------------------------------------
+// glibc: pthread_join
+// darwin: pthread_join
+// darwin: pthread_join$NOCANCEL$UNIX2003
+// darwin pthread_join$UNIX2003
+static int pthread_join_WRK(pthread_t thread, void** value_pointer)
{
int ret;
OrigFn fn;
@@ -276,7 +299,21 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZujoin, // pthread_join
+ pthread_t thread, void** value_pointer) {
+ return pthread_join_WRK(thread, value_pointer);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZujoinZa, // pthread_join*
+ pthread_t thread, void** value_pointer) {
+ return pthread_join_WRK(thread, value_pointer);
+ }
+#else
+# error "Unsupported OS"
+#endif
+
/* Behaviour of pthread_join on NPTL:
Me:
@@ -334,7 +371,9 @@
pthread_spin_unlock
*/
-// pthread_mutex_init
+//-----------------------------------------------------------
+// glibc: pthread_mutex_init
+// darwin: pthread_mutex_init
PTH_FUNC(int, pthreadZumutexZuinit, // pthread_mutex_init
pthread_mutex_t *mutex,
pthread_mutexattr_t* attr)
@@ -371,7 +410,9 @@
}
-// pthread_mutex_destroy
+//-----------------------------------------------------------
+// glibc: pthread_mutex_destroy
+// darwin: pthread_mutex_destroy
PTH_FUNC(int, pthreadZumutexZudestroy, // pthread_mutex_destroy
pthread_mutex_t *mutex)
{
@@ -398,7 +439,9 @@
}
-// pthread_mutex_lock
+//-----------------------------------------------------------
+// glibc: pthread_mutex_lock
+// darwin: pthread_mutex_lock
PTH_FUNC(int, pthreadZumutexZulock, // pthread_mutex_lock
pthread_mutex_t *mutex)
{
@@ -433,6 +476,10 @@
}
+//-----------------------------------------------------------
+// glibc: pthread_mutex_trylock
+// darwin: pthread_mutex_trylock
+//
// pthread_mutex_trylock. The handling needed here is very similar
// to that for pthread_mutex_lock, except that we need to tell
// the pre-lock creq that this is a trylock-style operation, and
@@ -474,9 +521,13 @@
}
+//-----------------------------------------------------------
+// glibc: pthread_mutex_timedlock
+// darwin: (doesn't appear to exist)
+//
// pthread_mutex_timedlock. Identical logic to pthread_mutex_trylock.
PTH_FUNC(int, pthreadZumutexZutimedlock, // pthread_mutex_timedlock
- pthread_mutex_t *mutex,
+ pthread_mutex_t *mutex,
void* timeout)
{
int ret;
@@ -512,7 +563,9 @@
}
-// pthread_mutex_unlock
+//-----------------------------------------------------------
+// glibc: pthread_mutex_unlock
+// darwin: pthread_mutex_unlock
PTH_FUNC(int, pthreadZumutexZuunlock, // pthread_mutex_unlock
pthread_mutex_t *mutex)
{
@@ -555,9 +608,15 @@
-- is this important?
*/
-// pthread_cond_wait
-PTH_FUNC(int, pthreadZucondZuwaitZAZa, // pthread_cond_wait@*
- pthread_cond_t* cond, pthread_mutex_t* mutex)
+//-----------------------------------------------------------
+// glibc: pthread_cond_wait@GLIBC_2.2.5
+// glibc: pthread_cond_wait@@GLIBC_2.3.2
+// darwin: pthread_cond_wait
+// darwin: pthread_cond_wait$NOCANCEL$UNIX2003
+// darwin: pthread_cond_wait$UNIX2003
+//
+static int pthread_cond_wait_WRK(pthread_cond_t* cond,
+ pthread_mutex_t* mutex)
{
int ret;
OrigFn fn;
@@ -612,12 +671,33 @@
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZucondZuwaitZAZa, // pthread_cond_wait@*
+ pthread_cond_t* cond, pthread_mutex_t* mutex) {
+ return pthread_cond_wait_WRK(cond, mutex);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZucondZuwaitZa, // pthread_cond_wait*
+ pthread_cond_t* cond, pthread_mutex_t* mutex) {
+ return pthread_cond_wait_WRK(cond, mutex);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_cond_timedwait
-PTH_FUNC(int, pthreadZucondZutimedwaitZAZa, // pthread_cond_timedwait@*
- pthread_cond_t* cond, pthread_mutex_t* mutex,
- struct timespec* abstime)
+//-----------------------------------------------------------
+// glibc: pthread_cond_timedwait@@GLIBC_2.3.2
+// glibc: pthread_cond_timedwait@GLIBC_2.2.5
+// glibc: pthread_cond_timedwait@GLIBC_2.0
+// darwin: pthread_cond_timedwait
+// darwin: pthread_cond_timedwait$NOCANCEL$UNIX2003
+// darwin: pthread_cond_timedwait$UNIX2003
+// darwin: pthread_cond_timedwait_relative_np (trapped)
+//
+static int pthread_cond_timedwait_WRK(pthread_cond_t* cond,
+ pthread_mutex_t* mutex,
+ struct timespec* abstime)
{
int ret;
OrigFn fn;
@@ -670,11 +750,41 @@
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZucondZutimedwaitZAZa, // pthread_cond_timedwait@*
+ pthread_cond_t* cond, pthread_mutex_t* mutex,
+ struct timespec* abstime) {
+ return pthread_cond_timedwait_WRK(cond, mutex, abstime);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZucondZutimedwait, // pthread_cond_timedwait
+ pthread_cond_t* cond, pthread_mutex_t* mutex,
+ struct timespec* abstime) {
+ return pthread_cond_timedwait_WRK(cond, mutex, abstime);
+ }
+ PTH_FUNC(int, pthreadZucondZutimedwaitZDZa, // pthread_cond_timedwait$*
+ pthread_cond_t* cond, pthread_mutex_t* mutex,
+ struct timespec* abstime) {
+ return pthread_cond_timedwait_WRK(cond, mutex, abstime);
+ }
+ PTH_FUNC(int, pthreadZucondZutimedwaitZuZa, // pthread_cond_timedwait_*
+ pthread_cond_t* cond, pthread_mutex_t* mutex,
+ struct timespec* abstime) {
+ assert(0);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_cond_signal
-PTH_FUNC(int, pthreadZucondZusignalZAZa, // pthread_cond_signal@*
- pthread_cond_t* cond)
+//-----------------------------------------------------------
+// glibc: pthread_cond_signal@GLIBC_2.0
+// glibc: pthread_cond_signal@GLIBC_2.2.5
+// glibc: pthread_cond_signal@@GLIBC_2.3.2
+// darwin: pthread_cond_signal
+// darwin: pthread_cond_signal_thread_np (don't intercept this)
+//
+static int pthread_cond_signal_WRK(pthread_cond_t* cond)
{
int ret;
OrigFn fn;
@@ -700,21 +810,39 @@
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZucondZusignalZAZa, // pthread_cond_signal@*
+ pthread_cond_t* cond) {
+ return pthread_cond_signal_WRK(cond);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZucondZusignal, // pthread_cond_signal
+ pthread_cond_t* cond) {
+ return pthread_cond_signal_WRK(cond);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_cond_broadcast
+//-----------------------------------------------------------
+// glibc: pthread_cond_broadcast@GLIBC_2.0
+// glibc: pthread_cond_broadcast@GLIBC_2.2.5
+// glibc: pthread_cond_broadcast@@GLIBC_2.3.2
+// darwin: pthread_cond_broadcast
+//
// Note, this is pretty much identical, from a dependency-graph
// point of view, with cond_signal, so the code is duplicated.
// Maybe it should be commoned up.
-PTH_FUNC(int, pthreadZucondZubroadcastZAZa, // pthread_cond_broadcast@*
- pthread_cond_t* cond)
+//
+static int pthread_cond_broadcast_WRK(pthread_cond_t* cond)
{
int ret;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
if (TRACE_PTH_FNS) {
- fprintf(stderr, "<< pthread_broadcast_signal %p", cond);
+ fprintf(stderr, "<< pthread_cond_broadcast %p", cond);
fflush(stderr);
}
@@ -733,11 +861,28 @@
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZucondZubroadcastZAZa, // pthread_cond_broadcast@*
+ pthread_cond_t* cond) {
+ return pthread_cond_broadcast_WRK(cond);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZucondZubroadcast, // pthread_cond_broadcast
+ pthread_cond_t* cond) {
+ return pthread_cond_broadcast_WRK(cond);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_cond_destroy
-PTH_FUNC(int, pthreadZucondZudestroyZAZa, // pthread_cond_destroy@*
- pthread_cond_t* cond)
+//-----------------------------------------------------------
+// glibc: pthread_cond_destroy@@GLIBC_2.3.2
+// glibc: pthread_cond_destroy@GLIBC_2.2.5
+// glibc: pthread_cond_destroy@GLIBC_2.0
+// darwin: pthread_cond_destroy
+//
+static int pthread_cond_destroy_WRK(pthread_cond_t* cond)
{
int ret;
OrigFn fn;
@@ -764,6 +909,19 @@
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZucondZudestroyZAZa, // pthread_cond_destroy@*
+ pthread_cond_t* cond) {
+ return pthread_cond_destroy_WRK(cond);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZucondZudestroy, // pthread_cond_destroy
+ pthread_cond_t* cond) {
+ return pthread_cond_destroy_WRK(cond);
+ }
+#else
+# error "Unsupported OS"
+#endif
/*----------------------------------------------------------------*/
@@ -783,6 +941,9 @@
-- are these important?
*/
+//-----------------------------------------------------------
+// glibc: pthread_barrier_init
+// darwin: (doesn't appear to exist)
PTH_FUNC(int, pthreadZubarrierZuinit, // pthread_barrier_init
pthread_barrier_t* bar,
pthread_barrierattr_t* attr, unsigned long count)
@@ -815,6 +976,9 @@
}
+//-----------------------------------------------------------
+// glibc: pthread_barrier_wait
+// darwin: (doesn't appear to exist)
PTH_FUNC(int, pthreadZubarrierZuwait, // pthread_barrier_wait
pthread_barrier_t* bar)
{
@@ -849,6 +1013,9 @@
}
+//-----------------------------------------------------------
+// glibc: pthread_barrier_destroy
+// darwin: (doesn't appear to exist)
PTH_FUNC(int, pthreadZubarrierZudestroy, // pthread_barrier_destroy
pthread_barrier_t* bar)
{
@@ -895,10 +1062,12 @@
pthread_rwlock_trywrlock
*/
-// pthread_rwlock_init
-PTH_FUNC(int, pthreadZurwlockZuinit, // pthread_rwlock_init
- pthread_rwlock_t *rwl,
- pthread_rwlockattr_t* attr)
+//-----------------------------------------------------------
+// glibc: pthread_rwlock_init
+// darwin: pthread_rwlock_init
+// darwin: pthread_rwlock_init$UNIX2003
+static int pthread_rwlock_init_WRK(pthread_rwlock_t *rwl,
+ pthread_rwlockattr_t* attr)
{
int ret;
OrigFn fn;
@@ -921,11 +1090,29 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZurwlockZuinit, // pthread_rwlock_init
+ pthread_rwlock_t *rwl,
+ pthread_rwlockattr_t* attr) {
+ return pthread_rwlock_init_WRK(rwl, attr);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZurwlockZuinitZa, // pthread_rwlock_init*
+ pthread_rwlock_t *rwl,
+ pthread_rwlockattr_t* attr) {
+ return pthread_rwlock_init_WRK(rwl, attr);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_rwlock_destroy
-PTH_FUNC(int, pthreadZurwlockZudestroy, // pthread_rwlock_destroy
- pthread_rwlock_t *rwl)
+//-----------------------------------------------------------
+// glibc: pthread_rwlock_destroy
+// darwin: pthread_rwlock_destroy
+// darwin: pthread_rwlock_destroy$UNIX2003
+//
+static int pthread_rwlock_destroy_WRK(pthread_rwlock_t* rwl)
{
int ret;
OrigFn fn;
@@ -948,11 +1135,27 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZurwlockZudestroy, // pthread_rwlock_destroy
+ pthread_rwlock_t *rwl) {
+ return pthread_rwlock_destroy_WRK(rwl);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZurwlockZudestroyZa, // pthread_rwlock_destroy*
+ pthread_rwlock_t *rwl) {
+ return pthread_rwlock_destroy_WRK(rwl);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_rwlock_wrlock
-PTH_FUNC(int, pthreadZurwlockZuwrlock, // pthread_rwlock_wrlock
- pthread_rwlock_t* rwlock)
+//-----------------------------------------------------------
+// glibc: pthread_rwlock_wrlock
+// darwin: pthread_rwlock_wrlock
+// darwin: pthread_rwlock_wrlock$UNIX2003
+//
+static int pthread_rwlock_wrlock_WRK(pthread_rwlock_t* rwlock)
{
int ret;
OrigFn fn;
@@ -979,11 +1182,27 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZurwlockZuwrlock, // pthread_rwlock_wrlock
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_wrlock_WRK(rwlock);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZurwlockZuwrlockZa, // pthread_rwlock_wrlock*
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_wrlock_WRK(rwlock);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_rwlock_rdlock
-PTH_FUNC(int, pthreadZurwlockZurdlock, // pthread_rwlock_rdlock
- pthread_rwlock_t* rwlock)
+//-----------------------------------------------------------
+// glibc: pthread_rwlock_rdlock
+// darwin: pthread_rwlock_rdlock
+// darwin: pthread_rwlock_rdlock$UNIX2003
+//
+static int pthread_rwlock_rdlock_WRK(pthread_rwlock_t* rwlock)
{
int ret;
OrigFn fn;
@@ -1010,11 +1229,27 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZurwlockZurdlock, // pthread_rwlock_rdlock
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_rdlock_WRK(rwlock);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZurwlockZurdlockZa, // pthread_rwlock_rdlock*
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_rdlock_WRK(rwlock);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_rwlock_trywrlock
-PTH_FUNC(int, pthreadZurwlockZutrywrlock, // pthread_rwlock_trywrlock
- pthread_rwlock_t* rwlock)
+//-----------------------------------------------------------
+// glibc: pthread_rwlock_trywrlock
+// darwin: pthread_rwlock_trywrlock
+// darwin: pthread_rwlock_trywrlock$UNIX2003
+//
+static int pthread_rwlock_trywrlock_WRK(pthread_rwlock_t* rwlock)
{
int ret;
OrigFn fn;
@@ -1047,11 +1282,27 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZurwlockZutrywrlock, // pthread_rwlock_trywrlock
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_trywrlock_WRK(rwlock);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZurwlockZutrywrlockZa, // pthread_rwlock_trywrlock*
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_trywrlock_WRK(rwlock);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_rwlock_tryrdlock
-PTH_FUNC(int, pthreadZurwlockZutryrdlock, // pthread_rwlock_tryrdlock
- pthread_rwlock_t* rwlock)
+//-----------------------------------------------------------
+// glibc: pthread_rwlock_tryrdlock
+// darwin: pthread_rwlock_trywrlock
+// darwin: pthread_rwlock_trywrlock$UNIX2003
+//
+static int pthread_rwlock_tryrdlock_WRK(pthread_rwlock_t* rwlock)
{
int ret;
OrigFn fn;
@@ -1084,11 +1335,26 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZurwlockZutryrdlock, // pthread_rwlock_tryrdlock
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_tryrdlock_WRK(rwlock);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZurwlockZutryrdlockZa, // pthread_rwlock_tryrdlock*
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_tryrdlock_WRK(rwlock);
+ }
+#else
+# error "Unsupported OS"
+#endif
-// pthread_rwlock_unlock
-PTH_FUNC(int, pthreadZurwlockZuunlock, // pthread_rwlock_unlock
- pthread_rwlock_t* rwlock)
+//-----------------------------------------------------------
+// glibc: pthread_rwlock_unlock
+// darwin: pthread_rwlock_unlock
+// darwin: pthread_rwlock_unlock$UNIX2003
+static int pthread_rwlock_unlock_WRK(pthread_rwlock_t* rwlock)
{
int ret;
OrigFn fn;
@@ -1114,6 +1380,19 @@
}
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, pthreadZurwlockZuunlock, // pthread_rwlock_unlock
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_unlock_WRK(rwlock);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, pthreadZurwlockZuunlockZa, // pthread_rwlock_unlock*
+ pthread_rwlock_t* rwlock) {
+ return pthread_rwlock_unlock_WRK(rwlock);
+ }
+#else
+# error "Unsupported OS"
+#endif
/*----------------------------------------------------------------*/
@@ -1129,6 +1408,10 @@
int sem_destroy(sem_t *sem);
int sem_wait(sem_t *sem);
int sem_post(sem_t *sem);
+ sem_t* sem_open(const char *name, int oflag,
+ ... [mode_t mode, unsigned value]);
+ [complete with its idiotic semantics]
+ int sem_close(sem_t* sem);
Unhandled:
int sem_trywait(sem_t *sem);
@@ -1136,9 +1419,13 @@
const struct timespec *restrict abs_timeout);
*/
-/* glibc-2.5 has sem_init@@GLIBC_2.2.5 (amd64-linux)
- and sem_init@@GLIBC_2.1 (x86-linux): match sem_init@* */
-PTH_FUNC(int, semZuinitZAZa, sem_t* sem, int pshared, unsigned long value)
+//-----------------------------------------------------------
+// glibc: sem_init@@GLIBC_2.2.5
+// glibc: sem_init@@GLIBC_2.1
+// glibc: sem_init@GLIBC_2.0
+// darwin: sem_init
+//
+static int sem_init_WRK(sem_t* sem, int pshared, unsigned long value)
{
OrigFn fn;
int ret;
@@ -1165,11 +1452,27 @@
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, semZuinitZAZa, // sem_init@*
+ sem_t* sem, int pshared, unsigned long value) {
+ return sem_init_WRK(sem, pshared, value);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, semZuinit, // sem_init
+ sem_t* sem, int pshared, unsigned long value) {
+ return sem_init_WRK(sem, pshared, value);
+ }
+#else
+# error "Unsupported OS"
+#endif
-/* glibc-2.5 has sem_destroy@@GLIBC_2.2.5 (amd64-linux)
- and sem_destroy@@GLIBC_2.1 (x86-linux); match sem_destroy@* */
-PTH_FUNC(int, semZudestroyZAZa, sem_t* sem)
+//-----------------------------------------------------------
+// glibc: sem_destroy@GLIBC_2.0
+// glibc: sem_destroy@@GLIBC_2.1
+// glibc: sem_destroy@@GLIBC_2.2.5
+// darwin: sem_destroy
+static int sem_destroy_WRK(sem_t* sem)
{
OrigFn fn;
int ret;
@@ -1195,10 +1498,29 @@
return ret;
}
+#if defined(VGO_linux)
+ PTH_FUNC(int, semZudestroyZAZa, // sem_destroy*
+ sem_t* sem) {
+ return sem_destroy_WRK(sem);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, semZudestroy, // sem_destroy
+ sem_t* sem) {
+ return sem_destroy_WRK(sem);
+ }
+#else
+# error "Unsupported OS"
+#endif
-/* glibc-2.5 has sem_wait (amd64-linux); match sem_wait
- and sem_wait@@GLIBC_2.1 (x86-linux); match sem_wait@* */
+//-----------------------------------------------------------
+// glibc: sem_wait
+// glibc: sem_wait@GLIBC_2.0
+// glibc: sem_wait@@GLIBC_2.1
+// darwin: sem_wait
+// darwin: sem_wait$NOCANCEL$UNIX2003
+// darwin: sem_wait$UNIX2003
+//
/* wait: decrement semaphore - acquire lockage */
static int sem_wait_WRK(sem_t* sem)
{
@@ -1226,16 +1548,31 @@
return ret;
}
-PTH_FUNC(int, semZuwait, sem_t* sem) { /* sem_wait */
- return sem_wait_WRK(sem);
-}
-PTH_FUNC(int, semZuwaitZAZa, sem_t* sem) { /* sem_wait@* */
- return sem_wait_WRK(sem);
-}
+#if defined(VGO_linux)
+ PTH_FUNC(int, semZuwait, sem_t* sem) { /* sem_wait */
+ return sem_wait_WRK(sem);
+ }
+ PTH_FUNC(int, semZuwaitZAZa, sem_t* sem) { /* sem_wait@* */
+ return sem_wait_WRK(sem);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, semZuwait, sem_t* sem) { /* sem_wait */
+ return sem_wait_WRK(sem);
+ }
+ PTH_FUNC(int, semZuwaitZDZa, sem_t* sem) { /* sem_wait$* */
+ return sem_wait_WRK(sem);
+ }
+#else
+# error "Unsupported OS"
+#endif
-/* glibc-2.5 has sem_post (amd64-linux); match sem_post
- and sem_post@@GLIBC_2.1 (x86-linux); match sem_post@* */
+//-----------------------------------------------------------
+// glibc: sem_post
+// glibc: sem_post@GLIBC_2.0
+// glibc: sem_post@@GLIBC_2.1
+// darwin: sem_post
+//
/* post: increment semaphore - release lockage */
static int sem_post_WRK(sem_t* sem)
{
@@ -1264,15 +1601,91 @@
return ret;
}
-PTH_FUNC(int, semZupost, sem_t* sem) { /* sem_post */
- return sem_post_WRK(sem);
+#if defined(VGO_linux)
+ PTH_FUNC(int, semZupost, sem_t* sem) { /* sem_post */
+ return sem_post_WRK(sem);
+ }
+ PTH_FUNC(int, semZupostZAZa, sem_t* sem) { /* sem_post@* */
+ return sem_post_WRK(sem);
+ }
+#elif defined(VGO_darwin)
+ PTH_FUNC(int, semZupost, sem_t* sem) { /* sem_post */
+ return sem_post_WRK(sem);
+ }
+#else
+# error "Unsupported OS"
+#endif
+
+
+//-----------------------------------------------------------
+// glibc: sem_open
+// darwin: sem_open
+//
+PTH_FUNC(sem_t*, semZuopen,
+ const char* name, long oflag,
+ long mode, unsigned long value)
+{
+ /* A copy of sem_init_WRK (more or less). Is this correct? */
+ OrigFn fn;
+ sem_t* ret;
+ VALGRIND_GET_ORIG_FN(fn);
+
+ if (TRACE_SEM_FNS) {
+ fprintf(stderr, "<< sem_open(\"%s\",%ld,%lx,%lu) ",
+ name,oflag,mode,value);
+ fflush(stderr);
+ }
+
+ CALL_FN_W_WWWW(ret, fn, name,oflag,mode,value);
+
+ if (ret != SEM_FAILED && (oflag & O_CREAT)) {
+ DO_CREQ_v_WW(_VG_USERREQ__HG_POSIX_SEM_INIT_POST,
+ sem_t*, ret, unsigned long, value);
+ }
+ if (ret == SEM_FAILED) {
+ DO_PthAPIerror( "sem_open", errno );
+ }
+
+ if (TRACE_SEM_FNS) {
+ fprintf(stderr, " sem_open -> %p >>\n", ret);
+ fflush(stderr);
+ }
+
+ return ret;
}
-PTH_FUNC(int, semZupostZAZa, sem_t* sem) { /* sem_post@* */
- return sem_post_WRK(sem);
+
+
+//-----------------------------------------------------------
+// glibc: sem_close
+// darwin: sem_close
+PTH_FUNC(int, sem_close, sem_t* sem)
+{
+ OrigFn fn;
+ int ret;
+ VALGRIND_GET_ORIG_FN(fn);
+
+ if (TRACE_SEM_FNS) {
+ fprintf(stderr, "<< sem_close(%p) ", sem);
+ fflush(stderr);
+ }
+
+ DO_CREQ_v_W(_VG_USERREQ__HG_POSIX_SEM_DESTROY_PRE, sem_t*, sem);
+
+ CALL_FN_W_W(ret, fn, sem);
+
+ if (ret != 0) {
+ DO_PthAPIerror( "sem_close", errno );
+ }
+
+ if (TRACE_SEM_FNS) {
+ fprintf(stderr, " close -> %d >>\n", ret);
+ fflush(stderr);
+ }
+
+ return ret;
}
-
/*----------------------------------------------------------------*/
/*--- Qt 4 threading functions (w/ GNU name mangling) ---*/
/*----------------------------------------------------------------*/
@@ -1362,6 +1775,7 @@
ret_ty I_WRAP_SONAME_FNNAME_ZU(libQtCoreZdsoZa,f)(args); \
ret_ty I_WRAP_SONAME_FNNAME_ZU(libQtCoreZdsoZa,f)(args)
+//-----------------------------------------------------------
// QMutex::lock()
QT4_FUNC(void, _ZN6QMutex4lockEv, void* self)
{
@@ -1384,6 +1798,7 @@
}
}
+//-----------------------------------------------------------
// QMutex::unlock()
QT4_FUNC(void, _ZN6QMutex6unlockEv, void* self)
{
@@ -1407,6 +1822,7 @@
}
}
+//-----------------------------------------------------------
// bool QMutex::tryLock()
// using 'long' to mimic C++ 'bool'
QT4_FUNC(long, _ZN6QMutex7tryLockEv, void* self)
@@ -1436,6 +1852,7 @@
return ret;
}
+//-----------------------------------------------------------
// bool QMutex::tryLock(int)
// using 'long' to mimic C++ 'bool'
QT4_FUNC(long, _ZN6QMutex7tryLockEi, void* self, long arg2)
@@ -1467,6 +1884,7 @@
}
+//-----------------------------------------------------------
// It's not really very clear what the args are here. But from
// a bit of dataflow analysis of the generated machine code of
// the original function, it appears this takes two args, and
@@ -1489,6 +1907,7 @@
return (void*)ret;
}
+//-----------------------------------------------------------
// QMutex::~QMutex() ("D1Ev" variant)
QT4_FUNC(void*, _ZN6QMutexD1Ev, void* mutex)
{
@@ -1502,6 +1921,7 @@
}
+//-----------------------------------------------------------
// QMutex::QMutex(QMutex::RecursionMode) ("C2ENS" variant)
QT4_FUNC(void*, _ZN6QMutexC2ENS_13RecursionModeE,
void* mutex,
@@ -1510,6 +1930,8 @@
assert(0);
}
+
+//-----------------------------------------------------------
// QMutex::~QMutex() ("D2Ev" variant)
QT4_FUNC(void*, _ZN6QMutexD2Ev, void* mutex)
{
|
|
From: <sv...@va...> - 2009-07-26 19:50:19
|
Author: sewardj
Date: 2009-07-26 20:50:06 +0100 (Sun, 26 Jul 2009)
New Revision: 10621
Log:
Only collect stacktraces at scalar Kr boundaries at history level 1.
Modified:
trunk/helgrind/libhb_core.c
Modified: trunk/helgrind/libhb_core.c
===================================================================
--- trunk/helgrind/libhb_core.c 2009-07-26 19:41:07 UTC (rev 10620)
+++ trunk/helgrind/libhb_core.c 2009-07-26 19:50:06 UTC (rev 10621)
@@ -2885,6 +2885,11 @@
Word nPresent;
ULong_n_EC pair;
tl_assert(thr);
+
+ // We only collect this info at history level 1 (approx)
+ if (HG_(clo_history_level) != 1)
+ return;
+
/* This is the scalar Kr for thr. */
pair.ull = VtsID__indexAt( thr->viR, thr );
pair.ec = main_get_EC( thr );
|
|
From: <sv...@va...> - 2009-07-26 19:41:23
|
Author: sewardj
Date: 2009-07-26 20:41:07 +0100 (Sun, 26 Jul 2009)
New Revision: 10620
Log:
Add new mangling Z-pair "ZD" to encode '$', since that's sometimes used
in Darwin symbol names.
Modified:
trunk/coregrind/m_demangle/demangle.c
trunk/include/pub_tool_redir.h
Modified: trunk/coregrind/m_demangle/demangle.c
===================================================================
--- trunk/coregrind/m_demangle/demangle.c 2009-07-26 19:28:07 UTC (rev 10619)
+++ trunk/coregrind/m_demangle/demangle.c 2009-07-26 19:41:07 UTC (rev 10620)
@@ -228,16 +228,17 @@
i++;
switch (sym[i]) {
case 'a': EMITSO('*'); break;
- case 'p': EMITSO('+'); break;
case 'c': EMITSO(':'); break;
case 'd': EMITSO('.'); break;
- case 'u': EMITSO('_'); break;
case 'h': EMITSO('-'); break;
+ case 'p': EMITSO('+'); break;
case 's': EMITSO(' '); break;
- case 'Z': EMITSO('Z'); break;
+ case 'u': EMITSO('_'); break;
case 'A': EMITSO('@'); break;
+ case 'D': EMITSO('$'); break;
case 'L': EMITSO('('); break;
case 'R': EMITSO(')'); break;
+ case 'Z': EMITSO('Z'); break;
default: error = True; goto out;
}
i++;
@@ -276,16 +277,17 @@
i++;
switch (sym[i]) {
case 'a': EMITFN('*'); break;
- case 'p': EMITFN('+'); break;
case 'c': EMITFN(':'); break;
case 'd': EMITFN('.'); break;
- case 'u': EMITFN('_'); break;
case 'h': EMITFN('-'); break;
+ case 'p': EMITFN('+'); break;
case 's': EMITFN(' '); break;
+ case 'u': EMITFN('_'); break;
+ case 'A': EMITFN('@'); break;
+ case 'D': EMITFN('$'); break;
+ case 'L': EMITFN('('); break;
+ case 'R': EMITFN(')'); break;
case 'Z': EMITFN('Z'); break;
- case 'A': EMITFN('@'); break;
- case 'L': EMITSO('('); break;
- case 'R': EMITSO(')'); break;
default: error = True; goto out;
}
i++;
Modified: trunk/include/pub_tool_redir.h
===================================================================
--- trunk/include/pub_tool_redir.h 2009-07-26 19:28:07 UTC (rev 10619)
+++ trunk/include/pub_tool_redir.h 2009-07-26 19:41:07 UTC (rev 10620)
@@ -130,16 +130,17 @@
characters are transformed.
* --> Za (asterisk)
- + --> Zp (plus)
: --> Zc (colon)
. --> Zd (dot)
- _ --> Zu (underscore)
- --> Zh (hyphen)
+ + --> Zp (plus)
(space) --> Zs (space)
+ _ --> Zu (underscore)
@ --> ZA (at)
- Z --> ZZ (Z)
+ $ --> ZD (dollar)
( --> ZL (left)
) --> ZR (right)
+ Z --> ZZ (Z)
Everything else is left unchanged.
*/
|
|
From: <sv...@va...> - 2009-07-26 19:28:23
|
Author: sewardj Date: 2009-07-26 20:28:07 +0100 (Sun, 26 Jul 2009) New Revision: 10619 Log: Updated expected outputs following r10589 (msm idempotency effects) Modified: trunk/helgrind/tests/hg03_inherit.stderr.exp Modified: trunk/helgrind/tests/hg03_inherit.stderr.exp =================================================================== --- trunk/helgrind/tests/hg03_inherit.stderr.exp 2009-07-26 16:21:00 UTC (rev 10618) +++ trunk/helgrind/tests/hg03_inherit.stderr.exp 2009-07-26 19:28:07 UTC (rev 10619) @@ -15,13 +15,4 @@ Location 0x........ is 0 bytes inside shared[1], declared at hg03_inherit.c:11, in frame #x of thread x -Possible data race during write of size 4 at 0x........ by thread #x - at 0x........: t2 (hg03_inherit.c:29) - by 0x........: mythread_wrapper (hg_intercepts.c:...) - ... - This conflicts with a previous read of size 4 by thread #x - at 0x........: main (hg03_inherit.c:60) - Location 0x........ is 0 bytes inside shared[1], - declared at hg03_inherit.c:11, in frame #x of thread x - -ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) +ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) |
|
From: <sv...@va...> - 2009-07-26 16:21:17
|
Author: bart
Date: 2009-07-26 17:21:00 +0100 (Sun, 26 Jul 2009)
New Revision: 10618
Log:
Fixed typo.
Modified:
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2009-07-26 15:58:25 UTC (rev 10617)
+++ trunk/drd/drd_pthread_intercepts.c 2009-07-26 16:21:00 UTC (rev 10618)
@@ -465,9 +465,9 @@
* Necessary for Darwin. This is not necessary for Linux but doesn't have
* any known adverse effects.
*/
- DRD_IGNORE_VAR(once_control);
+ DRD_IGNORE_VAR(*once_control);
CALL_FN_W_WW(ret, fn, once_control, init_routine);
- DRD_STOP_IGNORING_VAR(once_control);
+ DRD_STOP_IGNORING_VAR(*once_control);
return ret;
}
|
|
From: <sv...@va...> - 2009-07-26 15:58:38
|
Author: bart
Date: 2009-07-26 16:58:25 +0100 (Sun, 26 Jul 2009)
New Revision: 10617
Log:
Updated manual because of the new client request DRD_STOP_IGNORING_VAR().
Modified:
trunk/drd/docs/drd-manual.xml
Modified: trunk/drd/docs/drd-manual.xml
===================================================================
--- trunk/drd/docs/drd-manual.xml 2009-07-26 15:55:48 UTC (rev 10616)
+++ trunk/drd/docs/drd-manual.xml 2009-07-26 15:58:25 UTC (rev 10617)
@@ -892,11 +892,12 @@
</listitem>
<listitem>
<para>
- The client
- request <varname>VG_USERREQ__DRD_FINISH_SUPPRESSION</varname>. Tell DRD
+ The macro <literal>DRD_STOP_IGNORING_VAR(x)</literal> and the
+ corresponding client request
+ <varname>VG_USERREQ__DRD_FINISH_SUPPRESSION</varname>. Tell DRD
to no longer ignore data races for the address range that was suppressed
- via the client request
- <varname>VG_USERREQ__DRD_START_SUPPRESSION</varname>.
+ either via the macro <literal>DRD_IGNORE_VAR(x)</literal> or via the
+ client request <varname>VG_USERREQ__DRD_START_SUPPRESSION</varname>.
</para>
</listitem>
<listitem>
|
|
From: <sv...@va...> - 2009-07-26 15:56:02
|
Author: bart
Date: 2009-07-26 16:55:48 +0100 (Sun, 26 Jul 2009)
New Revision: 10616
Log:
Suppress data race reports for the data race triggered by Darwin's pthread_once() implementation such that the pth_once test also passes on Darwin.
Modified:
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2009-07-26 15:46:47 UTC (rev 10615)
+++ trunk/drd/drd_pthread_intercepts.c 2009-07-26 15:55:48 UTC (rev 10616)
@@ -453,6 +453,24 @@
return ret;
}
+// pthread_once
+PTH_FUNC(int, pthreadZuonceZa, // pthread_once*
+ pthread_once_t *once_control, void (*init_routine)(void))
+{
+ int ret;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ /*
+ * Ignore any data races triggered by the implementation of pthread_once().
+ * Necessary for Darwin. This is not necessary for Linux but doesn't have
+ * any known adverse effects.
+ */
+ DRD_IGNORE_VAR(once_control);
+ CALL_FN_W_WW(ret, fn, once_control, init_routine);
+ DRD_STOP_IGNORING_VAR(once_control);
+ return ret;
+}
+
// pthread_mutex_init
PTH_FUNC(int, pthreadZumutexZuinit,
pthread_mutex_t *mutex,
|
|
From: <sv...@va...> - 2009-07-26 15:47:01
|
Author: bart
Date: 2009-07-26 16:46:47 +0100 (Sun, 26 Jul 2009)
New Revision: 10615
Log:
Added the macro DRD_STOP_IGNORING_VAR().
Modified:
trunk/drd/drd.h
Modified: trunk/drd/drd.h
===================================================================
--- trunk/drd/drd.h 2009-07-26 15:43:39 UTC (rev 10614)
+++ trunk/drd/drd.h 2009-07-26 15:46:47 UTC (rev 10615)
@@ -78,6 +78,9 @@
/** Tell DRD not to complain about data races for the specified variable. */
#define DRD_IGNORE_VAR(x) DRDCL_(ignore_range)(&(x), sizeof(x))
+/** Tell DRD to no longer ignore data races for the specified variable. */
+#define DRD_STOP_IGNORING_VAR(x) DRDCL_(ignore_range)(&(x), sizeof(x))
+
/**
* Tell DRD to trace all memory accesses on the specified variable.
* until the memory that was allocated for the variable is freed.
@@ -372,6 +375,14 @@
}
static __inline__
+void DRDCL_(stop_ignoring_range)(const void* const addr, const int size)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_FINISH_SUPPRESSION,
+ addr, size, 0, 0, 0);
+}
+
+static __inline__
void DRDCL_(trace_range)(const void* const addr, const int size)
{
int res;
|
|
From: <sv...@va...> - 2009-07-26 15:43:52
|
Author: bart
Date: 2009-07-26 16:43:39 +0100 (Sun, 26 Jul 2009)
New Revision: 10614
Log:
Remove the temporary file created during the test before exiting.
Modified:
trunk/memcheck/tests/darwin/aio.c
Modified: trunk/memcheck/tests/darwin/aio.c
===================================================================
--- trunk/memcheck/tests/darwin/aio.c 2009-07-26 15:39:57 UTC (rev 10613)
+++ trunk/memcheck/tests/darwin/aio.c 2009-07-26 15:43:39 UTC (rev 10614)
@@ -3,7 +3,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
-
+#include <unistd.h>
int x;
int main(void)
@@ -82,6 +82,8 @@
assert( aio_return(&a) < 0 ); // (repeated aio_return(); fails because
// Valgrind can't find &a in the table)
+ unlink("mytmpfile");
+
return x;
};
|
|
From: <sv...@va...> - 2009-07-26 15:40:11
|
Author: bart Date: 2009-07-26 16:39:57 +0100 (Sun, 26 Jul 2009) New Revision: 10613 Log: Should have been included in the previous commit (r10612). Modified: trunk/drd/tests/Makefile.am Modified: trunk/drd/tests/Makefile.am =================================================================== --- trunk/drd/tests/Makefile.am 2009-07-26 15:27:27 UTC (rev 10612) +++ trunk/drd/tests/Makefile.am 2009-07-26 15:39:57 UTC (rev 10613) @@ -250,7 +250,6 @@ pth_detached_sem \ pth_inconsistent_cond_wait \ pth_mutex_reinit \ - pth_once \ pth_process_shared_mutex \ recursive_mutex \ rwlock_race \ |
|
From: <sv...@va...> - 2009-07-26 15:27:38
|
Author: bart Date: 2009-07-26 16:27:27 +0100 (Sun, 26 Jul 2009) New Revision: 10612 Log: Added regression test for pth_once(). Added: trunk/drd/tests/pth_once.stderr.exp trunk/drd/tests/pth_once.vgtest Modified: trunk/drd/tests/Makefile.am Modified: trunk/drd/tests/Makefile.am =================================================================== --- trunk/drd/tests/Makefile.am 2009-07-26 13:52:35 UTC (rev 10611) +++ trunk/drd/tests/Makefile.am 2009-07-26 15:27:27 UTC (rev 10612) @@ -124,6 +124,8 @@ pth_inconsistent_cond_wait.vgtest \ pth_mutex_reinit.stderr.exp \ pth_mutex_reinit.vgtest \ + pth_once.stderr.exp \ + pth_once.vgtest \ pth_process_shared_mutex.stderr.exp \ pth_process_shared_mutex.vgtest \ pth_spinlock.stderr.exp \ @@ -248,6 +250,7 @@ pth_detached_sem \ pth_inconsistent_cond_wait \ pth_mutex_reinit \ + pth_once \ pth_process_shared_mutex \ recursive_mutex \ rwlock_race \ Added: trunk/drd/tests/pth_once.stderr.exp =================================================================== --- trunk/drd/tests/pth_once.stderr.exp (rev 0) +++ trunk/drd/tests/pth_once.stderr.exp 2009-07-26 15:27:27 UTC (rev 10612) @@ -0,0 +1 @@ +ERROR SUMMARY: 0 errors from 0 contexts Added: trunk/drd/tests/pth_once.vgtest =================================================================== --- trunk/drd/tests/pth_once.vgtest (rev 0) +++ trunk/drd/tests/pth_once.vgtest 2009-07-26 15:27:27 UTC (rev 10612) @@ -0,0 +1,5 @@ +prereq: test -e tsan_unittest && ./supported_libpthread +vgopts: --read-var-info=yes --check-stack-var=yes +prog: tsan_unittest +args: 106 +stderr_filter: filter_error_summary |
|
From: Bart V. A. <bar...@gm...> - 2009-07-26 13:54:22
|
On Sat, Jul 25, 2009 at 1:59 PM, Bart Van Assche<bar...@gm...> wrote: > Since r10599 all DRD regression tests pass -- the regression test > rwlock_test does no longer fail. Thanks for the help. I will now test > DRD with larger applications. Another question: are classes like NSThread, NSLock, NSCondition and NSConditionLock entirely implemented using the POSIX threads API ? I'm asking this because DRD reports much more data races than I expected for Mac OS X GUI applications. As an example, many data races are reported for both Terminal and Safari on functions called from inside CFRunLoop* functions, while the documentation of the NSRunLoop class specifies that the implementation of NSRunLoop is not thread-safe (http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSRunLoop_Class/Reference/Reference.html). Bart. |
|
From: <sv...@va...> - 2009-07-26 13:52:57
|
Author: bart
Date: 2009-07-26 14:52:35 +0100 (Sun, 26 Jul 2009)
New Revision: 10611
Log:
- Changed the names of several existing suppression patterns.
- Replaced the three suppression patterns for objc_msgSend by one.
- Added more suppression patterns, a.o. for the string manipulation
and text encoding functions in WebCore.
Modified:
trunk/darwin9-drd.supp
Modified: trunk/darwin9-drd.supp
===================================================================
--- trunk/darwin9-drd.supp 2009-07-26 09:16:56 UTC (rev 10610)
+++ trunk/darwin9-drd.supp 2009-07-26 13:52:35 UTC (rev 10611)
@@ -3,7 +3,7 @@
#
{
- drd-darwin-dyld-1
+ drd-darwin-dyld-register-func-for-add-image
drd:MutexErr
fun:pthread_mutex_unlock
fun:_dyld_register_func_for_add_image
@@ -11,7 +11,7 @@
fun:libSystem_initializer
}
{
- drd-darwin-dyld-2
+ drd-darwin-dyld-register-func-for-remove-image
drd:MutexErr
fun:pthread_mutex_unlock
fun:_dyld_register_func_for_remove_image
@@ -19,32 +19,40 @@
fun:libSystem_initializer
}
{
- drd-darwin-dyld-3
+ drd-darwin-dyld-GlobalLockInitialize
drd:MutexErr
fun:pthread_mutex_init
fun:_Z24dyldGlobalLockInitializev
fun:_dyld_initializer
}
{
- drd-darwin-dyld-4
+ drd-darwin-dyld-bindLazySymbol
drd:ConflictingAccess
...
fun:_ZN4dyld14bindLazySymbolEPK11mach_headerPm
fun:stub_binding_helper_interface2
}
{
- drd-darwin-dyld-5
+ drd-darwin-dyld-addImage
drd:ConflictingAccess
+ fun:_ZN4dyld8addImageEP11ImageLoader
+}
+{
+ dyld-ImageLoader::link
+ drd:ConflictingAccess
...
- fun:_ZN16ImageLoaderMachO16resolveUndefinedERKN11ImageLoader11LinkContextEPK11macho_nlistbPPKS0_
+ fun:_ZN4dyld18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE
+ fun:_ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
+ fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
}
{
- drd-darwin-dyld-6
+ drd-darwin-dyld-ImageLoaderMachO::resolveUndefined
drd:ConflictingAccess
- fun:_ZN4dyld8addImageEP11ImageLoader
+ ...
+ fun:_ZN16ImageLoaderMachO16resolveUndefinedERKN11ImageLoader11LinkContextEPK11macho_nlistbPPKS0_
}
{
- drd-darwin-dyld-7
+ drd-darwin-dyld-ImageLoaderMachO::findExportedSymbol
drd:ConflictingAccess
fun:_ZNK16ImageLoaderMachO18findExportedSymbolEPKcPKvbPPK11ImageLoader
fun:_ZNK11ImageLoader41findExportedSymbolInDependentImagesExceptEPKcPPKS_RS4_S4_S4_
@@ -216,85 +224,237 @@
# Suppression patterns for libobjc.
#
+# It looks like the implementation of objc_msgSend uses another means than the
+# POSIX threads library for locking. More information about messaging and
+# objc_msgSend can be found here:
+# http://devworld.apple.com/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtHowMessagingWorks.html
+#
+
{
- drd-darwin-objc-1
+ drd-darwin-objc-msgSend
drd:ConflictingAccess
+ ...
fun:objc_msgSend
}
{
- drd-darwin-objc-2
+ drd-darwin-objc-msgSend
drd:ConflictingAccess
- fun:_cache_fill
- fun:log_and_fill_cache
- fun:_class_lookupMethodAndLoadCache
+ ...
+ fun:objc_sync_enter
}
-{
- drd-darwin-objc-3
- drd:ConflictingAccess
- fun:_cache_getMethod
- fun:objc_msgSend
-}
#
# Suppression patterns for CoreFoundation.framework.
#
+# Suppressions for NSObject methods. For more information about the NSObject
+# class, see also
+# http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html
{
- drd-darwin-corefoundation-framework-1
+ drd-darwin-NSObject-release
drd:ConflictingAccess
- fun:-[NSLock lock]
-}
-{
- drd-darwin-corefoundation-framework-2
- drd:ConflictingAccess
...
fun:-[NSObject release]
}
{
- drd-darwin-corefoundation-framework-3
+ drd-darwin-NSObject-autorelease-1
drd:ConflictingAccess
...
fun:-[NSObject(NSObject) autorelease]
}
{
- drd-darwin-corefoundation-framework-4
+ drd-darwin-NSObject-autorelease-2
drd:ConflictingAccess
+ fun:__NSAutoreleaseObject
+}
+{
+ drd-darwin-NSObject-NSDeallocateObject
+ drd:ConflictingAccess
+ fun:_internal_object_dispose
+ fun:NSDeallocateObject
+}
+{
+ drd-darwin-NSObject-retain
+ drd:ConflictingAccess
...
fun:-[NSObject retain]
}
{
- drd-darwin-corefoundation-framework-5
+ drd-darwin-NSObject-retainCount
drd:ConflictingAccess
...
+ fun:-[NSObject retainCount]
+}
+{
+ drd-darwin-NSObject-NSDelayedPerforming-1
+ drd:ConflictingAccess
+ ...
+ fun:+[NSObject(NSDelayedPerforming) cancelPreviousPerformRequestsWithTarget:selector:object:]
+}
+{
+ drd-darwin-NSObject-NSDelayedPerforming-2
+ drd:ConflictingAccess
+ ...
+ fun:-[NSObject(NSDelayedPerforming) performSelector:withObject:afterDelay:]
+}
+{
+ drd-darwin-NSObject-NSDelayedPerforming-3
+ drd:ConflictingAccess
+ ...
+ fun:-[NSObject(NSDelayedPerforming) performSelector:withObject:afterDelay:inModes:]
+}
+{
+ drd-darwin-NSObject-NSDelayedPerforming-4
+ drd:ConflictingAccess
+ ...
+ fun:-[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:]
+}
+{
+ drd-darwin-NSObject-NSDelayedPerforming-5
+ drd:ConflictingAccess
+ ...
+ fun:-[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:]
+}
+
+# Suppressions for methods of the NSThread class.
+{
+ drd-NSThread-nq
+ drd:ConflictingAccess
+ ...
+ fun:-[NSThread _nq:]
+}
+
+# Suppressions for methods of the NSLock class. See also
+# http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSLock_Class/Reference/Reference.html
+{
+ drd-darwin-NSLock-lock
+ drd:ConflictingAccess
+ fun:-[NSLock lock]
+}
+{
+ drd-darwin-NSLock-unlock
+ drd:ConflictingAccess
+ fun:-[NSLock unlock]
+}
+# Suppressions for NSCondition methods.
+{
+ drd-darwin-NSConditionLock-lock
+ drd:ConflictingAccess
+ fun:-[NSCondition lock]
+}
+# Suppressions for NSConditionLock methods.
+{
+ drd-darwin-NSConditionLock-lockWhenCondition:beforeDate:
+ drd:ConflictingAccess
+ fun:-[NSConditionLock lockWhenCondition:beforeDate:]
+}
+
+
+# NSExtraRefCount returns the specified object's reference count, and
+# NSDecrementExtraRefCountWasZero decrements the specified object's reference
+# count.
+# See also http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html
+{
+ drd-darwin-NSExtraRefCount
+ drd:ConflictingAccess
+ ...
fun:NSExtraRefCount
}
{
- drd-darwin-corefoundation-framework-6
+ drd-darwin-NSDecrementExtraRefCountWasZero
drd:ConflictingAccess
...
+ fun:NSDecrementExtraRefCountWasZero
+}
+# For more information about key-value observing, see also the NSKeyValueObserving Protocol Reference:
+# http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/Reference/Reference.html
+{
+ drd-darwin-NSKVONotify
+ drd:ConflictingAccess
+ ...
fun:NSKVONotify
}
{
- drd-darwin-corefoundation-framework-7
+ drd-darwin-NSKVONotifyingEnableForInfoAndKey
drd:ConflictingAccess
...
- fun:CFRunLoop*
+ fun:_NSKVONotifyingEnableForInfoAndKey
}
+# From the NSRunLoop class reference:
+# Warning: The NSRunLoop class is generally not considered to be thread-safe
+# and its methods should only be called within the context of the current
+# thread. You should never try to call the methods of an NSRunLoop object
+# running in a different thread, as doing so might cause unexpected results.
+# See also the NSRunLoop Class Reference:
+# http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSRunLoop_Class/Reference/Reference.html
+# {
+# drd-darwin-CFRunLoop*
+# drd:ConflictingAccess
+# ...
+# fun:CFRunLoop*
+# }
+# See also the CFBag reference:
+# http://developer.apple.com/documentation/CoreFoundation/Reference/CFBagRef/Reference/reference.html
+# {
+# drd-darwin-CFBag*
+# drd:ConflictingAccess
+# fun:CFBag*
+# }
+
+# Suppression patterns for the memory allocation functions in WTF.
{
- drd-darwin-corefoundation-framework-8
+ drd-WTF::fastCalloc
drd:ConflictingAccess
- fun:CFBag*
+ ...
+ fun:_ZN3WTF10fastCallocEmm
}
+{
+ drd-WTF::fastMalloc
+ drd:ConflictingAccess
+ ...
+ fun:_ZN3WTF10fastMallocEm
+}
+{
+ drd-WTF::fastFree
+ drd:ConflictingAccess
+ ...
+ fun:_ZN3WTF8fastFreeEPv
+}
+# Suppression patterns for the string manipulation functions in WebCore.
+{
+ drd-WebCore::StringImpl::init
+ drd:ConflictingAccess
+ ...
+ fun:_ZN7WebCore10StringImpl4initEPKcj
+}
+{
+ drd-WebCore::StringImpl::append
+ drd:ConflictingAccess
+ ...
+ fun:_ZN7WebCore10StringImpl6appendEPKtj
+}
+{
+ drd-WebCore::CString::init
+ drd:ConflictingAccess
+ ...
+ fun:_ZN7WebCore7CString4initEPKcj
+}
-#
-# Suppression patterns for AudioToolbox.framework.
-#
-
+# Suppression patterns for the text encoding functions in WebCore.
{
- drd-darwin-audiotoolbox-framework-1
+ drd-WebCore::WebCore::TextCodec::~TextCodec()
drd:ConflictingAccess
- obj:*
- fun:_Z26InitializeSystemSoundPortsv
+ fun:_ZN7WebCore9TextCodecD2Ev
}
+{
+ drd-WebCore::TextCodecICU::TextCodecICU
+ drd:ConflictingAccess
+ fun:_ZN7WebCore12TextCodecICUC2ERKNS_12TextEncodingE
+}
+{
+ drd-WebCore::TextCodecICU::~TextCodecICU
+ drd:ConflictingAccess
+ fun:_ZN7WebCore12TextCodecICUD0Ev
+}
|
|
From: <sv...@va...> - 2009-07-26 09:17:07
|
Author: bart Date: 2009-07-26 10:16:56 +0100 (Sun, 26 Jul 2009) New Revision: 10610 Log: Added regression test for %o (octal) format specifier. Added: trunk/drd/tests/sem_open_traced.stderr.exp trunk/drd/tests/sem_open_traced.vgtest Modified: trunk/drd/tests/Makefile.am Modified: trunk/drd/tests/Makefile.am =================================================================== --- trunk/drd/tests/Makefile.am 2009-07-26 09:16:29 UTC (rev 10609) +++ trunk/drd/tests/Makefile.am 2009-07-26 09:16:56 UTC (rev 10610) @@ -154,6 +154,8 @@ sem_open2.vgtest \ sem_open3.stderr.exp \ sem_open3.vgtest \ + sem_open_traced.stderr.exp \ + sem_open_traced.vgtest \ sigalrm.stderr.exp \ sigalrm.vgtest \ tc01_simple_race.stderr.exp \ Added: trunk/drd/tests/sem_open_traced.stderr.exp =================================================================== --- trunk/drd/tests/sem_open_traced.stderr.exp (rev 0) +++ trunk/drd/tests/sem_open_traced.stderr.exp 2009-07-26 09:16:56 UTC (rev 10610) @@ -0,0 +1,9 @@ + +[1] sem_open 0x........ name drd-sem-open-test oflag 0x........ mode 0600 value 1 +[2] sem_wait 0x........ value 1 -> 0 +[2] sem_post 0x........ value 0 -> 1 +[1] sem_wait 0x........ value 1 -> 0 +[1] sem_post 0x........ value 0 -> 1 +[1] sem_close 0x........ value 1 + +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Added: trunk/drd/tests/sem_open_traced.vgtest =================================================================== --- trunk/drd/tests/sem_open_traced.vgtest (rev 0) +++ trunk/drd/tests/sem_open_traced.vgtest 2009-07-26 09:16:56 UTC (rev 10610) @@ -0,0 +1,4 @@ +prereq: ./supported_libpthread +vgopts: --check-stack-var=yes --read-var-info=yes --trace-semaphore=yes +prog: sem_open +args: -m |
|
From: <sv...@va...> - 2009-07-26 09:16:46
|
Author: bart
Date: 2009-07-26 10:16:29 +0100 (Sun, 26 Jul 2009)
New Revision: 10609
Log:
Made the semaphore name independent of the process ID.
Modified:
trunk/drd/tests/sem_open.c
Modified: trunk/drd/tests/sem_open.c
===================================================================
--- trunk/drd/tests/sem_open.c 2009-07-26 09:15:55 UTC (rev 10608)
+++ trunk/drd/tests/sem_open.c 2009-07-26 09:16:29 UTC (rev 10609)
@@ -58,7 +58,7 @@
* Use the ipcs and ipcrm commands to clean up named semaphores left by
* aborted instances of this process.
*/
- snprintf(semaphore_name, sizeof(semaphore_name), "sem_open-%d", getpid());
+ snprintf(semaphore_name, sizeof(semaphore_name), "drd-sem-open-test");
s_sem = sem_open(semaphore_name, O_CREAT, 0600, 1);
if (s_sem == SEM_FAILED)
{
|
|
From: <sv...@va...> - 2009-07-26 09:16:06
|
Author: bart
Date: 2009-07-26 10:15:55 +0100 (Sun, 26 Jul 2009)
New Revision: 10608
Log:
Trace the oflag parameter of sem_open() in hexadecimal format instead of decimal.
Modified:
trunk/drd/drd_semaphore.c
Modified: trunk/drd/drd_semaphore.c
===================================================================
--- trunk/drd/drd_semaphore.c 2009-07-26 09:04:42 UTC (rev 10607)
+++ trunk/drd/drd_semaphore.c 2009-07-26 09:15:55 UTC (rev 10608)
@@ -261,7 +261,7 @@
{
VG_(message)(Vg_UserMsg,
"[%d] sem_open 0x%lx name %s"
- " oflag %ld mode %#lo value %u\n",
+ " oflag %#lx mode %#lo value %u\n",
DRD_(thread_get_running_tid)(),
semaphore, name, oflag, mode, value);
}
|
|
From: <sv...@va...> - 2009-07-26 09:04:57
|
Author: bart
Date: 2009-07-26 10:04:42 +0100 (Sun, 26 Jul 2009)
New Revision: 10607
Log:
Updated drd/tests/omp_printf:
- Added command-line options -i and -t to the omp_printf test program.
- Modified the OpenMP directive such that this test program no longer
triggers a data race on the loop variable 'i'.
- Increased number of iterations and number of threads used during the
test.
- Changed error filtering from filter_error_summary to filter_stderr.
Modified:
trunk/drd/tests/omp_printf.c
trunk/drd/tests/omp_printf.stderr.exp
trunk/drd/tests/omp_printf.vgtest
Modified: trunk/drd/tests/omp_printf.c
===================================================================
--- trunk/drd/tests/omp_printf.c 2009-07-26 08:48:49 UTC (rev 10606)
+++ trunk/drd/tests/omp_printf.c 2009-07-26 09:04:42 UTC (rev 10607)
@@ -1,15 +1,20 @@
/* Simple OpenMP test program that calls printf() from a parallel section. */
+#include <assert.h> // assert()
#include <omp.h>
#include <stdio.h>
+#include <stdlib.h> // atoi()
#include <unistd.h> // getopt()
static void usage(const char* const exe)
{
- printf("Usage: %s [-h] [-q] [-r] [-t<n>] <m>\n"
- "-h: display this information.\n"
- "-q: quiet mode -- do not print computed error.\n",
- exe);
+ fprintf(stderr,
+ "Usage: %s [-h] [-i <n>] [-q] [-t<n>]\n"
+ "-h: display this information.\n"
+ "-i <n>: number of loop iterations.\n"
+ "-q: quiet mode -- do not print computed error.\n"
+ "-t <n>: number of OMP threads.\n",
+ exe);
}
int main(int argc, char** argv)
@@ -18,29 +23,45 @@
int optchar;
int silent = 0;
int tid;
+ int num_iterations = 2;
+ int num_threads = 2;
- while ((optchar = getopt(argc, argv, "hq")) != EOF)
+ while ((optchar = getopt(argc, argv, "hi:qt:")) != EOF)
{
switch (optchar)
{
case 'h': usage(argv[0]); return 1;
+ case 'i': num_iterations = atoi(optarg); break;
case 'q': silent = 1; break;
+ case 't': num_threads = atoi(optarg); break;
default:
return 1;
}
}
-#pragma omp parallel private(tid)
- for (i = 0; i < 2; i++)
+ /*
+ * Not the most user-friendly way of error checking, but still better than
+ * no error checking.
+ */
+ assert(num_iterations > 0);
+ assert(num_threads > 0);
+
+ omp_set_num_threads(num_threads);
+ omp_set_dynamic(0);
+
+#pragma omp parallel for private(tid)
+ for (i = 0; i < num_iterations; i++)
{
tid = omp_get_thread_num();
if (! silent)
{
- printf("omp_get_thread_num() = %d/%d\n", tid, omp_get_num_threads());
+ fprintf(stderr,
+ "iteration %d; thread number = %d; number of threads = %d\n",
+ i, tid, omp_get_num_threads());
}
else
{
- printf("%s", "");
+ fprintf(stderr, "%s", "");
}
}
Modified: trunk/drd/tests/omp_printf.stderr.exp
===================================================================
--- trunk/drd/tests/omp_printf.stderr.exp 2009-07-26 08:48:49 UTC (rev 10606)
+++ trunk/drd/tests/omp_printf.stderr.exp 2009-07-26 09:04:42 UTC (rev 10607)
@@ -1 +1,4 @@
-ERROR SUMMARY: 8 errors from 8 contexts
+
+Finished.
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Modified: trunk/drd/tests/omp_printf.vgtest
===================================================================
--- trunk/drd/tests/omp_printf.vgtest 2009-07-26 08:48:49 UTC (rev 10606)
+++ trunk/drd/tests/omp_printf.vgtest 2009-07-26 09:04:42 UTC (rev 10607)
@@ -1,5 +1,4 @@
prereq: ./run_openmp_test ./omp_printf
prog: omp_printf
vgopts: --check-stack-var=yes --read-var-info=yes
-args: -q
-stderr_filter: filter_error_summary
+args: -i 100 -q -t 10
|