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
(4) |
2
(17) |
3
(9) |
4
(14) |
5
(10) |
6
(11) |
7
(8) |
|
8
(9) |
9
(11) |
10
(29) |
11
(27) |
12
(29) |
13
(36) |
14
(8) |
|
15
(18) |
16
(30) |
17
(25) |
18
(6) |
19
(16) |
20
(13) |
21
(10) |
|
22
(16) |
23
(7) |
24
(8) |
25
(13) |
26
(14) |
27
(14) |
28
(5) |
|
29
(6) |
30
(21) |
31
(14) |
|
|
|
|
|
From: <sv...@va...> - 2009-03-12 21:12:12
|
Author: njn
Date: 2009-03-12 21:12:01 +0000 (Thu, 12 Mar 2009)
New Revision: 9388
Log:
Merge r9382..r9387 (DRD tweaks) from the trunk.
Modified:
branches/DARWIN/drd/drd_clientreq.h
branches/DARWIN/drd/drd_pthread_intercepts.c
branches/DARWIN/drd/drd_segment.c
branches/DARWIN/drd/drd_segment.h
branches/DARWIN/drd/drd_thread.c
branches/DARWIN/drd/drd_vc.h
branches/DARWIN/drd/tests/sem_as_mutex.c
Modified: branches/DARWIN/drd/drd_clientreq.h
===================================================================
--- branches/DARWIN/drd/drd_clientreq.h 2009-03-12 18:39:31 UTC (rev 9387)
+++ branches/DARWIN/drd/drd_clientreq.h 2009-03-12 21:12:01 UTC (rev 9388)
@@ -58,10 +58,10 @@
VG_USERREQ__DRD_START_RECORDING,
/* args: none. */
- /* Tell the core the pthread_t of the running thread */
+ /* Tell drd the pthread_t of the running thread. */
VG_USERREQ__SET_PTHREADID,
/* args: pthread_t. */
- /* Ask the core that a the thread's state transition from */
+ /* Ask drd that a the thread's state transition from */
/* VgTs_Zombie to VgTs_Empty is delayed until */
/* VG_USERREQ__POST_THREAD_JOIN is performed. */
VG_USERREQ__SET_JOINABLE,
Modified: branches/DARWIN/drd/drd_pthread_intercepts.c
===================================================================
--- branches/DARWIN/drd/drd_pthread_intercepts.c 2009-03-12 18:39:31 UTC (rev 9387)
+++ branches/DARWIN/drd/drd_pthread_intercepts.c 2009-03-12 21:12:01 UTC (rev 9388)
@@ -61,6 +61,22 @@
/* Defines. */
+/*
+ * Do not undefine the two macro's below, or the following two subtle race
+ * conditions will be introduced in the data race detection algorithm:
+ * - sg_init() runs on the context of the created thread and copies the
+ * vector clock of the creator thread. This only works reliably if
+ * the creator thread waits until this copy has been performed.
+ * - Since DRD_(thread_compute_minimum_vc)() does not take the vector
+ * clocks into account that are involved in thread creation but
+ * for which the corresponding thread has not yet been created, by
+ * undefining the macro below it becomes possible that segments get
+ * discarded that should not yet be discarded. Or: some data races
+ * are not detected.
+ */
+#define WAIT_UNTIL_CREATED_THREAD_STARTED
+#define ALLOCATE_THREAD_ARGS_ON_THE_STACK
+
#define PTH_FUNC(ret_ty, f, args...) \
ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
@@ -73,7 +89,9 @@
void* (*start)(void*);
void* arg;
int detachstate;
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
int wrapper_started;
+#endif
} DrdPosixThreadArgs;
@@ -182,7 +200,15 @@
arg_ptr = (DrdPosixThreadArgs*)arg;
arg_copy = *arg_ptr;
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
arg_ptr->wrapper_started = 1;
+#else
+#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
+#error Defining ALLOCATE_THREAD_ARGS_ON_THE_STACK but not WAIT_UNTIL_CREATED_THREAD_STARTED is not supported.
+#else
+ free(arg_ptr);
+#endif
+#endif
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREADID,
pthread_self(), 0, 0, 0, 0);
@@ -274,39 +300,52 @@
int res;
int ret;
OrigFn fn;
+#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
DrdPosixThreadArgs thread_args;
+#endif
+ DrdPosixThreadArgs* thread_args_p;
VALGRIND_GET_ORIG_FN(fn);
- DRD_IGNORE_VAR(thread_args.wrapper_started);
- thread_args.start = start;
- thread_args.arg = arg;
- thread_args.wrapper_started = 0;
+#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
+ thread_args_p = &thread_args;
+#else
+ thread_args_p = malloc(sizeof(*thread_args_p));
+#endif
+ assert(thread_args_p);
+
+ thread_args_p->start = start;
+ thread_args_p->arg = arg;
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
+ DRD_IGNORE_VAR(thread_args_p->wrapper_started);
+ thread_args_p->wrapper_started = 0;
+#endif
/*
* Find out whether the thread will be started as a joinable thread
* or as a detached thread. If no thread attributes have been specified,
* this means that the new thread will be started as a joinable thread.
*/
- thread_args.detachstate = PTHREAD_CREATE_JOINABLE;
+ thread_args_p->detachstate = PTHREAD_CREATE_JOINABLE;
if (attr)
{
- if (pthread_attr_getdetachstate(attr, &thread_args.detachstate) != 0)
+ if (pthread_attr_getdetachstate(attr, &thread_args_p->detachstate) != 0)
{
assert(0);
}
}
- assert(thread_args.detachstate == PTHREAD_CREATE_JOINABLE
- || thread_args.detachstate == PTHREAD_CREATE_DETACHED);
+ assert(thread_args_p->detachstate == PTHREAD_CREATE_JOINABLE
+ || thread_args_p->detachstate == PTHREAD_CREATE_DETACHED);
/* Suppress NPTL-specific conflicts between creator and created thread. */
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_STOP_RECORDING,
0, 0, 0, 0, 0);
- CALL_FN_W_WWWW(ret, fn, thread, attr, DRD_(thread_wrapper), &thread_args);
+ CALL_FN_W_WWWW(ret, fn, thread, attr, DRD_(thread_wrapper), thread_args_p);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_START_RECORDING,
0, 0, 0, 0, 0);
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
if (ret == 0)
{
/*
@@ -315,12 +354,21 @@
* passed via dynamically allocated memory and if the loop below is
* removed.
*/
- while (! thread_args.wrapper_started)
+ while (! thread_args_p->wrapper_started)
{
sched_yield();
}
}
+#if defined(ALLOCATE_THREAD_ARGS_DYNAMICALLY)
+ free(thread_args_p);
+#endif
+
+#endif
+
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_START_NEW_SEGMENT,
+ pthread_self(), 0, 0, 0, 0);
+
return ret;
}
Modified: branches/DARWIN/drd/drd_segment.c
===================================================================
--- branches/DARWIN/drd/drd_segment.c 2009-03-12 18:39:31 UTC (rev 9387)
+++ branches/DARWIN/drd/drd_segment.c 2009-03-12 21:12:01 UTC (rev 9388)
@@ -37,22 +37,26 @@
/* Local variables. */
-static ULong DRD_(s_segments_created_count);
-static ULong DRD_(s_segments_alive_count);
-static ULong DRD_(s_max_segments_alive_count);
-static Bool DRD_(s_trace_segment) = False;
+static ULong s_segments_created_count;
+static ULong s_segments_alive_count;
+static ULong s_max_segments_alive_count;
+static Bool s_trace_segment;
/* Function definitions. */
/**
* Initialize the memory 'sg' points at.
- * @note The creator and created thread ID's may be equal.
+ *
+ * @note The creator and created thread ID's may be equal.
+ * @note This function copies the vector clock of thread 'creator', a technique
+ * also known as clock snooping. This will only work reliably if the thread
+ * that called pthread_create() waits until the created thread has copied
+ * the vector clock.
*/
-static
-void DRD_(sg_init)(Segment* const sg,
- DrdThreadId const creator,
- DrdThreadId const created)
+static void sg_init(Segment* const sg,
+ const DrdThreadId creator,
+ const DrdThreadId created)
{
Segment* creator_sg;
ThreadId vg_created = DRD_(DrdThreadIdToVgThreadId)(created);
@@ -80,7 +84,7 @@
DRD_(vc_increment)(&sg->vc, created);
sg->bm = DRD_(bm_new)();
- if (DRD_(s_trace_segment))
+ if (s_trace_segment)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -107,18 +111,18 @@
}
/** Allocate and initialize a new segment. */
-Segment* DRD_(sg_new)(ThreadId const creator, ThreadId const created)
+Segment* DRD_(sg_new)(const DrdThreadId creator, const DrdThreadId created)
{
Segment* sg;
- DRD_(s_segments_created_count)++;
- DRD_(s_segments_alive_count)++;
- if (DRD_(s_max_segments_alive_count) < DRD_(s_segments_alive_count))
- DRD_(s_max_segments_alive_count) = DRD_(s_segments_alive_count);
+ s_segments_created_count++;
+ s_segments_alive_count++;
+ if (s_max_segments_alive_count < s_segments_alive_count)
+ s_max_segments_alive_count = s_segments_alive_count;
sg = VG_(malloc)("drd.segment.sn.1", sizeof(*sg));
tl_assert(sg);
- DRD_(sg_init)(sg, creator, created);
+ sg_init(sg, creator, created);
return sg;
}
@@ -136,7 +140,7 @@
}
#endif
- DRD_(s_segments_alive_count)--;
+ s_segments_alive_count--;
tl_assert(sg);
DRD_(sg_cleanup)(sg);
@@ -169,7 +173,7 @@
if (sg == 0)
return;
- if (DRD_(s_trace_segment))
+ if (s_trace_segment)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -196,7 +200,7 @@
tl_assert(sg2);
tl_assert(sg2->refcnt == 1);
- if (DRD_(s_trace_segment))
+ if (s_trace_segment)
{
char msg[256];
@@ -229,27 +233,27 @@
/** Query whether segment tracing has been enabled. */
Bool DRD_(sg_get_trace)(void)
{
- return DRD_(s_trace_segment);
+ return s_trace_segment;
}
/** Enable or disable segment tracing. */
void DRD_(sg_set_trace)(Bool const trace_segment)
{
tl_assert(trace_segment == False || trace_segment == True);
- DRD_(s_trace_segment) = trace_segment;
+ s_trace_segment = trace_segment;
}
ULong DRD_(sg_get_segments_created_count)(void)
{
- return DRD_(s_segments_created_count);
+ return s_segments_created_count;
}
ULong DRD_(sg_get_segments_alive_count)(void)
{
- return DRD_(s_segments_alive_count);
+ return s_segments_alive_count;
}
ULong DRD_(sg_get_max_segments_alive_count)(void)
{
- return DRD_(s_max_segments_alive_count);
+ return s_max_segments_alive_count;
}
Modified: branches/DARWIN/drd/drd_segment.h
===================================================================
--- branches/DARWIN/drd/drd_segment.h 2009-03-12 18:39:31 UTC (rev 9387)
+++ branches/DARWIN/drd/drd_segment.h 2009-03-12 21:12:01 UTC (rev 9388)
@@ -58,7 +58,7 @@
} Segment;
-Segment* DRD_(sg_new)(const ThreadId creator, const ThreadId created);
+Segment* DRD_(sg_new)(const DrdThreadId creator, const DrdThreadId created);
int DRD_(sg_get_refcnt)(const Segment* const sg);
Segment* DRD_(sg_get)(Segment* const sg);
void DRD_(sg_put)(Segment* const sg);
Modified: branches/DARWIN/drd/drd_thread.c
===================================================================
--- branches/DARWIN/drd/drd_thread.c 2009-03-12 18:39:31 UTC (rev 9387)
+++ branches/DARWIN/drd/drd_thread.c 2009-03-12 21:12:01 UTC (rev 9388)
@@ -419,14 +419,18 @@
if (DRD_(g_threadinfo)[tid].detached_posix_thread)
{
- /* Once a detached thread has finished, its stack is deallocated and */
- /* should no longer be taken into account when computing the conflict set*/
+ /*
+ * Once a detached thread has finished, its stack is deallocated and
+ * should no longer be taken into account when computing the conflict set.
+ */
DRD_(g_threadinfo)[tid].stack_min = DRD_(g_threadinfo)[tid].stack_max;
- /* For a detached thread, calling pthread_exit() invalidates the */
- /* POSIX thread ID associated with the detached thread. For joinable */
- /* POSIX threads however, the POSIX thread ID remains live after the */
- /* pthread_exit() call until pthread_join() is called. */
+ /*
+ * For a detached thread, calling pthread_exit() invalidates the
+ * POSIX thread ID associated with the detached thread. For joinable
+ * POSIX threads however, the POSIX thread ID remains live after the
+ * pthread_exit() call until pthread_join() is called.
+ */
DRD_(g_threadinfo)[tid].posix_thread_exists = False;
}
}
@@ -1065,7 +1069,8 @@
VG_(message)(Vg_UserMsg, "%s", msg);
}
- for (j = 0; j < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); j++)
+ for (j = 0; j < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]);
+ j++)
{
if (j != tid && DRD_(IsValidDrdThreadId)(j))
{
Modified: branches/DARWIN/drd/drd_vc.h
===================================================================
--- branches/DARWIN/drd/drd_vc.h 2009-03-12 18:39:31 UTC (rev 9387)
+++ branches/DARWIN/drd/drd_vc.h 2009-03-12 21:12:01 UTC (rev 9388)
@@ -70,7 +70,6 @@
void DRD_(vc_cleanup)(VectorClock* const vc);
void DRD_(vc_copy)(VectorClock* const new, const VectorClock* const rhs);
void DRD_(vc_assign)(VectorClock* const lhs, const VectorClock* const rhs);
-UInt DRD_(vc_get)(VectorClock* const vc, const DrdThreadId tid);
void DRD_(vc_increment)(VectorClock* const vc, DrdThreadId const tid);
static __inline__
Bool DRD_(vc_lte)(const VectorClock* const vc1,
Modified: branches/DARWIN/drd/tests/sem_as_mutex.c
===================================================================
--- branches/DARWIN/drd/tests/sem_as_mutex.c 2009-03-12 18:39:31 UTC (rev 9387)
+++ branches/DARWIN/drd/tests/sem_as_mutex.c 2009-03-12 21:12:01 UTC (rev 9388)
@@ -71,6 +71,8 @@
pthread_create(&threadid, 0, thread_func, 0);
+ sleep(1); /* Wait until thread_func() finished. */
+
{
if (s_do_mutual_exclusion) sem_wait(&s_sem);
s_d3++;
|
|
From: <sv...@va...> - 2009-03-12 18:39:45
|
Author: bart
Date: 2009-03-12 18:39:31 +0000 (Thu, 12 Mar 2009)
New Revision: 9387
Log:
Added comment block that explains why the creator thread waits until the creator thread has copied the vector clock of the creator thread.
Modified:
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2009-03-12 18:38:26 UTC (rev 9386)
+++ trunk/drd/drd_pthread_intercepts.c 2009-03-12 18:39:31 UTC (rev 9387)
@@ -61,6 +61,22 @@
/* Defines. */
+/*
+ * Do not undefine the two macro's below, or the following two subtle race
+ * conditions will be introduced in the data race detection algorithm:
+ * - sg_init() runs on the context of the created thread and copies the
+ * vector clock of the creator thread. This only works reliably if
+ * the creator thread waits until this copy has been performed.
+ * - Since DRD_(thread_compute_minimum_vc)() does not take the vector
+ * clocks into account that are involved in thread creation but
+ * for which the corresponding thread has not yet been created, by
+ * undefining the macro below it becomes possible that segments get
+ * discarded that should not yet be discarded. Or: some data races
+ * are not detected.
+ */
+#define WAIT_UNTIL_CREATED_THREAD_STARTED
+#define ALLOCATE_THREAD_ARGS_ON_THE_STACK
+
#define PTH_FUNC(ret_ty, f, args...) \
ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
@@ -73,7 +89,9 @@
void* (*start)(void*);
void* arg;
int detachstate;
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
int wrapper_started;
+#endif
} DrdPosixThreadArgs;
@@ -182,7 +200,15 @@
arg_ptr = (DrdPosixThreadArgs*)arg;
arg_copy = *arg_ptr;
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
arg_ptr->wrapper_started = 1;
+#else
+#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
+#error Defining ALLOCATE_THREAD_ARGS_ON_THE_STACK but not WAIT_UNTIL_CREATED_THREAD_STARTED is not supported.
+#else
+ free(arg_ptr);
+#endif
+#endif
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREADID,
pthread_self(), 0, 0, 0, 0);
@@ -274,39 +300,52 @@
int res;
int ret;
OrigFn fn;
+#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
DrdPosixThreadArgs thread_args;
+#endif
+ DrdPosixThreadArgs* thread_args_p;
VALGRIND_GET_ORIG_FN(fn);
- DRD_IGNORE_VAR(thread_args.wrapper_started);
- thread_args.start = start;
- thread_args.arg = arg;
- thread_args.wrapper_started = 0;
+#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
+ thread_args_p = &thread_args;
+#else
+ thread_args_p = malloc(sizeof(*thread_args_p));
+#endif
+ assert(thread_args_p);
+
+ thread_args_p->start = start;
+ thread_args_p->arg = arg;
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
+ DRD_IGNORE_VAR(thread_args_p->wrapper_started);
+ thread_args_p->wrapper_started = 0;
+#endif
/*
* Find out whether the thread will be started as a joinable thread
* or as a detached thread. If no thread attributes have been specified,
* this means that the new thread will be started as a joinable thread.
*/
- thread_args.detachstate = PTHREAD_CREATE_JOINABLE;
+ thread_args_p->detachstate = PTHREAD_CREATE_JOINABLE;
if (attr)
{
- if (pthread_attr_getdetachstate(attr, &thread_args.detachstate) != 0)
+ if (pthread_attr_getdetachstate(attr, &thread_args_p->detachstate) != 0)
{
assert(0);
}
}
- assert(thread_args.detachstate == PTHREAD_CREATE_JOINABLE
- || thread_args.detachstate == PTHREAD_CREATE_DETACHED);
+ assert(thread_args_p->detachstate == PTHREAD_CREATE_JOINABLE
+ || thread_args_p->detachstate == PTHREAD_CREATE_DETACHED);
/* Suppress NPTL-specific conflicts between creator and created thread. */
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_STOP_RECORDING,
0, 0, 0, 0, 0);
- CALL_FN_W_WWWW(ret, fn, thread, attr, DRD_(thread_wrapper), &thread_args);
+ CALL_FN_W_WWWW(ret, fn, thread, attr, DRD_(thread_wrapper), thread_args_p);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_START_RECORDING,
0, 0, 0, 0, 0);
+#if defined(WAIT_UNTIL_CREATED_THREAD_STARTED)
if (ret == 0)
{
/*
@@ -315,12 +354,21 @@
* passed via dynamically allocated memory and if the loop below is
* removed.
*/
- while (! thread_args.wrapper_started)
+ while (! thread_args_p->wrapper_started)
{
sched_yield();
}
}
+#if defined(ALLOCATE_THREAD_ARGS_DYNAMICALLY)
+ free(thread_args_p);
+#endif
+
+#endif
+
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_START_NEW_SEGMENT,
+ pthread_self(), 0, 0, 0, 0);
+
return ret;
}
|
|
From: <sv...@va...> - 2009-03-12 18:38:38
|
Author: bart Date: 2009-03-12 18:38:26 +0000 (Thu, 12 Mar 2009) New Revision: 9386 Log: Corrected a few comments. Modified: trunk/drd/drd_clientreq.h Modified: trunk/drd/drd_clientreq.h =================================================================== --- trunk/drd/drd_clientreq.h 2009-03-12 18:38:00 UTC (rev 9385) +++ trunk/drd/drd_clientreq.h 2009-03-12 18:38:26 UTC (rev 9386) @@ -58,10 +58,10 @@ VG_USERREQ__DRD_START_RECORDING, /* args: none. */ - /* Tell the core the pthread_t of the running thread */ + /* Tell drd the pthread_t of the running thread. */ VG_USERREQ__SET_PTHREADID, /* args: pthread_t. */ - /* Ask the core that a the thread's state transition from */ + /* Ask drd that a the thread's state transition from */ /* VgTs_Zombie to VgTs_Empty is delayed until */ /* VG_USERREQ__POST_THREAD_JOIN is performed. */ VG_USERREQ__SET_JOINABLE, |
|
From: <sv...@va...> - 2009-03-12 18:38:10
|
Author: bart
Date: 2009-03-12 18:38:00 +0000 (Thu, 12 Mar 2009)
New Revision: 9385
Log:
Removed DRD_() wrapper from static variables. Corrected datatypes of DRD_(sg_new)().
Modified:
trunk/drd/drd_segment.c
trunk/drd/drd_segment.h
Modified: trunk/drd/drd_segment.c
===================================================================
--- trunk/drd/drd_segment.c 2009-03-12 18:35:44 UTC (rev 9384)
+++ trunk/drd/drd_segment.c 2009-03-12 18:38:00 UTC (rev 9385)
@@ -37,22 +37,26 @@
/* Local variables. */
-static ULong DRD_(s_segments_created_count);
-static ULong DRD_(s_segments_alive_count);
-static ULong DRD_(s_max_segments_alive_count);
-static Bool DRD_(s_trace_segment) = False;
+static ULong s_segments_created_count;
+static ULong s_segments_alive_count;
+static ULong s_max_segments_alive_count;
+static Bool s_trace_segment;
/* Function definitions. */
/**
* Initialize the memory 'sg' points at.
- * @note The creator and created thread ID's may be equal.
+ *
+ * @note The creator and created thread ID's may be equal.
+ * @note This function copies the vector clock of thread 'creator', a technique
+ * also known as clock snooping. This will only work reliably if the thread
+ * that called pthread_create() waits until the created thread has copied
+ * the vector clock.
*/
-static
-void DRD_(sg_init)(Segment* const sg,
- DrdThreadId const creator,
- DrdThreadId const created)
+static void sg_init(Segment* const sg,
+ const DrdThreadId creator,
+ const DrdThreadId created)
{
Segment* creator_sg;
ThreadId vg_created = DRD_(DrdThreadIdToVgThreadId)(created);
@@ -80,7 +84,7 @@
DRD_(vc_increment)(&sg->vc, created);
sg->bm = DRD_(bm_new)();
- if (DRD_(s_trace_segment))
+ if (s_trace_segment)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -107,18 +111,18 @@
}
/** Allocate and initialize a new segment. */
-Segment* DRD_(sg_new)(ThreadId const creator, ThreadId const created)
+Segment* DRD_(sg_new)(const DrdThreadId creator, const DrdThreadId created)
{
Segment* sg;
- DRD_(s_segments_created_count)++;
- DRD_(s_segments_alive_count)++;
- if (DRD_(s_max_segments_alive_count) < DRD_(s_segments_alive_count))
- DRD_(s_max_segments_alive_count) = DRD_(s_segments_alive_count);
+ s_segments_created_count++;
+ s_segments_alive_count++;
+ if (s_max_segments_alive_count < s_segments_alive_count)
+ s_max_segments_alive_count = s_segments_alive_count;
sg = VG_(malloc)("drd.segment.sn.1", sizeof(*sg));
tl_assert(sg);
- DRD_(sg_init)(sg, creator, created);
+ sg_init(sg, creator, created);
return sg;
}
@@ -136,7 +140,7 @@
}
#endif
- DRD_(s_segments_alive_count)--;
+ s_segments_alive_count--;
tl_assert(sg);
DRD_(sg_cleanup)(sg);
@@ -169,7 +173,7 @@
if (sg == 0)
return;
- if (DRD_(s_trace_segment))
+ if (s_trace_segment)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -196,7 +200,7 @@
tl_assert(sg2);
tl_assert(sg2->refcnt == 1);
- if (DRD_(s_trace_segment))
+ if (s_trace_segment)
{
char msg[256];
@@ -229,27 +233,27 @@
/** Query whether segment tracing has been enabled. */
Bool DRD_(sg_get_trace)(void)
{
- return DRD_(s_trace_segment);
+ return s_trace_segment;
}
/** Enable or disable segment tracing. */
void DRD_(sg_set_trace)(Bool const trace_segment)
{
tl_assert(trace_segment == False || trace_segment == True);
- DRD_(s_trace_segment) = trace_segment;
+ s_trace_segment = trace_segment;
}
ULong DRD_(sg_get_segments_created_count)(void)
{
- return DRD_(s_segments_created_count);
+ return s_segments_created_count;
}
ULong DRD_(sg_get_segments_alive_count)(void)
{
- return DRD_(s_segments_alive_count);
+ return s_segments_alive_count;
}
ULong DRD_(sg_get_max_segments_alive_count)(void)
{
- return DRD_(s_max_segments_alive_count);
+ return s_max_segments_alive_count;
}
Modified: trunk/drd/drd_segment.h
===================================================================
--- trunk/drd/drd_segment.h 2009-03-12 18:35:44 UTC (rev 9384)
+++ trunk/drd/drd_segment.h 2009-03-12 18:38:00 UTC (rev 9385)
@@ -58,7 +58,7 @@
} Segment;
-Segment* DRD_(sg_new)(const ThreadId creator, const ThreadId created);
+Segment* DRD_(sg_new)(const DrdThreadId creator, const DrdThreadId created);
int DRD_(sg_get_refcnt)(const Segment* const sg);
Segment* DRD_(sg_get)(Segment* const sg);
void DRD_(sg_put)(Segment* const sg);
|
|
From: <sv...@va...> - 2009-03-12 18:36:00
|
Author: bart
Date: 2009-03-12 18:35:44 +0000 (Thu, 12 Mar 2009)
New Revision: 9384
Log:
Cleanup.
Modified:
trunk/drd/drd_thread.c
Modified: trunk/drd/drd_thread.c
===================================================================
--- trunk/drd/drd_thread.c 2009-03-12 17:47:23 UTC (rev 9383)
+++ trunk/drd/drd_thread.c 2009-03-12 18:35:44 UTC (rev 9384)
@@ -419,14 +419,18 @@
if (DRD_(g_threadinfo)[tid].detached_posix_thread)
{
- /* Once a detached thread has finished, its stack is deallocated and */
- /* should no longer be taken into account when computing the conflict set*/
+ /*
+ * Once a detached thread has finished, its stack is deallocated and
+ * should no longer be taken into account when computing the conflict set.
+ */
DRD_(g_threadinfo)[tid].stack_min = DRD_(g_threadinfo)[tid].stack_max;
- /* For a detached thread, calling pthread_exit() invalidates the */
- /* POSIX thread ID associated with the detached thread. For joinable */
- /* POSIX threads however, the POSIX thread ID remains live after the */
- /* pthread_exit() call until pthread_join() is called. */
+ /*
+ * For a detached thread, calling pthread_exit() invalidates the
+ * POSIX thread ID associated with the detached thread. For joinable
+ * POSIX threads however, the POSIX thread ID remains live after the
+ * pthread_exit() call until pthread_join() is called.
+ */
DRD_(g_threadinfo)[tid].posix_thread_exists = False;
}
}
@@ -1065,7 +1069,8 @@
VG_(message)(Vg_UserMsg, "%s", msg);
}
- for (j = 0; j < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); j++)
+ for (j = 0; j < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]);
+ j++)
{
if (j != tid && DRD_(IsValidDrdThreadId)(j))
{
|
|
From: <sv...@va...> - 2009-03-12 17:47:28
|
Author: bart Date: 2009-03-12 17:47:23 +0000 (Thu, 12 Mar 2009) New Revision: 9383 Log: Removed obsolete function declaration. Modified: trunk/drd/drd_vc.h Modified: trunk/drd/drd_vc.h =================================================================== --- trunk/drd/drd_vc.h 2009-03-12 17:28:44 UTC (rev 9382) +++ trunk/drd/drd_vc.h 2009-03-12 17:47:23 UTC (rev 9383) @@ -70,7 +70,6 @@ void DRD_(vc_cleanup)(VectorClock* const vc); void DRD_(vc_copy)(VectorClock* const new, const VectorClock* const rhs); void DRD_(vc_assign)(VectorClock* const lhs, const VectorClock* const rhs); -UInt DRD_(vc_get)(VectorClock* const vc, const DrdThreadId tid); void DRD_(vc_increment)(VectorClock* const vc, DrdThreadId const tid); static __inline__ Bool DRD_(vc_lte)(const VectorClock* const vc1, |
|
From: <sv...@va...> - 2009-03-12 17:29:00
|
Author: bart
Date: 2009-03-12 17:28:44 +0000 (Thu, 12 Mar 2009)
New Revision: 9382
Log:
Force thread scheduling order.
Modified:
trunk/drd/tests/sem_as_mutex.c
Modified: trunk/drd/tests/sem_as_mutex.c
===================================================================
--- trunk/drd/tests/sem_as_mutex.c 2009-03-12 15:59:33 UTC (rev 9381)
+++ trunk/drd/tests/sem_as_mutex.c 2009-03-12 17:28:44 UTC (rev 9382)
@@ -71,6 +71,8 @@
pthread_create(&threadid, 0, thread_func, 0);
+ sleep(1); /* Wait until thread_func() finished. */
+
{
if (s_do_mutual_exclusion) sem_wait(&s_sem);
s_d3++;
|
|
From: <sv...@va...> - 2009-03-12 15:59:54
|
Author: sewardj
Date: 2009-03-12 15:59:33 +0000 (Thu, 12 Mar 2009)
New Revision: 9381
Log:
Make this test independent of the actual numerical value of SIGCHLD.
Modified:
branches/DARWIN/none/tests/coolo_sigaction.cpp
branches/DARWIN/none/tests/coolo_sigaction.stdout.exp
Modified: branches/DARWIN/none/tests/coolo_sigaction.cpp
===================================================================
--- branches/DARWIN/none/tests/coolo_sigaction.cpp 2009-03-12 12:41:33 UTC (rev 9380)
+++ branches/DARWIN/none/tests/coolo_sigaction.cpp 2009-03-12 15:59:33 UTC (rev 9381)
@@ -8,7 +8,7 @@
void theHandler(int arg)
{
- printf("handled %d\n", arg);
+ printf("handled %s\n", arg == SIGCHLD ? "SIGCHLD" : "?!unexpected signal?!" );
}
void setupHandlers()
Modified: branches/DARWIN/none/tests/coolo_sigaction.stdout.exp
===================================================================
--- branches/DARWIN/none/tests/coolo_sigaction.stdout.exp 2009-03-12 12:41:33 UTC (rev 9380)
+++ branches/DARWIN/none/tests/coolo_sigaction.stdout.exp 2009-03-12 15:59:33 UTC (rev 9381)
@@ -1 +1 @@
-handled 17
+handled SIGCHLD
|
|
From: Julian S. <js...@ac...> - 2009-03-12 13:07:30
|
On Thursday 12 March 2009, Nicholas Nethercote wrote: > On Thu, Mar 12, 2009 at 12:03 PM, <sv...@va...> wrote: > > Author: sewardj > > Date: 2009-03-12 01:03:27 +0000 (Thu, 12 Mar 2009) > > New Revision: 9370 > > > > Log: > > Test fails on Darwin because pulling an allegedly invalid address out > > of a hat is a really stupid idea. Fix it to generate an > > always-invalid place by first mmaping and then munmapping a page. > > The commit fixes the stupidity, but the test still fails, right? No, it should pass on all platforms now. J |
|
From: <sv...@va...> - 2009-03-12 12:41:59
|
Author: sewardj
Date: 2009-03-12 12:41:33 +0000 (Thu, 12 Mar 2009)
New Revision: 9380
Log:
Use SA_NODEFER instead of the obsolete form SA_NOMASK when setting up
the signal handler, as this is essential for avoiding an infinite
loop. This makes it not loop on Darwin. Also, add comments
explaining what's going on.
Modified:
branches/DARWIN/none/tests/sigstackgrowth.c
Modified: branches/DARWIN/none/tests/sigstackgrowth.c
===================================================================
--- branches/DARWIN/none/tests/sigstackgrowth.c 2009-03-12 06:02:50 UTC (rev 9379)
+++ branches/DARWIN/none/tests/sigstackgrowth.c 2009-03-12 12:41:33 UTC (rev 9380)
@@ -4,10 +4,26 @@
#include <sys/types.h>
#include <unistd.h>
-#if (defined(_AIX) || defined(__APPLE__)) && !defined(SA_NOMASK)
-# define SA_NOMASK 0
-#endif
+/* What does this test do? It checks that valgrind's signal frame
+ building mechanism can create at least 4MB of signal delivery
+ frames, hence that it can actually expand the stack by that much
+ when delivering signals. A fair-enough thing to want to test.
+ It does this by getting into the signal handler, and then
+ recursively invoking the handler by sending itself the signal
+ again, until the stack has grown to 4MB from the starting frame
+ (main).
+
+ Consequence is: it is essential that we do not disable delivery of
+ further signals within the handler itself, else the kernel will
+ wait till the handler exits before delivering the next signal, the
+ frame will be cleared, the stack will never grow, and we'll be in
+ an infinite loop.
+
+ Hence we *must* give the SA_NODEFER flag when setting up the
+ handler.
+*/
+
static char *deep;
#define SIZE (4*1024*1024)
@@ -32,7 +48,7 @@
deep = &here - SIZE;
sa.sa_handler = handler;
- sa.sa_flags = SA_NOMASK;
+ sa.sa_flags = SA_NODEFER;
sigemptyset(&sa.sa_mask);
sigaction(SIGUSR1, &sa, NULL);
@@ -42,3 +58,4 @@
printf("FAILED\n");
exit(1);
}
+
|
|
From: Bart V. A. <bar...@gm...> - 2009-03-12 08:21:19
|
Nightly build on georgia-tech-cellbuzz-native ( cellbuzz, ppc64, Fedora 7, native ) started at 2009-03-12 02:00:01 EDT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 406 tests, 38 stderr failures, 9 stdout failures, 0 post failures == exp-ptrcheck/tests/bad_percentify (stderr) exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/fp (stderr) exp-ptrcheck/tests/globalerr (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) exp-ptrcheck/tests/hp_bounds (stderr) exp-ptrcheck/tests/hp_dangle (stderr) exp-ptrcheck/tests/justify (stderr) exp-ptrcheck/tests/partial_bad (stderr) exp-ptrcheck/tests/partial_good (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) exp-ptrcheck/tests/realloc (stderr) exp-ptrcheck/tests/stackerr (stderr) exp-ptrcheck/tests/strcpy (stderr) exp-ptrcheck/tests/supp (stderr) exp-ptrcheck/tests/tricky (stderr) exp-ptrcheck/tests/unaligned (stderr) exp-ptrcheck/tests/zero (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cases-full (stderr) memcheck/tests/leak-cases-summary (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/wrap8 (stderr) none/tests/linux/mremap (stderr) none/tests/linux/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-vmx (stdout) none/tests/ppc32/round (stdout) none/tests/ppc32/test_gx (stdout) none/tests/ppc64/jm-fp (stdout) none/tests/ppc64/jm-vmx (stdout) none/tests/ppc64/round (stdout) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 407 tests, 39 stderr failures, 9 stdout failures, 0 post failures == exp-ptrcheck/tests/bad_percentify (stderr) exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/fp (stderr) exp-ptrcheck/tests/globalerr (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) exp-ptrcheck/tests/hp_bounds (stderr) exp-ptrcheck/tests/hp_dangle (stderr) exp-ptrcheck/tests/justify (stderr) exp-ptrcheck/tests/partial_bad (stderr) exp-ptrcheck/tests/partial_good (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) exp-ptrcheck/tests/realloc (stderr) exp-ptrcheck/tests/stackerr (stderr) exp-ptrcheck/tests/strcpy (stderr) exp-ptrcheck/tests/supp (stderr) exp-ptrcheck/tests/tricky (stderr) exp-ptrcheck/tests/unaligned (stderr) exp-ptrcheck/tests/zero (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cases-full (stderr) memcheck/tests/leak-cases-summary (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/wrap8 (stderr) none/tests/linux/mremap (stderr) none/tests/linux/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-vmx (stdout) none/tests/ppc32/round (stdout) none/tests/ppc32/test_gx (stdout) none/tests/ppc64/jm-fp (stdout) none/tests/ppc64/jm-vmx (stdout) none/tests/ppc64/round (stdout) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Thu Mar 12 03:10:06 2009 --- new.short Thu Mar 12 04:20:55 2009 *************** *** 8,10 **** ! == 407 tests, 39 stderr failures, 9 stdout failures, 0 post failures == exp-ptrcheck/tests/bad_percentify (stderr) --- 8,10 ---- ! == 406 tests, 38 stderr failures, 9 stdout failures, 0 post failures == exp-ptrcheck/tests/bad_percentify (stderr) *************** *** 37,39 **** memcheck/tests/leak-cycle (stderr) - memcheck/tests/leak-tree (stderr) memcheck/tests/origin5-bz2 (stderr) --- 37,38 ---- |
|
From: <sv...@va...> - 2009-03-12 06:03:02
|
Author: njn Date: 2009-03-12 06:02:50 +0000 (Thu, 12 Mar 2009) New Revision: 9379 Log: Merge r9378 (remove unnecessary Helgrind .exp files) from the trunk. Removed: branches/DARWIN/helgrind/tests/hg03_inherit.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/hg04_race.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/hg05_race2.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc01_simple_race.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc05_simple_race.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc06_two_races.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc16_byterace.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc17_sembar.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc19_shadowmem.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc20_verifywrap.stderr.exp-glibc23-amd64 branches/DARWIN/helgrind/tests/tc20_verifywrap.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc21_pthonce.stderr.exp-glibc23-amd64 branches/DARWIN/helgrind/tests/tc21_pthonce.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc23_bogus_condwait.stderr.exp-glibc25-x86 Modified: branches/DARWIN/helgrind/tests/Makefile.am [... diff too large to include ...] |
|
From: <sv...@va...> - 2009-03-12 05:58:19
|
Author: njn Date: 2009-03-12 05:58:05 +0000 (Thu, 12 Mar 2009) New Revision: 9378 Log: Remove Helgrind .exp files which are out-of-date, because Helgrind's output has changed since they were generated. Also remove one (tc23_bogus_condwait.stderr.exp-glibc25-x86) that was a duplicate. Removed: trunk/helgrind/tests/hg03_inherit.stderr.exp-glibc25-x86 trunk/helgrind/tests/hg04_race.stderr.exp-glibc25-x86 trunk/helgrind/tests/hg05_race2.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc01_simple_race.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc05_simple_race.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc06_two_races.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc16_byterace.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc17_sembar.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc19_shadowmem.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc20_verifywrap.stderr.exp-glibc23-amd64 trunk/helgrind/tests/tc20_verifywrap.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc21_pthonce.stderr.exp-glibc23-amd64 trunk/helgrind/tests/tc21_pthonce.stderr.exp-glibc25-x86 trunk/helgrind/tests/tc23_bogus_condwait.stderr.exp-glibc25-x86 Modified: trunk/helgrind/tests/Makefile.am [... diff too large to include ...] |
|
From: <sv...@va...> - 2009-03-12 05:51:47
|
Author: njn Date: 2009-03-12 05:51:38 +0000 (Thu, 12 Mar 2009) New Revision: 9377 Log: Merge r9376 (filter_xml update) from the trunk. Modified: branches/DARWIN/memcheck/tests/filter_xml Modified: branches/DARWIN/memcheck/tests/filter_xml =================================================================== --- branches/DARWIN/memcheck/tests/filter_xml 2009-03-12 05:50:51 UTC (rev 9376) +++ branches/DARWIN/memcheck/tests/filter_xml 2009-03-12 05:51:38 UTC (rev 9377) @@ -15,7 +15,7 @@ # Remove stack traces for Syscall param errors (see filter_stderr for more). # Chops everything within <stack>...</stack>. -perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn|dir|line)[^\n]*\n)*/$1\n/gs' +perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn|dir|file|line)[^\n]*\n)*/$1\n/gs' # Collected wisdom re Perl magic incantation: # |
|
From: <sv...@va...> - 2009-03-12 05:51:00
|
Author: njn Date: 2009-03-12 05:50:51 +0000 (Thu, 12 Mar 2009) New Revision: 9376 Log: Another filter_xml update. Modified: trunk/memcheck/tests/filter_xml Modified: trunk/memcheck/tests/filter_xml =================================================================== --- trunk/memcheck/tests/filter_xml 2009-03-12 05:39:06 UTC (rev 9375) +++ trunk/memcheck/tests/filter_xml 2009-03-12 05:50:51 UTC (rev 9376) @@ -15,7 +15,7 @@ # Remove stack traces for Syscall param errors (see filter_stderr for more). # Chops everything within <stack>...</stack>. -perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn|dir|line)[^\n]*\n)*/$1\n/gs' +perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn|dir|file|line)[^\n]*\n)*/$1\n/gs' # Collected wisdom re Perl magic incantation: # |
|
From: <sv...@va...> - 2009-03-12 05:39:14
|
Author: njn Date: 2009-03-12 05:39:06 +0000 (Thu, 12 Mar 2009) New Revision: 9375 Log: Merged r9333 and r9374 (test filtering and .exp fixes) from the trunk. Removed: branches/DARWIN/memcheck/tests/mismatches.stderr.exp2 branches/DARWIN/memcheck/tests/mismatches.stderr.exp64 Modified: branches/DARWIN/exp-ptrcheck/tests/ccc.stderr.exp-glibc25-amd64 branches/DARWIN/exp-ptrcheck/tests/ccc.stderr.exp-glibc25-x86 branches/DARWIN/exp-ptrcheck/tests/ccc.stderr.exp-glibc27-x86 branches/DARWIN/exp-ptrcheck/tests/ccc.stderr.exp-glibc28-amd64 branches/DARWIN/helgrind/tests/filter_stderr branches/DARWIN/helgrind/tests/hg02_deadlock.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/hg02_deadlock.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/hg02_deadlock.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/hg03_inherit.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/hg03_inherit.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/hg03_inherit.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/hg04_race.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/hg04_race.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/hg04_race.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/hg05_race2.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/hg05_race2.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/hg05_race2.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/pth_barrier1.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/pth_barrier1.stderr.exp-glibc28-amd64 branches/DARWIN/helgrind/tests/pth_barrier2.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/pth_barrier2.stderr.exp-glibc28-amd64 branches/DARWIN/helgrind/tests/pth_barrier3.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/pth_barrier3.stderr.exp-glibc28-amd64 branches/DARWIN/helgrind/tests/rwlock_race.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/rwlock_race.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc01_simple_race.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc01_simple_race.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc01_simple_race.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc05_simple_race.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc05_simple_race.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc05_simple_race.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc06_two_races.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc06_two_races.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc06_two_races.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc09_bad_unlock.stderr.exp-glibc23-amd64 branches/DARWIN/helgrind/tests/tc09_bad_unlock.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc09_bad_unlock.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc09_bad_unlock.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc14_laog_dinphils.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc14_laog_dinphils.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc14_laog_dinphils.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc16_byterace.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc16_byterace.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc16_byterace.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc17_sembar.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc19_shadowmem.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc19_shadowmem.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc19_shadowmem.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc20_verifywrap.stderr.exp-glibc23-amd64 branches/DARWIN/helgrind/tests/tc20_verifywrap.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc20_verifywrap.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc20_verifywrap.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc20_verifywrap.stderr.exp-glibc28-amd64 branches/DARWIN/helgrind/tests/tc21_pthonce.stderr.exp-glibc23-amd64 branches/DARWIN/helgrind/tests/tc21_pthonce.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc21_pthonce.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc21_pthonce.stderr.exp-glibc27-amd64 branches/DARWIN/helgrind/tests/tc22_exit_w_lock.stderr.exp-glibc25-amd64 branches/DARWIN/helgrind/tests/tc22_exit_w_lock.stderr.exp-glibc25-x86 branches/DARWIN/helgrind/tests/tc22_exit_w_lock.stderr.exp-glibc27-amd64 branches/DARWIN/memcheck/tests/Makefile.am branches/DARWIN/memcheck/tests/mismatches.stderr.exp branches/DARWIN/tests/filter_libc [... diff too large to include ...] |
|
From: <sv...@va...> - 2009-03-12 05:20:53
|
Author: njn
Date: 2009-03-12 05:20:46 +0000 (Thu, 12 Mar 2009)
New Revision: 9374
Log:
Fix a .exp file.
Modified:
trunk/exp-ptrcheck/tests/ccc.stderr.exp-glibc25-amd64
Modified: trunk/exp-ptrcheck/tests/ccc.stderr.exp-glibc25-amd64
===================================================================
--- trunk/exp-ptrcheck/tests/ccc.stderr.exp-glibc25-amd64 2009-03-12 03:15:41 UTC (rev 9373)
+++ trunk/exp-ptrcheck/tests/ccc.stderr.exp-glibc25-amd64 2009-03-12 05:20:46 UTC (rev 9374)
@@ -17,7 +17,7 @@
at 0x........: main (ccc.cpp:22)
Address 0x........ is 4 bytes before the accessing pointer's
legitimate range, a block of size 40 alloc'd
- at 0x........: ...operator new...) (vg_replace_malloc.c:...)
+ at 0x........: ...operator new... (vg_replace_malloc.c:...)
by 0x........: main (ccc.cpp:10)
Invalid read of size 4
|
|
From: Tom H. <th...@cy...> - 2009-03-12 04:14:41
|
Nightly build on vauxhall ( x86_64, Fedora 10 ) started at 2009-03-12 03:20:07 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 486 tests, 1 stderr failure, 1 stdout failure, 0 post failures == memcheck/tests/xml1 (stderr) none/tests/pth_cvsimple (stdout) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 487 tests, 1 stderr failure, 0 stdout failures, 0 post failures == memcheck/tests/xml1 (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Thu Mar 12 03:46:19 2009 --- new.short Thu Mar 12 04:14:33 2009 *************** *** 8,11 **** ! == 487 tests, 1 stderr failure, 0 stdout failures, 0 post failures == memcheck/tests/xml1 (stderr) --- 8,12 ---- ! == 486 tests, 1 stderr failure, 1 stdout failure, 0 post failures == memcheck/tests/xml1 (stderr) + none/tests/pth_cvsimple (stdout) |
|
From: Tom H. <th...@cy...> - 2009-03-12 04:01:49
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2009-03-12 03:05:06 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 477 tests, 6 stderr failures, 0 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc20_verifywrap (stderr) memcheck/tests/xml1 (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 478 tests, 6 stderr failures, 0 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc20_verifywrap (stderr) memcheck/tests/xml1 (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Thu Mar 12 03:33:17 2009 --- new.short Thu Mar 12 04:01:31 2009 *************** *** 8,10 **** ! == 478 tests, 6 stderr failures, 0 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) --- 8,10 ---- ! == 477 tests, 6 stderr failures, 0 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) |
|
From: Tom H. <th...@cy...> - 2009-03-12 03:47:02
|
Nightly build on mg ( x86_64, Fedora 9 ) started at 2009-03-12 03:10:06 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 483 tests, 4 stderr failures, 1 stdout failure, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) none/tests/linux/mremap2 (stdout) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 484 tests, 4 stderr failures, 1 stdout failure, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) none/tests/linux/mremap2 (stdout) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Thu Mar 12 03:28:30 2009 --- new.short Thu Mar 12 03:46:47 2009 *************** *** 8,10 **** ! == 484 tests, 4 stderr failures, 1 stdout failure, 0 post failures == exp-ptrcheck/tests/ccc (stderr) --- 8,10 ---- ! == 483 tests, 4 stderr failures, 1 stdout failure, 0 post failures == exp-ptrcheck/tests/ccc (stderr) |
|
From: <sv...@va...> - 2009-03-12 03:16:15
|
Author: njn
Date: 2009-03-12 03:15:41 +0000 (Thu, 12 Mar 2009)
New Revision: 9373
Log:
Merge r9372 (kill leakotron, rewrite leak-tree) from the trunk.
Removed:
branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2
branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64
branches/DARWIN/memcheck/tests/leakotron.c
branches/DARWIN/memcheck/tests/leakotron.stderr.exp
branches/DARWIN/memcheck/tests/leakotron.stdout.exp
branches/DARWIN/memcheck/tests/leakotron.vgtest
Modified:
branches/DARWIN/memcheck/tests/Makefile.am
branches/DARWIN/memcheck/tests/leak-tree.c
branches/DARWIN/memcheck/tests/leak-tree.stderr.exp
branches/DARWIN/memcheck/tests/leak-tree.vgtest
Modified: branches/DARWIN/memcheck/tests/Makefile.am
===================================================================
--- branches/DARWIN/memcheck/tests/Makefile.am 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/Makefile.am 2009-03-12 03:15:41 UTC (rev 9373)
@@ -72,8 +72,6 @@
leak-pool-4.vgtest leak-pool-4.stderr.exp \
leak-pool-5.vgtest leak-pool-5.stderr.exp \
leak-tree.vgtest leak-tree.stderr.exp \
- leak-tree.stderr.exp2 leak-tree.stderr.exp64 \
- leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
linux-syslog-syscall linux-syslog-syscall.stderr.exp \
linux-syscalls-2007 linux-syscalls-2007.stderr.exp \
long_namespace_xml.vgtest long_namespace_xml.stdout.exp \
@@ -193,7 +191,7 @@
fprw fwrite inits inline \
leak-0 \
leak-cases \
- leak-cycle leak-pool leak-tree leakotron \
+ leak-cycle leak-pool leak-tree \
linux-syslog-syscall \
linux-syscalls-2007 \
long_namespace_xml \
Modified: branches/DARWIN/memcheck/tests/leak-tree.c
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.c 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leak-tree.c 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1,46 +1,71 @@
#include <stdio.h>
#include <stdlib.h>
+#include "leak.h"
#include "../memcheck.h"
-struct foo {
- struct foo *l, *r;
-};
+/* We build this tree:
+
+ A
+ / \
+ B C
+ / \ / \
+ D E F G
+
+ Then we leak D and C-F-G.
+*/
-struct foo *mk(struct foo *l, struct foo *r)
+typedef
+ struct _Node {
+ struct _Node *l;
+ struct _Node *r;
+ // Padding ensures the structu is the same size on 32-bit and 64-bit
+ // machines.
+ char padding[16 - 2*sizeof(struct _Node*)];
+ } Node;
+
+Node* mk(void)
{
- struct foo *f = malloc(sizeof(*f));
- f->l = l;
- f->r = r;
-
- return f;
+ Node *x = malloc(sizeof(Node));
+ x->l = NULL;
+ x->r = NULL;
+ return x;
}
-int main()
+// This is a definite root.
+Node* t;
+
+void f(void)
{
- struct foo *volatile a, *volatile b, *volatile c;
+ // Building like this rather than "t = mk(mk(mk(NULL, NULL), ...)" seems to
+ // help avoid leaving pointers on the stack to supposedly-leaked blocks.
+ t = mk(); // A
+ t->l = mk(); // B
+ t->r = mk(); // C (48(16d,32i)/1 definitely leaked from here)
+ t->l->l = mk(); // D (16/1 definitely leaked from here)
+ t->l->r = mk(); // E
+ t->r->l = mk(); // F
+ t->r->r = mk(); // G
- b = mk(mk(0, 0), 0);
+ // Sever B->D, leaking D
+ t->l->l = NULL;
+
+ // Sever A->C, leaking C-F-G
+ t->r = NULL;
+}
- /* Partially leaked tree structure */
- a = mk(mk(mk(mk(mk(0, 0), 0), mk(mk(0, 0), b)), mk(0, 0)), mk(0,0));
-
- a = NULL;
+int main(void)
+{
+ DECLARE_LEAK_COUNTERS;
- VALGRIND_DO_LEAK_CHECK;
+ GET_INITIAL_LEAK_COUNTS;
- b = NULL; /* now leak old b */
+ // See leak-cases.c for why we do the work in f().
+ f();
- /* Completely leaked, but part of the structure is shared */
- b = mk(0,0);
- b->l = b;
- b->r = b;
+ GET_FINAL_LEAK_COUNTS;
- a = mk(b,b);
- c = mk(b,b);
+ PRINT_LEAK_COUNTS(stderr);
- a = b = c = 0;
+ return 0;
+}
- VALGRIND_DO_LEAK_CHECK;
-
- return 0;
-}
Modified: branches/DARWIN/memcheck/tests/leak-tree.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.stderr.exp 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leak-tree.stderr.exp 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1,52 +1,17 @@
+leaked: 64 bytes in 4 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 48 bytes in 3 blocks
+suppressed: 0 bytes in 0 blocks
-searching for pointers to 11 not-freed blocks.
-checked ... bytes.
-
-72 (8 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
+16 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
+ by 0x........: mk (leak-tree.c:28)
+ by 0x........: f (leak-tree.c:44)
+ by 0x........: main (leak-tree.c:63)
-LEAK SUMMARY:
- definitely lost: 8 bytes in 1 blocks.
- indirectly lost: 64 bytes in 8 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 16 bytes in 2 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-searching for pointers to 14 not-freed blocks.
-checked ... bytes.
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
+48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:39)
-
-
-88 (8 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-
-16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:38)
-
-LEAK SUMMARY:
- definitely lost: 24 bytes in 3 blocks.
- indirectly lost: 88 bytes in 11 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 0 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 112 bytes in 14 blocks.
-malloc/free: 14 allocs, 0 frees, 112 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
+ by 0x........: mk (leak-tree.c:28)
+ by 0x........: f (leak-tree.c:43)
+ by 0x........: main (leak-tree.c:63)
Deleted: branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1,52 +0,0 @@
-
-searching for pointers to 11 not-freed blocks.
-checked ... bytes.
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 8 bytes in 1 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 80 bytes in 10 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-searching for pointers to 14 not-freed blocks.
-checked ... bytes.
-
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:39)
-
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:38)
-
-
-40 (8 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 24 bytes in 3 blocks.
- indirectly lost: 32 bytes in 4 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 56 bytes in 7 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 112 bytes in 14 blocks.
-malloc/free: 14 allocs, 0 frees, 112 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1,52 +0,0 @@
-
-searching for pointers to 11 not-freed blocks.
-checked ... bytes.
-
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 16 bytes in 1 blocks.
- indirectly lost: 64 bytes in 4 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 96 bytes in 6 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-searching for pointers to 14 not-freed blocks.
-checked ... bytes.
-
-
-16 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:39)
-
-
-16 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:38)
-
-
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 48 bytes in 3 blocks.
- indirectly lost: 64 bytes in 4 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 112 bytes in 7 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 224 bytes in 14 blocks.
-malloc/free: 14 allocs, 0 frees, 224 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Modified: branches/DARWIN/memcheck/tests/leak-tree.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.vgtest 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leak-tree.vgtest 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1,2 +1,2 @@
prog: leak-tree
-vgopts: --leak-resolution=high
+vgopts: -q --leak-check=full --leak-resolution=high
Deleted: branches/DARWIN/memcheck/tests/leakotron.c
===================================================================
--- branches/DARWIN/memcheck/tests/leakotron.c 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leakotron.c 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1,146 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../memcheck.h"
-#include "leak.h"
-
-/*
- Incompetent memory management
-
- Simulate what happens when trying to manage a dense brancy cyclic
- structure with refcounting.
- */
-
-static long bytes, blocks;
-
-struct node {
- struct node *l, *r;
- int ref;
-};
-
-static void ref(struct node *n)
-{
- if (n)
- n->ref++;
-}
-
-static void unref(struct node *n)
-{
- if (n && --n->ref == 0) {
- bytes -= sizeof(*n);
- blocks--;
- free(n);
- }
-}
-
-static struct node *alloc()
-{
- struct node *n = malloc(sizeof(*n));
- n->l = n->r = NULL;
- n->ref = 0;
-
- bytes += sizeof(*n);
- blocks++;
-
- return n;
-}
-
-static void assign(struct node **np, struct node *n)
-{
- ref(n);
- unref(*np);
-
- *np = n;
-}
-
-static int rrange(int range)
-{
- long long ret = rand() * (long long)range;
-
- return (int)(ret / RAND_MAX);
-}
-
-#define ITER 100000
-#define N 1000
-
-static struct node *nodes[N];
-
-static struct node *mk()
-{
- int idx = rrange(N);
- struct node *n;
-
- /*
- 50% recycle
- 25% alloc new
- 25% return NULL
- */
- if (rand() > RAND_MAX/2) {
- /* recycle existing block */
- n = nodes[idx];
- } else if (rand() > RAND_MAX/2) {
- /* alloc new block */
- n = alloc();
- assign(&n->l, mk());
- assign(&n->r, mk());
- } else {
- /* no block */
- n = NULL;
- }
-
- assign(&nodes[idx], n);
-
- return n;
-}
-
-int main()
-{
- int i;
- long total;
- DECLARE_LEAK_COUNTERS;
-
- /* we require these longs to have same size as a machine word */
- assert(sizeof(long) == sizeof(void*));
-
- /* get a baseline in case the runtime allocated some memory */
- GET_INITIAL_LEAK_COUNTS;
-
- for (i = 0; i < ITER; i++) {
- mk();
-
- if ((i % (ITER/10)) == 0) {
- if (0)
- printf("%ld living blocks, %ld bytes\n",
- blocks, bytes);
- //VALGRIND_DO_LEAK_CHECK;
- }
- }
-
- /* "free all memory" */
- for (i = 0; i < N; i++)
- assign(&nodes[i], NULL);
-
-
- if (0)
- printf("FINISHED: %ld living blocks, %ld bytes\n",
- blocks, bytes);
-
- GET_FINAL_LEAK_COUNTS;
-
- total = L_bytes + D_bytes + R_bytes + S_bytes;
-
- if (0) {
- PRINT_LEAK_COUNTS(stderr);
- }
-
- if (R_bytes != 0)
- printf("FAILED: I freed everything, "
- "but there's still %ld bytes (in %ld blocks) reachable\n",
- R_bytes, R_blocks);
- else if (total != bytes)
- printf("FAILED: I count %ld bytes, leakcheck says %ld\n",
- bytes, total);
- else
- printf("PASS\n");
- return 0;
-}
Deleted: branches/DARWIN/memcheck/tests/leakotron.stderr.exp
===================================================================
Deleted: branches/DARWIN/memcheck/tests/leakotron.stdout.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leakotron.stdout.exp 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leakotron.stdout.exp 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1 +0,0 @@
-PASS
Deleted: branches/DARWIN/memcheck/tests/leakotron.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leakotron.vgtest 2009-03-12 03:00:05 UTC (rev 9372)
+++ branches/DARWIN/memcheck/tests/leakotron.vgtest 2009-03-12 03:15:41 UTC (rev 9373)
@@ -1,2 +0,0 @@
-prog: leakotron
-stderr_filter: ../../tests/filter_sink
|
|
From: <sv...@va...> - 2009-03-12 03:00:26
|
Author: njn
Date: 2009-03-12 03:00:05 +0000 (Thu, 12 Mar 2009)
New Revision: 9372
Log:
- Removed leakotron. It was not a very useful test, and hard to make
portable.
- Rewrote leak-tree to be deterministic and clearer.
Removed:
trunk/memcheck/tests/leak-tree.stderr.exp2
trunk/memcheck/tests/leak-tree.stderr.exp64
trunk/memcheck/tests/leakotron.c
trunk/memcheck/tests/leakotron.stderr.exp
trunk/memcheck/tests/leakotron.stdout.exp
trunk/memcheck/tests/leakotron.vgtest
Modified:
trunk/memcheck/tests/Makefile.am
trunk/memcheck/tests/leak-tree.c
trunk/memcheck/tests/leak-tree.stderr.exp
trunk/memcheck/tests/leak-tree.vgtest
Modified: trunk/memcheck/tests/Makefile.am
===================================================================
--- trunk/memcheck/tests/Makefile.am 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/Makefile.am 2009-03-12 03:00:05 UTC (rev 9372)
@@ -69,8 +69,6 @@
leak-pool-4.vgtest leak-pool-4.stderr.exp \
leak-pool-5.vgtest leak-pool-5.stderr.exp \
leak-tree.vgtest leak-tree.stderr.exp \
- leak-tree.stderr.exp2 leak-tree.stderr.exp64 \
- leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
linux-syslog-syscall linux-syslog-syscall.stderr.exp \
linux-syscalls-2007 linux-syscalls-2007.stderr.exp \
long_namespace_xml.vgtest long_namespace_xml.stdout.exp \
@@ -190,7 +188,7 @@
fprw fwrite inits inline \
leak-0 \
leak-cases \
- leak-cycle leak-pool leak-tree leakotron \
+ leak-cycle leak-pool leak-tree \
linux-syslog-syscall \
linux-syscalls-2007 \
long_namespace_xml \
Modified: trunk/memcheck/tests/leak-tree.c
===================================================================
--- trunk/memcheck/tests/leak-tree.c 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leak-tree.c 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1,46 +1,71 @@
#include <stdio.h>
#include <stdlib.h>
+#include "leak.h"
#include "../memcheck.h"
-struct foo {
- struct foo *l, *r;
-};
+/* We build this tree:
+
+ A
+ / \
+ B C
+ / \ / \
+ D E F G
+
+ Then we leak D and C-F-G.
+*/
-struct foo *mk(struct foo *l, struct foo *r)
+typedef
+ struct _Node {
+ struct _Node *l;
+ struct _Node *r;
+ // Padding ensures the structu is the same size on 32-bit and 64-bit
+ // machines.
+ char padding[16 - 2*sizeof(struct _Node*)];
+ } Node;
+
+Node* mk(void)
{
- struct foo *f = malloc(sizeof(*f));
- f->l = l;
- f->r = r;
-
- return f;
+ Node *x = malloc(sizeof(Node));
+ x->l = NULL;
+ x->r = NULL;
+ return x;
}
-int main()
+// This is a definite root.
+Node* t;
+
+void f(void)
{
- struct foo *volatile a, *volatile b, *volatile c;
+ // Building like this rather than "t = mk(mk(mk(NULL, NULL), ...)" seems to
+ // help avoid leaving pointers on the stack to supposedly-leaked blocks.
+ t = mk(); // A
+ t->l = mk(); // B
+ t->r = mk(); // C (48(16d,32i)/1 definitely leaked from here)
+ t->l->l = mk(); // D (16/1 definitely leaked from here)
+ t->l->r = mk(); // E
+ t->r->l = mk(); // F
+ t->r->r = mk(); // G
- b = mk(mk(0, 0), 0);
+ // Sever B->D, leaking D
+ t->l->l = NULL;
+
+ // Sever A->C, leaking C-F-G
+ t->r = NULL;
+}
- /* Partially leaked tree structure */
- a = mk(mk(mk(mk(mk(0, 0), 0), mk(mk(0, 0), b)), mk(0, 0)), mk(0,0));
-
- a = NULL;
+int main(void)
+{
+ DECLARE_LEAK_COUNTERS;
- VALGRIND_DO_LEAK_CHECK;
+ GET_INITIAL_LEAK_COUNTS;
- b = NULL; /* now leak old b */
+ // See leak-cases.c for why we do the work in f().
+ f();
- /* Completely leaked, but part of the structure is shared */
- b = mk(0,0);
- b->l = b;
- b->r = b;
+ GET_FINAL_LEAK_COUNTS;
- a = mk(b,b);
- c = mk(b,b);
+ PRINT_LEAK_COUNTS(stderr);
- a = b = c = 0;
+ return 0;
+}
- VALGRIND_DO_LEAK_CHECK;
-
- return 0;
-}
Modified: trunk/memcheck/tests/leak-tree.stderr.exp
===================================================================
--- trunk/memcheck/tests/leak-tree.stderr.exp 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leak-tree.stderr.exp 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1,52 +1,17 @@
+leaked: 64 bytes in 4 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 48 bytes in 3 blocks
+suppressed: 0 bytes in 0 blocks
-searching for pointers to 11 not-freed blocks.
-checked ... bytes.
-
-72 (8 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
+16 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
+ by 0x........: mk (leak-tree.c:28)
+ by 0x........: f (leak-tree.c:44)
+ by 0x........: main (leak-tree.c:63)
-LEAK SUMMARY:
- definitely lost: 8 bytes in 1 blocks.
- indirectly lost: 64 bytes in 8 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 16 bytes in 2 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-searching for pointers to 14 not-freed blocks.
-checked ... bytes.
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
+48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:39)
-
-
-88 (8 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-
-16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:38)
-
-LEAK SUMMARY:
- definitely lost: 24 bytes in 3 blocks.
- indirectly lost: 88 bytes in 11 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 0 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 112 bytes in 14 blocks.
-malloc/free: 14 allocs, 0 frees, 112 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
+ by 0x........: mk (leak-tree.c:28)
+ by 0x........: f (leak-tree.c:43)
+ by 0x........: main (leak-tree.c:63)
Deleted: trunk/memcheck/tests/leak-tree.stderr.exp2
===================================================================
--- trunk/memcheck/tests/leak-tree.stderr.exp2 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leak-tree.stderr.exp2 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1,52 +0,0 @@
-
-searching for pointers to 11 not-freed blocks.
-checked ... bytes.
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 8 bytes in 1 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 80 bytes in 10 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-searching for pointers to 14 not-freed blocks.
-checked ... bytes.
-
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:39)
-
-
-8 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:38)
-
-
-40 (8 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 24 bytes in 3 blocks.
- indirectly lost: 32 bytes in 4 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 56 bytes in 7 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 112 bytes in 14 blocks.
-malloc/free: 14 allocs, 0 frees, 112 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: trunk/memcheck/tests/leak-tree.stderr.exp64
===================================================================
--- trunk/memcheck/tests/leak-tree.stderr.exp64 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leak-tree.stderr.exp64 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1,52 +0,0 @@
-
-searching for pointers to 11 not-freed blocks.
-checked ... bytes.
-
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 16 bytes in 1 blocks.
- indirectly lost: 64 bytes in 4 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 96 bytes in 6 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-searching for pointers to 14 not-freed blocks.
-checked ... bytes.
-
-
-16 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:39)
-
-
-16 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:38)
-
-
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-tree.c:11)
- by 0x........: main (leak-tree.c:25)
-
-LEAK SUMMARY:
- definitely lost: 48 bytes in 3 blocks.
- indirectly lost: 64 bytes in 4 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 112 bytes in 7 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 224 bytes in 14 blocks.
-malloc/free: 14 allocs, 0 frees, 224 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Modified: trunk/memcheck/tests/leak-tree.vgtest
===================================================================
--- trunk/memcheck/tests/leak-tree.vgtest 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leak-tree.vgtest 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1,2 +1,2 @@
prog: leak-tree
-vgopts: --leak-resolution=high
+vgopts: -q --leak-check=full --leak-resolution=high
Deleted: trunk/memcheck/tests/leakotron.c
===================================================================
--- trunk/memcheck/tests/leakotron.c 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leakotron.c 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1,146 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../memcheck.h"
-#include "leak.h"
-
-/*
- Incompetent memory management
-
- Simulate what happens when trying to manage a dense brancy cyclic
- structure with refcounting.
- */
-
-static long bytes, blocks;
-
-struct node {
- struct node *l, *r;
- int ref;
-};
-
-static void ref(struct node *n)
-{
- if (n)
- n->ref++;
-}
-
-static void unref(struct node *n)
-{
- if (n && --n->ref == 0) {
- bytes -= sizeof(*n);
- blocks--;
- free(n);
- }
-}
-
-static struct node *alloc()
-{
- struct node *n = malloc(sizeof(*n));
- n->l = n->r = NULL;
- n->ref = 0;
-
- bytes += sizeof(*n);
- blocks++;
-
- return n;
-}
-
-static void assign(struct node **np, struct node *n)
-{
- ref(n);
- unref(*np);
-
- *np = n;
-}
-
-static int rrange(int range)
-{
- long long ret = rand() * (long long)range;
-
- return (int)(ret / RAND_MAX);
-}
-
-#define ITER 100000
-#define N 1000
-
-static struct node *nodes[N];
-
-static struct node *mk()
-{
- int idx = rrange(N);
- struct node *n;
-
- /*
- 50% recycle
- 25% alloc new
- 25% return NULL
- */
- if (rand() > RAND_MAX/2) {
- /* recycle existing block */
- n = nodes[idx];
- } else if (rand() > RAND_MAX/2) {
- /* alloc new block */
- n = alloc();
- assign(&n->l, mk());
- assign(&n->r, mk());
- } else {
- /* no block */
- n = NULL;
- }
-
- assign(&nodes[idx], n);
-
- return n;
-}
-
-int main()
-{
- int i;
- long total;
- DECLARE_LEAK_COUNTERS;
-
- /* we require these longs to have same size as a machine word */
- assert(sizeof(long) == sizeof(void*));
-
- /* get a baseline in case the runtime allocated some memory */
- GET_INITIAL_LEAK_COUNTS;
-
- for (i = 0; i < ITER; i++) {
- mk();
-
- if ((i % (ITER/10)) == 0) {
- if (0)
- printf("%ld living blocks, %ld bytes\n",
- blocks, bytes);
- //VALGRIND_DO_LEAK_CHECK;
- }
- }
-
- /* "free all memory" */
- for (i = 0; i < N; i++)
- assign(&nodes[i], NULL);
-
-
- if (0)
- printf("FINISHED: %ld living blocks, %ld bytes\n",
- blocks, bytes);
-
- GET_FINAL_LEAK_COUNTS;
-
- total = L_bytes + D_bytes + R_bytes + S_bytes;
-
- if (0) {
- PRINT_LEAK_COUNTS(stderr);
- }
-
- if (R_bytes != 0)
- printf("FAILED: I freed everything, "
- "but there's still %ld bytes (in %ld blocks) reachable\n",
- R_bytes, R_blocks);
- else if (total != bytes)
- printf("FAILED: I count %ld bytes, leakcheck says %ld\n",
- bytes, total);
- else
- printf("PASS\n");
- return 0;
-}
Deleted: trunk/memcheck/tests/leakotron.stderr.exp
===================================================================
Deleted: trunk/memcheck/tests/leakotron.stdout.exp
===================================================================
--- trunk/memcheck/tests/leakotron.stdout.exp 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leakotron.stdout.exp 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1 +0,0 @@
-PASS
Deleted: trunk/memcheck/tests/leakotron.vgtest
===================================================================
--- trunk/memcheck/tests/leakotron.vgtest 2009-03-12 01:45:05 UTC (rev 9371)
+++ trunk/memcheck/tests/leakotron.vgtest 2009-03-12 03:00:05 UTC (rev 9372)
@@ -1,2 +0,0 @@
-prog: leakotron
-stderr_filter: ../../tests/filter_sink
|
|
From: Nicholas N. <n.n...@gm...> - 2009-03-12 02:38:33
|
On Thu, Mar 12, 2009 at 12:03 PM, <sv...@va...> wrote: > Author: sewardj > Date: 2009-03-12 01:03:27 +0000 (Thu, 12 Mar 2009) > New Revision: 9370 > > Log: > Test fails on Darwin because pulling an allegedly invalid address out > of a hat is a really stupid idea. Fix it to generate an > always-invalid place by first mmaping and then munmapping a page. The commit fixes the stupidity, but the test still fails, right? Nick |
|
From: <sv...@va...> - 2009-03-12 01:45:21
|
Author: sewardj
Date: 2009-03-12 01:45:05 +0000 (Thu, 12 Mar 2009)
New Revision: 9371
Log:
Oops, a minor change that should have been included in r9370.
Modified:
branches/DARWIN/memcheck/tests/signal2.c
Modified: branches/DARWIN/memcheck/tests/signal2.c
===================================================================
--- branches/DARWIN/memcheck/tests/signal2.c 2009-03-12 01:03:27 UTC (rev 9370)
+++ branches/DARWIN/memcheck/tests/signal2.c 2009-03-12 01:45:05 UTC (rev 9371)
@@ -34,7 +34,7 @@
assert(pagesz == 4096 || pagesz == 65536);
void* ptr = mmap(0, pagesz, PROT_READ, MAP_ANON|MAP_PRIVATE, -1, 0);
assert(ptr != (void*)-1);
- int r = munmap(ptr, 4096);
+ int r = munmap(ptr, pagesz);
assert(r == 0);
return ptr;
}
|
|
From: <sv...@va...> - 2009-03-12 01:03:50
|
Author: sewardj
Date: 2009-03-12 01:03:27 +0000 (Thu, 12 Mar 2009)
New Revision: 9370
Log:
Test fails on Darwin because pulling an allegedly invalid address out
of a hat is a really stupid idea. Fix it to generate an
always-invalid place by first mmaping and then munmapping a page.
Modified:
branches/DARWIN/memcheck/tests/signal2.c
Modified: branches/DARWIN/memcheck/tests/signal2.c
===================================================================
--- branches/DARWIN/memcheck/tests/signal2.c 2009-03-12 00:18:46 UTC (rev 9369)
+++ branches/DARWIN/memcheck/tests/signal2.c 2009-03-12 01:03:27 UTC (rev 9370)
@@ -3,18 +3,38 @@
#include <stdlib.h>
#include <signal.h>
-void sig_hdlr ( int signo )
-{
- printf ( "caught sig segv\n" );
- exit(1);
+void sig_hdlr ( int signo ) {
+ printf ( "caught sig segv\n" ); exit(1);
}
+char* get_bad_place ( void );
-int main ( void )
-{
+int main ( void ) {
+ char* badplace;
printf ( "installing sig handler\n" );
signal(SIGSEGV, sig_hdlr);
printf ( "doing bad thing\n" );
- * (int*) 65536 = 0;
+ badplace = get_bad_place();
+ *(int*)badplace = 0;
printf ( "exited normally ?!\n" );
return 0;
}
+
+#include <sys/mman.h>
+#include <assert.h>
+#include <unistd.h>
+
+/* map a page, then unmap it, then return that address. That
+ guarantees to give an address which will fault when accessed,
+ without making any assumptions about the layout of the address
+ space. */
+
+char* get_bad_place ( void )
+{
+ long pagesz = sysconf(_SC_PAGE_SIZE);
+ assert(pagesz == 4096 || pagesz == 65536);
+ void* ptr = mmap(0, pagesz, PROT_READ, MAP_ANON|MAP_PRIVATE, -1, 0);
+ assert(ptr != (void*)-1);
+ int r = munmap(ptr, 4096);
+ assert(r == 0);
+ return ptr;
+}
|