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
(32) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(6) |
2
(7) |
|
3
(12) |
4
(9) |
5
(12) |
6
(9) |
7
(18) |
8
(10) |
9
(17) |
|
10
(15) |
11
(22) |
12
(16) |
13
(18) |
14
(9) |
15
(14) |
16
(18) |
|
17
(24) |
18
(11) |
19
(15) |
20
(29) |
21
(19) |
22
(20) |
23
(9) |
|
24
(25) |
25
(25) |
26
(38) |
27
(22) |
28
(16) |
29
(17) |
|
|
From: <sv...@va...> - 2008-02-24 18:37:07
|
Author: bart
Date: 2008-02-24 18:37:08 +0000 (Sun, 24 Feb 2008)
New Revision: 7448
Log:
Corrected various comments. Removed commented out code. Added code for tracing thread context switches and danger set updating. Fixed memory leak. Danger set is now updated every time a new segment is created instead of only at every context switch, which fixes the bug that no data races were reported for the pth_barrier test program.
Modified:
trunk/exp-drd/drd_thread.c
trunk/exp-drd/drd_thread.h
Modified: trunk/exp-drd/drd_thread.c
===================================================================
--- trunk/exp-drd/drd_thread.c 2008-02-24 18:29:43 UTC (rev 7447)
+++ trunk/exp-drd/drd_thread.c 2008-02-24 18:37:08 UTC (rev 7448)
@@ -78,9 +78,6 @@
static ULong s_context_switch_count;
static ULong s_discard_ordered_segments_count;
-#ifdef OLD_RACE_DETECTION_ALGORITHM
-static ULong s_report_races_count;
-#endif
static ULong s_update_danger_set_count;
static ULong s_danger_set_bitmap_creation_count;
static ULong s_danger_set_bitmap2_creation_count;
@@ -88,10 +85,22 @@
static DrdThreadId s_drd_running_tid = DRD_INVALID_THREADID;
static ThreadInfo s_threadinfo[DRD_N_THREADS];
static struct bitmap* s_danger_set;
+static Bool s_trace_context_switches = False;
+static Bool s_trace_danger_set = False;
// Function definitions.
+void thread_trace_context_switches(const Bool t)
+{
+ s_trace_context_switches = t;
+}
+
+void thread_trace_danger_set(const Bool t)
+{
+ s_trace_danger_set = t;
+}
+
__inline__ Bool IsValidDrdThreadId(const DrdThreadId tid)
{
return (0 <= tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID
@@ -185,9 +194,9 @@
: VG_INVALID_THREADID);
}
-/**
- * Sanity check of the doubly linked list of segments referenced by a ThreadInfo struct.
- * @return True if sane, False if not.
+/** Sanity check of the doubly linked list of segments referenced by a
+ * ThreadInfo struct.
+ * @return True if sane, False if not.
*/
static Bool sane_ThreadInfo(const ThreadInfo* const ti)
{
@@ -224,9 +233,8 @@
return created;
}
-/**
- * Allocate the first segment for a thread. Call this just after
- * pthread_create().
+/** Allocate the first segment for a thread. Call this just after
+ * pthread_create().
*/
DrdThreadId thread_post_create(const ThreadId vg_created)
{
@@ -449,6 +457,13 @@
if (vg_tid != s_vg_running_tid)
{
+ if (s_trace_context_switches
+ && s_drd_running_tid != DRD_INVALID_THREADID)
+ {
+ VG_(message)(Vg_DebugMsg,
+ "Context switch from thread %d to thread %d",
+ s_drd_running_tid, drd_tid);
+ }
s_vg_running_tid = vg_tid;
s_drd_running_tid = drd_tid;
thread_update_danger_set(drd_tid);
@@ -475,11 +490,9 @@
return s_threadinfo[tid].last;
}
-/**
- * Insert a new segment at the end of the segment list.
+/** Append a new segment at the end of the segment list.
*/
-static void thread_append_segment(const DrdThreadId tid,
- Segment* const sg)
+static void thread_append_segment(const DrdThreadId tid, Segment* const sg)
{
tl_assert(0 <= tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
@@ -494,16 +507,15 @@
tl_assert(sane_ThreadInfo(&s_threadinfo[tid]));
}
-/**
- * Remove a segment from the segment list of thread threadid, and free the
- * associated memory.
+/** Remove a segment from the segment list of thread threadid, and free the
+ * associated memory.
*/
-static void thread_discard_segment(const DrdThreadId tid,
- Segment* const sg)
+static void thread_discard_segment(const DrdThreadId tid, Segment* const sg)
{
tl_assert(0 <= tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
tl_assert(sane_ThreadInfo(&s_threadinfo[tid]));
+
if (sg->prev)
sg->prev->next = sg->next;
if (sg->next)
@@ -542,10 +554,7 @@
if (latest_sg)
{
if (first)
- {
- vc_cleanup(vc);
- vc_copy(vc, &latest_sg->vc);
- }
+ vc_assign(vc, &latest_sg->vc);
else
vc_min(vc, &latest_sg->vc);
first = False;
@@ -566,10 +575,7 @@
if (latest_sg)
{
if (first)
- {
- vc_cleanup(vc);
- vc_copy(vc, &latest_sg->vc);
- }
+ vc_assign(vc, &latest_sg->vc);
else
vc_combine(vc, &latest_sg->vc);
first = False;
@@ -618,11 +624,6 @@
sg && (sg_next = sg->next) && vc_lte(&sg->vc, &thread_vc_min);
sg = sg_next)
{
-#if 0
- VG_(printf)("Discarding a segment of thread %d: ", i);
- vc_print(&sg->vc);
- VG_(printf)("\n");
-#endif
thread_discard_segment(i, sg);
}
}
@@ -635,25 +636,27 @@
*/
void thread_new_segment(const DrdThreadId tid)
{
- //static int s_calls_since_last_discard = 0;
Segment* sg;
tl_assert(0 <= tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
-#ifdef OLD_RACE_DETECTION_ALGORITHM
- if (s_threadinfo[tid].last)
- {
- thread_report_races_segment(tid, s_threadinfo[tid].last);
- }
-#endif
-
sg = sg_new(tid, tid);
thread_append_segment(tid, sg);
thread_discard_ordered_segments();
+
+ if (tid == s_drd_running_tid)
+ {
+ /* Every change in the vector clock of the current thread may cause */
+ /* segments that were previously ordered to this thread to become */
+ /* unordered. Hence, recalculate the danger set if the vector clock */
+ /* of the current thread is updated. */
+ thread_update_danger_set(tid);
+ }
}
+/** Call this function after thread 'joiner' joined thread 'joinee'. */
void thread_combine_vc(DrdThreadId joiner, DrdThreadId joinee)
{
tl_assert(joiner != joinee);
@@ -672,6 +675,10 @@
}
}
+/** Call this function after thread 'tid' had to wait because of thread
+ * synchronization until the memory accesses in the segment with vector clock
+ * 'vc' finished.
+ */
void thread_combine_vc2(DrdThreadId tid, const VectorClock* const vc)
{
tl_assert(0 <= tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID);
@@ -681,11 +688,15 @@
thread_discard_ordered_segments();
}
+/** Call this function whenever a thread is no longer using the memory
+ * [ a1, a2 [, e.g. because of a call to free() or a stack pointer
+ * increase.
+ */
void thread_stop_using_mem(const Addr a1, const Addr a2)
{
DrdThreadId other_user = DRD_INVALID_THREADID;
- /* For all threads, mark the range [a,a+size[ as no longer in use. */
+ /* For all threads, mark the range [ a1, a2 [ as no longer in use. */
unsigned i;
for (i = 0; i < sizeof(s_threadinfo) / sizeof(s_threadinfo[0]); i++)
@@ -703,20 +714,11 @@
}
}
- /* If any other thread had accessed memory in [a,a+size[, update the */
+ /* If any other thread had accessed memory in [ a1, a2 [, update the */
/* danger set. */
if (other_user != DRD_INVALID_THREADID
&& bm_has_any_access(s_danger_set, a1, a2))
{
-#if 0
- VG_(message)(Vg_DebugMsg,
- "recalculating danger set because thread %d / %d stopped"
- " using memory at 0x%x sz %d",
- other_user,
- s_threadinfo[other_user].vg_threadid,
- a1,
- a2 - a1);
-#endif
thread_update_danger_set(thread_get_running_tid());
}
}
@@ -797,101 +799,6 @@
}
}
-#ifdef OLD_RACE_DETECTION_ALGORITHM
-void thread_report_races(const DrdThreadId threadid)
-{
- Segment* p;
-
- s_report_races_count++;
-
- tl_assert(0 <= threadid && threadid < DRD_N_THREADS
- && threadid != DRD_INVALID_THREADID);
-
- for (p = s_threadinfo[threadid].first; p; p = p->next)
- {
- thread_report_races_segment(threadid, p);
- }
-}
-
-/**
- * Report all data races for segment p of thread threadid against other
- * threads.
- */
-void thread_report_races_segment(const DrdThreadId threadid,
- Segment* const p)
-{
- unsigned i;
-
- tl_assert(0 <= threadid && threadid < DRD_N_THREADS
- && threadid != DRD_INVALID_THREADID);
- tl_assert(p);
-
- for (i = 0; i < sizeof(s_threadinfo) / sizeof(s_threadinfo[0]); i++)
- {
- if (i != threadid)
- {
- Segment* q;
- for (q = s_threadinfo[i].last; q; q = q->prev)
- {
-#if 0
- char msg[256];
- VG_(snprintf)(msg, sizeof(msg), "Examining thread %d (vc ", threadid);
- vc_snprint(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg),
- &p->vc);
- VG_(snprintf)(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg),
- ") versus thread %d (vc ", i);
- vc_snprint(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg),
- &q->vc);
- VG_(snprintf)(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg),
- ") %d %d",
- vc_lte(&p->vc, &q->vc), vc_lte(&q->vc, &p->vc));
- VG_(message)(Vg_DebugMsg, "%s", msg);
-#endif
- // Since q iterates over the segments of thread i in order of
- // decreasing vector clocks, if q->vc <= p->vc, then
- // q->next->vc <= p->vc will also hold. Hence, break out of the
- // loop once this condition is met.
- if (vc_lte(&q->vc, &p->vc))
- break;
- if (! vc_lte(&p->vc, &q->vc))
- {
- if (bm_has_races(p->bm, q->bm))
- {
- VG_(message)(Vg_UserMsg, "----------------------------------------------------------------------");
- tl_assert(p->stacktrace);
- show_call_stack(threadid, "1st segment start",
- p->stacktrace);
- show_call_stack(threadid, "1st segment end",
- p->next ? p->next->stacktrace : 0);
- tl_assert(q->stacktrace);
- show_call_stack(i, "2nd segment start",
- q->stacktrace);
- show_call_stack(i, "2nd segment end",
- q->next ? q->next->stacktrace : 0);
- bm_report_races(threadid, i, p->bm, q->bm);
- }
- }
- }
- }
- }
-}
-
-/**
- * Report all detected data races for all threads.
- */
-void thread_report_all_races(void)
-{
- unsigned i;
-
- for (i = 0; i < sizeof(s_threadinfo) / sizeof(s_threadinfo[0]); i++)
- {
- if (s_threadinfo[i].last)
- {
- thread_report_races(i);
- }
- }
-}
-#else
static void
thread_report_conflicting_segments_segment(const DrdThreadId tid,
const Addr addr,
@@ -953,47 +860,60 @@
}
}
}
-#endif
-/**
- * Compute a bitmap that represents the union of all memory accesses of all
- * segments that are unordered to the current segment of the thread tid.
+/** Compute a bitmap that represents the union of all memory accesses of all
+ * segments that are unordered to the current segment of the thread tid.
*/
static void thread_update_danger_set(const DrdThreadId tid)
{
Segment* p;
- tl_assert(0 <= tid && tid < DRD_N_THREADS
- && tid != DRD_INVALID_THREADID);
+ tl_assert(0 <= tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID);
tl_assert(tid == s_drd_running_tid);
s_update_danger_set_count++;
s_danger_set_bitmap_creation_count -= bm_get_bitmap_creation_count();
s_danger_set_bitmap2_creation_count -= bm_get_bitmap2_creation_count();
-#if 0
if (s_danger_set)
{
- bm_delete(s_danger_set);
- s_danger_set = 0;
- }
- s_danger_set = bm_new();
-#else
- // Marginally faster than the above code.
- if (s_danger_set)
- {
bm_clear_all(s_danger_set);
}
else
{
s_danger_set = bm_new();
}
-#endif
+ if (s_trace_danger_set)
+ {
+ char msg[256];
+
+ VG_(snprintf)(msg, sizeof(msg),
+ "computing danger set for thread %d with vc ",
+ tid);
+ vc_snprint(msg + VG_(strlen)(msg),
+ sizeof(msg) - VG_(strlen)(msg),
+ &s_threadinfo[tid].last->vc);
+ VG_(message)(Vg_DebugMsg, "%s", msg);
+ }
+
for (p = s_threadinfo[tid].first; p; p = p->next)
{
unsigned j;
+ if (s_trace_danger_set)
+ {
+ char msg[256];
+
+ VG_(snprintf)(msg, sizeof(msg),
+ "danger set: thread [%d] at vc ",
+ tid);
+ vc_snprint(msg + VG_(strlen)(msg),
+ sizeof(msg) - VG_(strlen)(msg),
+ &p->vc);
+ VG_(message)(Vg_DebugMsg, "%s", msg);
+ }
+
for (j = 0; j < sizeof(s_threadinfo) / sizeof(s_threadinfo[0]); j++)
{
if (IsValidDrdThreadId(j))
@@ -1002,9 +922,31 @@
if (j != tid && q != 0
&& ! vc_lte(&q->vc, &p->vc) && ! vc_lte(&p->vc, &q->vc))
{
+ if (s_trace_danger_set)
+ {
+ char msg[256];
+ VG_(snprintf)(msg, sizeof(msg),
+ "danger set: [%d] merging segment ", j);
+ vc_snprint(msg + VG_(strlen)(msg),
+ sizeof(msg) - VG_(strlen)(msg),
+ &q->vc);
+ VG_(message)(Vg_DebugMsg, "%s", msg);
+ }
bm_merge2(s_danger_set, q->bm);
}
-
+ else
+ {
+ if (s_trace_danger_set)
+ {
+ char msg[256];
+ VG_(snprintf)(msg, sizeof(msg),
+ "danger set: [%d] ignoring segment ", j);
+ vc_snprint(msg + VG_(strlen)(msg),
+ sizeof(msg) - VG_(strlen)(msg),
+ &q->vc);
+ VG_(message)(Vg_DebugMsg, "%s", msg);
+ }
+ }
}
}
@@ -1032,11 +974,12 @@
s_danger_set_bitmap_creation_count += bm_get_bitmap_creation_count();
s_danger_set_bitmap2_creation_count += bm_get_bitmap2_creation_count();
-#if 0
- VG_(message)(Vg_DebugMsg, "[%d] new danger set:", tid);
- bm_print(s_danger_set);
- VG_(message)(Vg_DebugMsg, "[%d] end of new danger set.", tid);
-#endif
+ if (0 && s_trace_danger_set)
+ {
+ VG_(message)(Vg_DebugMsg, "[%d] new danger set:", tid);
+ bm_print(s_danger_set);
+ VG_(message)(Vg_DebugMsg, "[%d] end of new danger set.", tid);
+ }
}
Bool thread_conflicting_access(const Addr a,
@@ -1053,13 +996,6 @@
return s_context_switch_count;
}
-#ifdef OLD_RACE_DETECTION_ALGORITHM
-ULong thread_get_report_races_count(void)
-{
- return s_report_races_count;
-}
-#endif
-
ULong thread_get_discard_ordered_segments_count(void)
{
return s_discard_ordered_segments_count;
Modified: trunk/exp-drd/drd_thread.h
===================================================================
--- trunk/exp-drd/drd_thread.h 2008-02-24 18:29:43 UTC (rev 7447)
+++ trunk/exp-drd/drd_thread.h 2008-02-24 18:37:08 UTC (rev 7448)
@@ -45,6 +45,8 @@
typedef UWord PThreadId;
+void thread_trace_context_switches(const Bool t);
+void thread_trace_danger_set(const Bool t);
Bool IsValidDrdThreadId(const DrdThreadId tid);
DrdThreadId VgThreadIdToDrdThreadId(const ThreadId tid);
|
|
From: <sv...@va...> - 2008-02-24 18:29:39
|
Author: bart
Date: 2008-02-24 18:29:43 +0000 (Sun, 24 Feb 2008)
New Revision: 7447
Log:
Fixed a memory leak.
Modified:
trunk/exp-drd/drd_semaphore.c
Modified: trunk/exp-drd/drd_semaphore.c
===================================================================
--- trunk/exp-drd/drd_semaphore.c 2008-02-24 18:29:10 UTC (rev 7446)
+++ trunk/exp-drd/drd_semaphore.c 2008-02-24 18:29:43 UTC (rev 7447)
@@ -157,7 +157,7 @@
{
p->last_sem_post_tid = tid;
thread_new_segment(tid);
- vc_copy(&p->vc, thread_get_vc(tid));
+ vc_assign(&p->vc, thread_get_vc(tid));
}
}
|
|
From: <sv...@va...> - 2008-02-24 18:29:06
|
Author: bart Date: 2008-02-24 18:29:10 +0000 (Sun, 24 Feb 2008) New Revision: 7446 Log: Cleanup: moved const keyword in front of datatype. Modified: trunk/exp-drd/drd_segment.h Modified: trunk/exp-drd/drd_segment.h =================================================================== --- trunk/exp-drd/drd_segment.h 2008-02-24 18:28:19 UTC (rev 7445) +++ trunk/exp-drd/drd_segment.h 2008-02-24 18:29:10 UTC (rev 7446) @@ -48,14 +48,14 @@ } Segment; void sg_init(Segment* const sg, - ThreadId const creator, - ThreadId const created); + const ThreadId creator, + const ThreadId created); void sg_cleanup(Segment* const sg); -Segment* sg_new(ThreadId const creator, ThreadId const created); +Segment* sg_new(const ThreadId creator, const ThreadId created); void sg_delete(Segment* const sg); void sg_print(const Segment* const sg); Bool sg_get_trace(void); -void sg_set_trace(Bool const trace_segment); +void sg_set_trace(const Bool trace_segment); ULong sg_get_segments_created_count(void); ULong sg_get_max_segments_alive_count(void); |
|
From: <sv...@va...> - 2008-02-24 18:28:16
|
Author: bart
Date: 2008-02-24 18:28:19 +0000 (Sun, 24 Feb 2008)
New Revision: 7445
Log:
Cleanup: removed commented out code.
Modified:
trunk/exp-drd/drd_bitmap.c
Modified: trunk/exp-drd/drd_bitmap.c
===================================================================
--- trunk/exp-drd/drd_bitmap.c 2008-02-24 18:27:11 UTC (rev 7444)
+++ trunk/exp-drd/drd_bitmap.c 2008-02-24 18:28:19 UTC (rev 7445)
@@ -336,7 +336,6 @@
}
}
-#if 1
// New and fast implementation.
void bm_clear(const struct bitmap* const bm,
const Addr a1,
@@ -391,44 +390,7 @@
}
}
}
-#else
-// Old and slow implementation
-void bm_clear(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2)
-{
- Addr b, b_next, c;
- tl_assert(bm);
- tl_assert(a1);
- tl_assert(a1 <= a2);
-
- for (b = a1; b < a2; b = b_next)
- {
- struct bitmap2* const p2 = bm_lookup(bm, b);
-
- b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
- if (b_next > a2)
- {
- b_next = a2;
- }
-
- if (p2)
- {
- for (c = b; c < b_next; c++)
- {
- const UWord c0 = c & ADDR0_MASK;
-
- p2->bm1.bm0_r[c0 / (8*sizeof(UWord))]
- &= ~(1UL << (c0 % (8*sizeof(UWord))));
- p2->bm1.bm0_w[c0 / (8*sizeof(UWord))]
- &= ~(1UL << (c0 % (8*sizeof(UWord))));
- }
- }
- }
-}
-#endif
-
static
__inline__
UWord bm_has_conflict_with_1(const struct bitmap* const bm,
@@ -568,96 +530,6 @@
return 0;
}
-#ifdef OLD_RACE_DETECTION_ALGORITHM
-/**
- * Report RW / WR / WW patterns between lhs and rhs.
- * @param tid1 Thread ID of lhs.
- * @param tid2 Thread ID of rhs.
- * @param lhs First bitmap.
- * @param rhs Bitmap to be compared with lhs.
- * @return Number of reported ranges with data races.
- */
-void bm_report_races(const ThreadId tid1,
- const ThreadId tid2,
- const struct bitmap* const lhs,
- const struct bitmap* const rhs)
-{
- Addr range_begin = 0;
- Addr range_end = 0;
- UWord range_access = 0;
-
- VG_(message)(Vg_UserMsg, "Data addresses accessed by both segments:");
-
- VG_(OSetGen_ResetIter)(lhs->oset);
- VG_(OSetGen_ResetIter)(rhs->oset);
-
- for (;;)
- {
- const struct bitmap2* bm2l = VG_(OSetGen_Next)(lhs->oset);
- const struct bitmap2* bm2r = VG_(OSetGen_Next)(rhs->oset);
- const struct bitmap1* bm1l;
- const struct bitmap1* bm1r;
- unsigned k;
-
- while (bm2l && bm2r && bm2l->addr != bm2r->addr)
- {
- if (bm2l->addr < bm2r->addr)
- bm2l = VG_(OSetGen_Next)(lhs->oset);
- else
- bm2r = VG_(OSetGen_Next)(rhs->oset);
- }
- if (bm2l == 0 || bm2r == 0)
- break;
-
- bm1l = &bm2l->bm1;
- bm1r = &bm2r->bm1;
-
- for (k = 0; k < BITMAP1_UWORD_COUNT; k++)
- {
- unsigned b;
- for (b = 0; b < BITS_PER_UWORD; b++)
- {
- UWord const access
- = ((bm1l->bm0_r[k] & bm0_mask(b)) ? LHS_R : 0)
- | ((bm1l->bm0_w[k] & bm0_mask(b)) ? LHS_W : 0)
- | ((bm1r->bm0_r[k] & bm0_mask(b)) ? RHS_R : 0)
- | ((bm1r->bm0_w[k] & bm0_mask(b)) ? RHS_W : 0);
- Addr const a = MAKE_ADDRESS(bm2l->addr, k * BITS_PER_UWORD | b);
- if (access == range_access)
- range_end = a + 1;
- else
- {
- tl_assert(range_begin < range_end);
- if (HAS_RACE(range_access)
- && ! drd_is_suppressed(range_begin, range_end))
- {
- DataRaceInfo dri;
- dri.tid1 = tid1;
- dri.tid2 = tid2;
- dri.range_begin = range_begin;
- dri.range_end = range_end;
- dri.range_access = range_access;
- tl_assert(dri.range_begin < dri.range_end);
-#if 0
- VG_(maybe_record_error)(tid1,
- DataRaceErr,
- VG_(get_IP)(tid1), // where
- "data race",
- &dri);
-#else
- drd_report_data_race(&dri);
-#endif
- }
- range_access = access;
- range_begin = a;
- range_end = a + 1;
- }
- }
- }
- }
-}
-#endif
-
void bm_print(const struct bitmap* const bm)
{
struct bitmap2* bm2;
|
|
From: <sv...@va...> - 2008-02-24 18:27:16
|
Author: bart Date: 2008-02-24 18:27:11 +0000 (Sun, 24 Feb 2008) New Revision: 7444 Log: Minor change: renamed one variable. Modified: trunk/exp-drd/drd_mutex.h Modified: trunk/exp-drd/drd_mutex.h =================================================================== --- trunk/exp-drd/drd_mutex.h 2008-02-24 18:26:46 UTC (rev 7443) +++ trunk/exp-drd/drd_mutex.h 2008-02-24 18:27:11 UTC (rev 7444) @@ -52,7 +52,7 @@ Bool mutex_is_locked_by(const Addr mutex, const DrdThreadId tid); const VectorClock* mutex_get_last_vc(const Addr mutex); int mutex_get_recursion_count(const Addr mutex); -void mutex_thread_delete(const DrdThreadId threadid); +void mutex_thread_delete(const DrdThreadId tid); void mutex_stop_using_mem(const Addr a1, const Addr a2); ULong get_mutex_lock_count(void); |
|
From: <sv...@va...> - 2008-02-24 18:26:42
|
Author: bart
Date: 2008-02-24 18:26:46 +0000 (Sun, 24 Feb 2008)
New Revision: 7443
Log:
Added vc_assign() function.
Modified:
trunk/exp-drd/drd_vc.c
trunk/exp-drd/drd_vc.h
Modified: trunk/exp-drd/drd_vc.c
===================================================================
--- trunk/exp-drd/drd_vc.c 2008-02-24 18:25:43 UTC (rev 7442)
+++ trunk/exp-drd/drd_vc.c 2008-02-24 18:26:46 UTC (rev 7443)
@@ -58,15 +58,21 @@
vc_reserve(vc, 0);
}
-/**
- * Copy constructor -- initializes 'new'.
- */
+/** Copy constructor -- initializes *new. */
void vc_copy(VectorClock* const new,
const VectorClock* const rhs)
{
vc_init(new, rhs->vc, rhs->size);
}
+/** Assignment operator -- *lhs is already a valid vector clock. */
+void vc_assign(VectorClock* const lhs,
+ const VectorClock* const rhs)
+{
+ vc_cleanup(lhs);
+ vc_copy(lhs, rhs);
+}
+
void vc_increment(VectorClock* const vc, ThreadId const threadid)
{
unsigned i;
Modified: trunk/exp-drd/drd_vc.h
===================================================================
--- trunk/exp-drd/drd_vc.h 2008-02-24 18:25:43 UTC (rev 7442)
+++ trunk/exp-drd/drd_vc.h 2008-02-24 18:26:46 UTC (rev 7443)
@@ -67,6 +67,8 @@
void vc_cleanup(VectorClock* const vc);
void vc_copy(VectorClock* const new,
const VectorClock* const rhs);
+void vc_assign(VectorClock* const lhs,
+ const VectorClock* const rhs);
void vc_increment(VectorClock* const vc, ThreadId const threadid);
Bool vc_lte(const VectorClock* const vc1,
const VectorClock* const vc2);
|
|
From: <sv...@va...> - 2008-02-24 18:25:40
|
Author: bart
Date: 2008-02-24 18:25:43 +0000 (Sun, 24 Feb 2008)
New Revision: 7442
Log:
Cleanup: removed old data race detection algorithm implementation.
Modified:
trunk/exp-drd/drd_error.c
trunk/exp-drd/drd_error.h
Modified: trunk/exp-drd/drd_error.c
===================================================================
--- trunk/exp-drd/drd_error.c 2008-02-24 18:22:37 UTC (rev 7441)
+++ trunk/exp-drd/drd_error.c 2008-02-24 18:25:43 UTC (rev 7442)
@@ -217,36 +217,6 @@
return buf;
}
-#ifdef OLD_RACE_DETECTION_ALGORITHM
-void drd_report_data_race(const DataRaceInfo* const dri)
-{
- AddrInfo ai;
- Char descr[256];
-
- tl_assert(dri);
- tl_assert(dri->range_begin < dri->range_end);
- describe_addr_text(dri->range_begin, dri->range_end - dri->range_begin,
- &ai, descr, sizeof(descr));
- VG_(message)(Vg_UserMsg,
- "0x%08lx sz %ld %c %c (%s)",
- dri->range_begin,
- dri->range_end - dri->range_begin,
- dri->range_access & LHS_W ? 'W' : 'R',
- dri->range_access & RHS_W ? 'W' : 'R',
- descr);
- if (ai.akind == eMallocd && ai.lastchange)
- {
- VG_(message)(Vg_UserMsg, "Allocation context:");
- VG_(pp_ExeContext)(ai.lastchange);
- }
- // Note: for stack and heap variables suppression should be
- // stopped automatically as soon as the specified memory
- // range has been freed.
- tl_assert(dri->range_begin < dri->range_end);
- drd_start_suppression(dri->range_begin, dri->range_end, "detected race");
-}
-#endif
-
static
void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri)
{
Modified: trunk/exp-drd/drd_error.h
===================================================================
--- trunk/exp-drd/drd_error.h 2008-02-24 18:22:37 UTC (rev 7441)
+++ trunk/exp-drd/drd_error.h 2008-02-24 18:25:43 UTC (rev 7442)
@@ -72,18 +72,7 @@
}
AddrInfo;
-#ifdef OLD_RACE_DETECTION_ALGORITHM
-/* Records info about a data race. */
typedef struct {
- ThreadId tid1; // Thread ID of first thread involved in the data race.
- ThreadId tid2; // Thread ID of second thread involved in the data race.
- Addr range_begin; // Start address of range involved.
- Addr range_end; // Last address (exclusive) of range involved.
- UInt range_access; // How the range was accessed (LHS_[RW] | RHS_[RW]).
-} DataRaceInfo;
-#endif
-
-typedef struct {
ThreadId tid; // Thread ID of the running thread.
Addr addr; // Conflicting address in current thread.
SizeT size; // Size in bytes of conflicting operation.
@@ -108,10 +97,6 @@
void describe_addr(Addr const a, SizeT const len, AddrInfo* const ai);
Char* describe_addr_text(Addr const a, SizeT const len, AddrInfo* const ai,
Char* const buf, UInt const n_buf);
-#ifdef OLD_RACE_DETECTION_ALGORITHM
-void drd_report_data_race(const DataRaceInfo* const dri);
-#endif
-//void drd_report_data_race2(const DataRaceErrInfo* const dri);
void drd_register_error_handlers(void);
|
|
From: <sv...@va...> - 2008-02-24 18:22:35
|
Author: bart
Date: 2008-02-24 18:22:37 +0000 (Sun, 24 Feb 2008)
New Revision: 7441
Log:
Fixed a memory leak and renamed one variable.
Modified:
trunk/exp-drd/drd_mutex.c
Modified: trunk/exp-drd/drd_mutex.c
===================================================================
--- trunk/exp-drd/drd_mutex.c 2008-02-24 18:21:12 UTC (rev 7440)
+++ trunk/exp-drd/drd_mutex.c 2008-02-24 18:22:37 UTC (rev 7441)
@@ -332,7 +332,7 @@
/* This pthread_mutex_unlock() call really unlocks the mutex. Save the */
/* current vector clock of the thread such that it is available when */
/* this mutex is locked again. */
- vc_copy(&p->vc, vc);
+ vc_assign(&p->vc, vc);
thread_new_segment(drd_tid);
}
@@ -385,18 +385,18 @@
}
/**
- * Call this function when thread threadid stops to exist, such that the
+ * Call this function when thread tid stops to exist, such that the
* "last owner" field can be cleared if it still refers to that thread.
* TO DO: print an error message if a thread exits while it still has some
* mutexes locked.
*/
-void mutex_thread_delete(const DrdThreadId threadid)
+void mutex_thread_delete(const DrdThreadId tid)
{
int i;
for (i = 0; i < sizeof(s_mutex)/sizeof(s_mutex[0]); i++)
{
struct mutex_info* const p = &s_mutex[i];
- if (p->mutex && p->owner == threadid)
+ if (p->mutex && p->owner == tid)
{
p->owner = VG_INVALID_THREADID;
}
|
|
From: <sv...@va...> - 2008-02-24 18:21:12
|
Author: bart
Date: 2008-02-24 18:21:12 +0000 (Sun, 24 Feb 2008)
New Revision: 7440
Log:
Added more debugging output.
Modified:
trunk/exp-drd/drd_segment.c
Modified: trunk/exp-drd/drd_segment.c
===================================================================
--- trunk/exp-drd/drd_segment.c 2008-02-24 18:19:09 UTC (rev 7439)
+++ trunk/exp-drd/drd_segment.c 2008-02-24 18:21:12 UTC (rev 7440)
@@ -114,6 +114,18 @@
void sg_delete(Segment* const sg)
{
+#if 1
+ if (sg_get_trace())
+ {
+ char msg[256];
+ VG_(snprintf)(msg, sizeof(msg),
+ "Discarding the segment with vector clock ");
+ vc_snprint(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg),
+ &sg->vc);
+ VG_(message)(Vg_DebugMsg, "%s", msg);
+ }
+#endif
+
s_segments_alive_count--;
tl_assert(sg);
|
|
From: <sv...@va...> - 2008-02-24 18:19:05
|
Author: bart Date: 2008-02-24 18:19:09 +0000 (Sun, 24 Feb 2008) New Revision: 7439 Log: Fixed output. Modified: trunk/exp-drd/tests/pth_barrier.stderr.exp Modified: trunk/exp-drd/tests/pth_barrier.stderr.exp =================================================================== --- trunk/exp-drd/tests/pth_barrier.stderr.exp 2008-02-24 18:18:23 UTC (rev 7438) +++ trunk/exp-drd/tests/pth_barrier.stderr.exp 2008-02-24 18:19:09 UTC (rev 7439) @@ -1,3 +1,23 @@ +Thread 2: +Conflicting store by thread 2 at 0x........ size 4 + at 0x........: threadfunc (pth_barrier.c:?) + by 0x........: vg_thread_wrapper (drd_intercepts.c:?) + by 0x........: start_thread (in libpthread-?.?.so) + by 0x........: clone (in /...libc...) +Allocation context: unknown +Other segment start (thread 3) + at 0x........: pthread_barrier_wait (drd_intercepts.c:?) + by 0x........: threadfunc (pth_barrier.c:?) + by 0x........: vg_thread_wrapper (drd_intercepts.c:?) + by 0x........: start_thread (in libpthread-?.?.so) + by 0x........: clone (in /...libc...) +Other segment end (thread 3) + at 0x........: __lll_mutex_lock_wait (in libpthread-?.?.so) + by 0x........: pthread_barrier_wait (in libpthread-?.?.so) + by 0x........: threadfunc (pth_barrier.c:?) + by 0x........: vg_thread_wrapper (drd_intercepts.c:?) + by 0x........: start_thread (in libpthread-?.?.so) + by 0x........: clone (in /...libc...) -ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) |
|
From: <sv...@va...> - 2008-02-24 18:18:19
|
Author: bart
Date: 2008-02-24 18:18:23 +0000 (Sun, 24 Feb 2008)
New Revision: 7438
Log:
Various minor changes.
Modified:
trunk/exp-drd/tests/pth_barrier.c
Modified: trunk/exp-drd/tests/pth_barrier.c
===================================================================
--- trunk/exp-drd/tests/pth_barrier.c 2008-02-24 18:16:56 UTC (rev 7437)
+++ trunk/exp-drd/tests/pth_barrier.c 2008-02-24 18:18:23 UTC (rev 7438)
@@ -39,6 +39,8 @@
/* Function definitions. */
/*************************/
+/** Single thread, which touches p->iterations elements of array p->array.
+ * Each modification of an element of p->array is a data race. */
static void* threadfunc(struct threadinfo* p)
{
int i;
@@ -58,7 +60,7 @@
return 0;
}
-/** Multithreaded Gauss-Jordan algorithm. */
+/** Actual test, consisting of nthread threads. */
static void barriers_and_races(const int nthread, const int iterations)
{
int i;
@@ -69,6 +71,9 @@
t = malloc(nthread * sizeof(struct threadinfo));
array = malloc(iterations * sizeof(array[0]));
+ if (! s_silent)
+ printf("&array[0] = %p\n", array);
+
pthread_barrier_init(&b, 0, nthread);
for (i = 0; i < nthread; i++)
@@ -95,9 +100,9 @@
int nthread;
int iterations;
- nthread = (argc > 1) ? atoi(argv[1]) : 2;
+ nthread = (argc > 1) ? atoi(argv[1]) : 2;
iterations = (argc > 2) ? atoi(argv[2]) : 3;
- s_silent = (argc > 3) ? atoi(argv[3]) : 0;
+ s_silent = (argc > 3) ? atoi(argv[3]) : 0;
barriers_and_races(nthread, iterations);
|
|
From: <sv...@va...> - 2008-02-24 18:16:54
|
Author: bart Date: 2008-02-24 18:16:56 +0000 (Sun, 24 Feb 2008) New Revision: 7437 Log: Whitespace-only change. Modified: trunk/exp-drd/tests/matinv.c Modified: trunk/exp-drd/tests/matinv.c =================================================================== --- trunk/exp-drd/tests/matinv.c 2008-02-23 19:04:44 UTC (rev 7436) +++ trunk/exp-drd/tests/matinv.c 2008-02-24 18:16:56 UTC (rev 7437) @@ -313,8 +313,8 @@ double ratio; matrix_size = (argc > 1) ? atoi(argv[1]) : 3; - s_nthread = (argc > 2) ? atoi(argv[2]) : 3; - silent = (argc > 3) ? atoi(argv[3]) : 0; + s_nthread = (argc > 2) ? atoi(argv[2]) : 3; + silent = (argc > 3) ? atoi(argv[3]) : 0; eps = epsilon(); a = new_matrix(matrix_size, matrix_size); |
|
From: Tom H. <th...@cy...> - 2008-02-24 05:14:43
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2008-02-24 03:15:15 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 338 tests, 80 stderr failures, 1 stdout failure, 29 post failures == memcheck/tests/addressable (stderr) memcheck/tests/badjump (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-pool-0 (stderr) memcheck/tests/leak-pool-1 (stderr) memcheck/tests/leak-pool-2 (stderr) memcheck/tests/leak-pool-3 (stderr) memcheck/tests/leak-pool-4 (stderr) memcheck/tests/leak-pool-5 (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/lsframe1 (stderr) memcheck/tests/lsframe2 (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/noisy_child (stderr) memcheck/tests/partial_load_dflt (stderr) memcheck/tests/partial_load_ok (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/x86/bug152022 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/x86/xor-undef-x86 (stderr) memcheck/tests/xml1 (stderr) massif/tests/alloc-fns-A (post) massif/tests/alloc-fns-B (post) massif/tests/basic (post) massif/tests/basic2 (post) massif/tests/big-alloc (post) massif/tests/culling1 (stderr) massif/tests/culling2 (stderr) massif/tests/custom_alloc (post) massif/tests/deep-A (post) massif/tests/deep-B (stderr) massif/tests/deep-B (post) massif/tests/deep-C (stderr) massif/tests/deep-C (post) massif/tests/deep-D (post) massif/tests/ignoring (post) massif/tests/insig (post) massif/tests/long-names (post) massif/tests/long-time (post) massif/tests/new-cpp (post) massif/tests/null (post) massif/tests/one (post) massif/tests/overloaded-new (post) massif/tests/peak (post) massif/tests/peak2 (stderr) massif/tests/peak2 (post) massif/tests/realloc (stderr) massif/tests/realloc (post) massif/tests/thresholds_0_0 (post) massif/tests/thresholds_0_10 (post) massif/tests/thresholds_10_0 (post) massif/tests/thresholds_10_10 (post) massif/tests/thresholds_5_0 (post) massif/tests/thresholds_5_10 (post) massif/tests/zero1 (post) massif/tests/zero2 (post) none/tests/blockfault (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/hg06_readshared (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc02_simple_tls (stderr) helgrind/tests/tc03_re_excl (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc12_rwl_trivial (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tc24_nonzero_sem (stderr) exp-drd/tests/fp_race (stderr) exp-drd/tests/fp_race2 (stderr) exp-drd/tests/matinv (stderr) exp-drd/tests/pth_barrier (stderr) exp-drd/tests/pth_broadcast (stderr) exp-drd/tests/pth_cond_race (stderr) exp-drd/tests/pth_cond_race2 (stderr) exp-drd/tests/pth_create_chain (stderr) exp-drd/tests/pth_detached (stderr) exp-drd/tests/pth_detached2 (stderr) exp-drd/tests/sem_as_mutex (stderr) exp-drd/tests/sem_as_mutex2 (stderr) exp-drd/tests/sigalrm (stderr) exp-drd/tests/tc17_sembar (stderr) exp-drd/tests/tc18_semabuse (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-24 04:13:32
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2008-02-24 03:05:09 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 372 tests, 7 stderr failures, 2 stdout failures, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-24 03:54:15
|
Nightly build on aston ( x86_64, Fedora Core 5 ) started at 2008-02-24 03:20:07 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 378 tests, 8 stderr failures, 1 stdout failure, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/blockfault (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-24 03:48:08
|
Nightly build on trojan ( x86_64, Fedora Core 6 ) started at 2008-02-24 03:25:19 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 376 tests, 6 stderr failures, 5 stdout failures, 0 post failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/bug133694 (stdout) memcheck/tests/x86/bug133694 (stderr) memcheck/tests/x86/scalar (stderr) none/tests/cmdline1 (stdout) none/tests/cmdline2 (stdout) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-24 03:28:01
|
Nightly build on dellow ( x86_64, Fedora 8 ) started at 2008-02-24 03:10:03 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 372 tests, 8 stderr failures, 2 stdout failures, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-24 03:16:27
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2008-02-24 03:00:02 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 378 tests, 29 stderr failures, 3 stdout failures, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/insn_ssse3 (stdout) none/tests/amd64/insn_ssse3 (stderr) none/tests/amd64/ssse3_misaligned (stderr) none/tests/blockfault (stderr) none/tests/fdleak_fcntl (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/x86/insn_ssse3 (stdout) none/tests/x86/insn_ssse3 (stderr) none/tests/x86/ssse3_misaligned (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) |
|
From: <sv...@va...> - 2008-02-23 19:04:42
|
Author: bart
Date: 2008-02-23 19:04:44 +0000 (Sat, 23 Feb 2008)
New Revision: 7436
Log:
Added const keyword to second argument of VG_(OSetGen_Remove)().
Modified:
trunk/coregrind/m_oset.c
trunk/include/pub_tool_oset.h
Modified: trunk/coregrind/m_oset.c
===================================================================
--- trunk/coregrind/m_oset.c 2008-02-23 11:57:51 UTC (rev 7435)
+++ trunk/coregrind/m_oset.c 2008-02-23 19:04:44 UTC (rev 7436)
@@ -684,7 +684,7 @@
}
// Remove and return the element matching the key 'k', or NULL if not present.
-void* VG_(OSetGen_Remove)(AvlTree* t, void* k)
+void* VG_(OSetGen_Remove)(AvlTree* t, const void* k)
{
// Have to find the node first, then remove it.
AvlNode* n = avl_lookup(t, k);
Modified: trunk/include/pub_tool_oset.h
===================================================================
--- trunk/include/pub_tool_oset.h 2008-02-23 11:57:51 UTC (rev 7435)
+++ trunk/include/pub_tool_oset.h 2008-02-23 19:04:44 UTC (rev 7436)
@@ -239,7 +239,7 @@
extern Bool VG_(OSetGen_Contains) ( const OSet* os, const void* key );
extern void* VG_(OSetGen_Lookup) ( const OSet* os, const void* key );
extern void* VG_(OSetGen_LookupWithCmp)( OSet* os, const void* key, OSetCmp_t cmp );
-extern void* VG_(OSetGen_Remove) ( OSet* os, void* key );
+extern void* VG_(OSetGen_Remove) ( OSet* os, const void* key );
extern void VG_(OSetGen_ResetIter) ( OSet* os );
extern void* VG_(OSetGen_Next) ( OSet* os );
|
|
From: xiaoming g. <xia...@gm...> - 2008-02-23 15:26:39
|
Hi, everyone. I want to do some work about calling context in valgrind. But after reading the code of callgrind a couple of days, I didn't find the way. Please give me some hints if you know how to do this or the existing code for this. Thanks a lot. Xiaoming |
|
From: <sv...@va...> - 2008-02-23 11:57:59
|
Author: sewardj
Date: 2008-02-23 11:57:51 +0000 (Sat, 23 Feb 2008)
New Revision: 7435
Log:
When reading variable & formal parameter DIEs, distinguish between
abstract and concrete instances, so that we can successfully recover
variable information for functions that have been inlined.
Modified:
branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c
Modified: branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c 2008-02-22 01:19:49 UTC (rev 7434)
+++ branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c 2008-02-23 11:57:51 UTC (rev 7435)
@@ -109,7 +109,9 @@
/*------------------------------------------------------------*/
-/*--- The "new" DWARF3 reader ---*/
+/*--- ---*/
+/*--- Basic machinery for parsing DIEs. ---*/
+/*--- ---*/
/*------------------------------------------------------------*/
#define TRACE_D3(format, args...) \
@@ -304,6 +306,35 @@
}
+/* Read a DWARF3 'Initial Length' field */
+static ULong get_Initial_Length ( /*OUT*/Bool* is64,
+ Cursor* c,
+ HChar* barfMsg )
+{
+ ULong w64;
+ UInt w32;
+ *is64 = False;
+ w32 = get_UInt( c );
+ if (w32 >= 0xFFFFFFF0 && w32 < 0xFFFFFFFF) {
+ c->barf( barfMsg );
+ }
+ else if (w32 == 0xFFFFFFFF) {
+ *is64 = True;
+ w64 = get_ULong( c );
+ } else {
+ *is64 = False;
+ w64 = (ULong)w32;
+ }
+ return w64;
+}
+
+
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- "CUConst" structure ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
+
#define N_ABBV_CACHE 32
/* Holds information that is constant through the parsing of a
@@ -354,53 +385,12 @@
CUConst;
-/* Read a DWARF3 'Initial Length' field */
-static ULong get_Initial_Length ( /*OUT*/Bool* is64,
- Cursor* c,
- HChar* barfMsg )
-{
- ULong w64;
- UInt w32;
- *is64 = False;
- w32 = get_UInt( c );
- if (w32 >= 0xFFFFFFF0 && w32 < 0xFFFFFFFF) {
- c->barf( barfMsg );
- }
- else if (w32 == 0xFFFFFFFF) {
- *is64 = True;
- w64 = get_ULong( c );
- } else {
- *is64 = False;
- w64 = (ULong)w32;
- }
- return w64;
-}
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- Helper functions for Guarded Expressions ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
-
-/* Denotes an address range. Both aMin and aMax are included in the
- range; hence a complete range is (0, ~0) and an empty range is any
- (X, X-1) for X > 0.*/
-typedef
- struct { Addr aMin; Addr aMax; }
- AddrRange;
-
-static XArray* unitary_range_list ( Addr aMin, Addr aMax ) {
- XArray* xa;
- AddrRange pair;
- vg_assert(aMin <= aMax);
- /* Who frees this xa? varstack_preen() does. */
- xa = VG_(newXA)( ML_(dinfo_zalloc), ML_(dinfo_free),
- sizeof(AddrRange) );
- pair.aMin = aMin;
- pair.aMax = aMax;
- VG_(addToXA)( xa, &pair );
- return xa;
-}
-
-//////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////
-/// begin GUARDED EXPRESSIONS
-
/* Parse the location list starting at img-offset 'debug_loc_offset'
in .debug_loc. Results are biased with 'svma_of_referencing_CU'
and so I believe are correct SVMAs for the object as a whole. This
@@ -628,10 +618,21 @@
return gx;
}
-/// end GUARDED EXPRESSIONS
-//////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- Helper functions for range lists and CU headers ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
+
+/* Denotes an address range. Both aMin and aMax are included in the
+ range; hence a complete range is (0, ~0) and an empty range is any
+ (X, X-1) for X > 0.*/
+typedef
+ struct { Addr aMin; Addr aMax; }
+ AddrRange;
+
+
__attribute__((noinline))
static XArray* /* of AddrRange */ empty_range_list ( void )
{
@@ -643,6 +644,21 @@
}
+static XArray* unitary_range_list ( Addr aMin, Addr aMax )
+{
+ XArray* xa;
+ AddrRange pair;
+ vg_assert(aMin <= aMax);
+ /* Who frees this xa? varstack_preen() does. */
+ xa = VG_(newXA)( ML_(dinfo_zalloc), ML_(dinfo_free),
+ sizeof(AddrRange) );
+ pair.aMin = aMin;
+ pair.aMax = aMax;
+ VG_(addToXA)( xa, &pair );
+ return xa;
+}
+
+
/* Enumerate the address ranges starting at img-offset
'debug_ranges_offset' in .debug_ranges. Results are biased with
'svma_of_referencing_CU' and so I believe are correct SVMAs for the
@@ -979,28 +995,29 @@
}
-/////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////
-// Variable location parser
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- Parsing of variable-related DIEs ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
typedef
struct _TempVar {
struct _TempVar* next;
- UChar* name; /* in AR_DINFO */
- Addr pcMin;
- Addr pcMax;
- Int level;
- Type* typeR;
- GExpr* gexpr; /* for this variable */
- GExpr* fbGX; /* to find the frame base of the enclosing fn, if
- any */
- UChar* fName; /* declaring file name, or NULL */
- Int fLine; /* declaring file line number, or zero */
- /* offset in .debug_info (for debug printing only). NB:
- approximate value ONLY! NOT TO BE RELIED ON. Is only stored
- so as to help readers make sense of the debug printed
- output. */
- UWord dioff;
+ UChar* name; /* in DebugInfo's .strchunks */
+ XArray* ranges; /* of AddrRange. UNIQUE PTR in AR_DINFO. */
+ Int level;
+ Type* typeR;
+ GExpr* gexpr; /* for this variable */
+ GExpr* fbGX; /* to find the frame base of the enclosing fn, if
+ any */
+ UChar* fName; /* declaring file name, or NULL */
+ Int fLine; /* declaring file line number, or zero */
+ /* offset in .debug_info, so that abstract instances can be
+ found to satisfy references from concrete instances. */
+ UWord dioff;
+ UWord absOri; /* so the absOri fields refer to dioff fields
+ in some other, related TempVar. */
}
TempVar;
@@ -1410,7 +1427,7 @@
Bool external = False;
GExpr* gexpr = NULL;
Int n_attrs = 0;
- Bool has_abs_ori = False;
+ UWord abs_ori = (UWord)D3_INVALID_CUOFF;
Bool declaration = False;
Int lineNo = 0;
UChar* fileName = NULL;
@@ -1440,7 +1457,7 @@
external = True;
}
if (attr == DW_AT_abstract_origin && ctsSzB > 0) {
- has_abs_ori = True;
+ abs_ori = (UWord)cts;
}
if (attr == DW_AT_declaration && ctsSzB > 0 && cts > 0) {
declaration = True;
@@ -1459,25 +1476,31 @@
if (0) VG_(printf)("XXX filename = %s\n", fileName);
}
}
- /* We'll collect it if it has a type and a location. Doesn't
- even have to have a name. */
- if (gexpr && typeR != D3_INVALID_CUOFF) {
- /* Add this variable to the set of variables associated with
- each address range at the top of the stack. */
- GExpr* fbGX = NULL;
- Word i;
- XArray* /* of AddrRange */ xa;
+ /* We'll collect it under if one of the following three
+ conditions holds:
+ (1) has location and type -> completed
+ (2) has type only -> is an abstract instance
+ (3) has location and abs_ori -> is a concrete instance
+ Name, filename and line number are all option frills.
+ */
+ if ( /* 1 */ (gexpr && typeR != D3_INVALID_CUOFF)
+ /* 2 */ || (typeR != D3_INVALID_CUOFF)
+ /* 3 */ || (gexpr && abs_ori != (UWord)D3_INVALID_CUOFF) ) {
+
+ /* Add this variable to the list of interesting looking
+ variables. Crucially, note along with it the address
+ range(s) associated with the variable, which for locals
+ will be the address ranges at the top of the varparser's
+ stack. */
+ GExpr* fbGX = NULL;
+ Word i;
+ XArray* /* of AddrRange */ xa;
+ TempVar* tv;
/* Stack can't be empty; we put a dummy entry on it for the
entire address range before starting with the DIEs for
this CU. */
vg_assert(parser->sp >= 0);
- if (!name)
- name = ML_(addStr)(
- cc->di, dtag == DW_TAG_variable
- ? "<anon_variable>"
- : "<anon_formal>", -1 );
-
/* If this is a local variable (non-external), try to find
the GExpr for the DW_AT_frame_base of the containing
function. It should have been pushed on the stack at the
@@ -1505,7 +1528,13 @@
"warning: parse_var_DIE: non-external variable "
"outside DW_TAG_subprogram");
}
- // FIXME goto bad_DIE;
+ /* goto bad_DIE; */
+ /* This seems to happen a lot. Just ignore it -- if,
+ when we come to evaluation of the location (guarded)
+ expression, it requires a frame base value, and
+ there's no expression for that, then evaluation as a
+ whole will fail. Harmless - a bit of a waste of
+ cycles but nothing more. */
}
}
@@ -1515,30 +1544,29 @@
address space. It is asserted elsewhere that level 0
always covers the entire address space. */
xa = parser->ranges[external ? 0 : parser->sp];
- for (i = 0; i < VG_(sizeXA)( xa ); i++) {
- AddrRange* r = (AddrRange*) VG_(indexXA)( xa, i );
- TempVar* tv = ML_(dinfo_zalloc)( sizeof(TempVar) );
- tv->name = name;
- tv->pcMin = r->aMin;
- tv->pcMax = r->aMax;
- tv->level = external ? 0 : parser->sp;
- tv->typeR = typeR;
- tv->gexpr = gexpr;
- tv->fbGX = fbGX;
- tv->fName = fileName;
- tv->fLine = lineNo;
- tv->next = *tempvars;
- tv->dioff = saved_die_c_offset - 2; /* NB! NOT EXACT! */
- *tempvars = tv;
- }
+ tv = ML_(dinfo_zalloc)( sizeof(TempVar) );
+ tv->name = name;
+ tv->ranges = xa;
+ tv->level = external ? 0 : parser->sp;
+ tv->typeR = typeR;
+ tv->gexpr = gexpr;
+ tv->fbGX = fbGX;
+ tv->fName = fileName;
+ tv->fLine = lineNo;
+ tv->dioff = posn;
+ tv->absOri = abs_ori;
+ tv->ranges = VG_(cloneXA)( xa ); /* free when 'tv' freed */
+
+ tv->next = *tempvars;
+ *tempvars = tv;
+
TRACE_D3(" Recording this variable, with %ld PC range(s)\n",
VG_(sizeXA)(xa) );
}
-#if 0
- else
- if ((dtag == DW_TAG_variable || dtag == DW_TAG_formal_parameter)
- && name && typeR != D3_INVALID_CUOFF && !gexpr) {
- /* We have a variable with a name and a type, but no
+
+ /* Here are some other weird cases seen in the wild:
+
+ We have a variable with a name and a type, but no
location. I guess that's a sign that it has been
optimised away. Ignore it. Here's an example:
@@ -1556,13 +1584,10 @@
DW_AT_type : <5d3>
whereas n1 and n2 do have locations specified.
- */
- /* ignore */
- }
- else
- if (dtag == DW_TAG_formal_parameter
- && typeR != D3_INVALID_CUOFF && !name && !gexpr) {
- /* We see a DW_TAG_formal_parameter with a type, but
+
+ ---------------------------------------------
+
+ We see a DW_TAG_formal_parameter with a type, but
no name and no location. It's probably part of a function type
construction, thusly, hence ignore it:
<1><2b4>: Abbrev Number: 12 (DW_TAG_subroutine_type)
@@ -1573,67 +1598,47 @@
DW_AT_type : <13e>
<2><2c3>: Abbrev Number: 13 (DW_TAG_formal_parameter)
DW_AT_type : <133>
- */
- /* ignore */
- }
- else
- if ((dtag == DW_TAG_variable || dtag == DW_TAG_formal_parameter)
- && has_abs_ori && n_attrs == 1) {
- /* Is very minimal, like this:
+
+ ---------------------------------------------
+
+ Is very minimal, like this:
<4><81d>: Abbrev Number: 44 (DW_TAG_variable)
DW_AT_abstract_origin: <7ba>
- What that signifies I have no idea. Ignore. */
- /* ignore */
- }
- else
- if ((dtag == DW_TAG_variable || dtag == DW_TAG_formal_parameter)
- && has_abs_ori && gexpr && n_attrs == 2) {
- /* Is very minimal, like this:
+ What that signifies I have no idea. Ignore.
+
+ ----------------------------------------------
+
+ Is very minimal, like this:
<200f>: DW_TAG_formal_parameter
DW_AT_abstract_ori: <1f4c>
DW_AT_location : 13440
What that signifies I have no idea. Ignore.
It might be significant, though: the variable at least
has a location and so might exist somewhere.
- Maybe we should handle this.*/
- /* ignore */
- }
- else
- if (dtag == DW_TAG_variable && declaration && !gexpr) {
- /* <22407>: DW_TAG_variable
+ Maybe we should handle this.
+
+ ---------------------------------------------
+
+ <22407>: DW_TAG_variable
DW_AT_name : (indirect string, offset: 0x6579):
vgPlain_trampoline_stuff_start
DW_AT_decl_file : 29
DW_AT_decl_line : 56
DW_AT_external : 1
DW_AT_declaration : 1
- */
- /* ignore */
- }
- else
- if (dtag == DW_TAG_variable && gexpr && n_attrs == 1) {
- /* Nameless and typeless variable that has a location? Who
+
+ Nameless and typeless variable that has a location? Who
knows. Not me.
<2><3d178>: Abbrev Number: 22 (DW_TAG_variable)
DW_AT_location : 9 byte block: 3 c0 c7 13 38 0 0 0 0
(DW_OP_addr: 3813c7c0)
- */
- /* ignore */
- }
- else
- if (dtag == DW_TAG_variable && n_attrs == 0) {
- /* No, really. Check it out. gcc is quite simply borked.
+
+ No, really. Check it out. gcc is quite simply borked.
<3><168cc>: Abbrev Number: 141 (DW_TAG_variable)
// followed by no attributes, and the next DIE is a sibling,
// not a child
- */
- /* ignore */
- }
- else
- goto bad_DIE;
-#endif
+ */
}
-
return;
bad_DIE:
@@ -1657,10 +1662,11 @@
}
-/////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////
-// Type parser. Sometimes maintains a pointer to a type
-// currently under construction.
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- Parsing of type-related DIEs ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
#define N_D3_TYPE_STACK 16
@@ -1746,7 +1752,6 @@
}
-
/* Parse a type-related DIE. 'parser' holds the current parser state.
'admin' is where the completed types are dumped. 'dtag' is the tag
for this DIE. 'c_die' points to the start of the data fields (FORM
@@ -2321,10 +2326,13 @@
/*NOTREACHED*/
}
-/////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////
-// Type Resolver
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- Resolution of references to type DIEs ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
+
static Int cmp_D3TyAdmin_by_cuOff ( void* v1, void* v2 ) {
TyAdmin* a1 = *(TyAdmin**)v1;
TyAdmin* a2 = *(TyAdmin**)v2;
@@ -2529,9 +2537,20 @@
}
-/////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- Parsing of Compilation Units ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
+static Int cmp_TempVar_by_dioff ( void* v1, void* v2 ) {
+ TempVar* t1 = *(TempVar**)v1;
+ TempVar* t2 = *(TempVar**)v2;
+ if (t1->dioff < t2->dioff) return -1;
+ if (t1->dioff > t2->dioff) return 1;
+ return 0;
+}
+
static void read_DIE ( /*OUT*/TyAdmin** admin,
/*OUT*/TempVar** tempvars,
/*OUT*/GExpr** gexprs,
@@ -2661,7 +2680,10 @@
D3VarParser varparser;
Addr dr_base;
UWord dr_offset;
+ Word i;
Bool td3 = di->trace_symtab;
+ XArray* /* of AddrRange */ xa;
+ XArray* /* of TempVar* */ dioff_lookup_tab;
#if 0
/* This doesn't work properly because it assumes all entries are
@@ -2858,17 +2880,15 @@
}
/* Check the varparser's stack is in a sane state. */
- { Int i;
- vg_assert(varparser.sp == -1);
- for (i = 0; i < N_D3_VAR_STACK; i++) {
- vg_assert(varparser.ranges[i] == NULL);
- vg_assert(varparser.level[i] == 0);
- }
- for (i = 0; i < N_D3_TYPE_STACK; i++) {
- vg_assert(typarser.qparent[i] == NULL);
- vg_assert(typarser.qlevel[i] == 0);
- }
+ vg_assert(varparser.sp == -1);
+ for (i = 0; i < N_D3_VAR_STACK; i++) {
+ vg_assert(varparser.ranges[i] == NULL);
+ vg_assert(varparser.level[i] == 0);
}
+ for (i = 0; i < N_D3_TYPE_STACK; i++) {
+ vg_assert(typarser.qparent[i] == NULL);
+ vg_assert(typarser.qlevel[i] == 0);
+ }
cu_start_offset = get_position_of_Cursor( &info );
TRACE_D3("\n");
@@ -2986,21 +3006,48 @@
}
TRACE_D3("\n");
- TRACE_D3("------ Acquired the following variables: ------\n");
- for (varp = tempvars; varp; varp = varp2) {
- varp2 = varp->next;
+ TRACE_D3("------ Acquired the following variables: ------\n\n");
+ /* Park (pointers to) all the vars in an XArray, so we can look up
+ abstract origins quickly. The array is sorted (hence, looked-up
+ by) the .dioff fields. Since the .dioffs should be instrictly
+ ascending order, there is no need to sort the array after
+ construction. The ascendingness is however asserted for. */
+ dioff_lookup_tab
+ = VG_(newXA)( ML_(dinfo_zalloc), ML_(dinfo_free),
+ sizeof(TempVar*) );
+ vg_assert(dioff_lookup_tab);
+ varp2 = NULL;
+ for (varp = tempvars; varp; varp = varp->next) {
+ if (varp2)
+ vg_assert(varp2->dioff < varp->dioff);
+ VG_(addToXA)( dioff_lookup_tab, &varp );
+ varp2 = varp;
+ }
+ VG_(setCmpFnXA)( dioff_lookup_tab, cmp_TempVar_by_dioff );
+ VG_(sortXA)( dioff_lookup_tab ); /* POINTLESS; FIXME: rm */
+
+ /* Now visit each var. Collect up as much info as possible for
+ each var and hand it to ML_(addVar). */
+ for (varp = tempvars; varp; varp = varp->next) {
+
/* Possibly show .. */
if (td3) {
- VG_(printf)(" addVar: level %d %p-%p %s :: ",
- varp->level, varp->pcMin, varp->pcMax, varp->name );
+ VG_(printf)("<%lx> addVar: level %d: %s :: ",
+ varp->dioff,
+ varp->level,
+ varp->name ? varp->name : (UChar*)"<anonymous>" );
if (varp->typeR) {
ML_(pp_Type_C_ishly)( varp->typeR );
} else {
- VG_(printf)("!!type=NULL!!");
+ VG_(printf)("NULL");
}
- VG_(printf)("\n Var=");
- ML_(pp_GX)(varp->gexpr);
+ VG_(printf)("\n Loc=");
+ if (varp->gexpr) {
+ ML_(pp_GX)(varp->gexpr);
+ } else {
+ VG_(printf)("NULL");
+ }
VG_(printf)("\n");
if (varp->fbGX) {
VG_(printf)(" FrB=");
@@ -3009,46 +3056,128 @@
} else {
VG_(printf)(" FrB=none\n");
}
- VG_(printf)(" .debug_info offset = <%lx> "
- "(or thereabouts; not exact)\n", varp->dioff);
VG_(printf)(" declared at: %s:%d\n",
- varp->fName ? varp->fName : (UChar*)"(null)",
+ varp->fName ? varp->fName : (UChar*)"NULL",
varp->fLine );
- VG_(printf)("\n");
+ if (varp->absOri != (UWord)D3_INVALID_CUOFF)
+ VG_(printf)(" abstract origin: <%lx>\n", varp->absOri);
}
+ /* Skip variables which have no location. These must be
+ abstract instances; they are useless as-is since with no
+ location they have no specified memory location. They will
+ presumably be referred to via the absOri fields of other
+ variables. */
+ if (!varp->gexpr) {
+ TRACE_D3(" SKIP (no location)\n\n");
+ continue;
+ }
+
+ /* So it has a location, at least. If it refers to some other
+ entry through its absOri field, pull in further info through
+ that. */
+ if (varp->absOri != (UWord)D3_INVALID_CUOFF) {
+ Bool found;
+ Word ixFirst, ixLast;
+ TempVar key;
+ TempVar* keyp = &key;
+ TempVar *varAI;
+ VG_(memset)(&key, 0, sizeof(key)); /* not necessary */
+ key.dioff = varp->absOri; /* this is what we want to find */
+ found = VG_(lookupXA)( dioff_lookup_tab, &keyp,
+ &ixFirst, &ixLast );
+ if (!found)
+ barf("DW_AT_abstract_origin can't be resolved");
+ /* If the following fails, there is more than one entry with
+ the same dioff. Which can't happen. */
+ vg_assert(ixFirst == ixLast);
+ varAI = *(TempVar**)VG_(indexXA)( dioff_lookup_tab, ixFirst );
+ /* stay sane */
+ vg_assert(varAI);
+ vg_assert(varAI->dioff == varp->absOri);
+
+ /* Copy what useful info we can. */
+ if (varAI->typeR && !varp->typeR)
+ varp->typeR = varAI->typeR;
+ if (varAI->name && !varp->name)
+ varp->name = varAI->name;
+ if (varAI->fName && !varp->fName)
+ varp->fName = varAI->fName;
+ if (varAI->fLine > 0 && varp->fLine == 0)
+ varp->fLine = varAI->fLine;
+ }
+
+ /* Give it a name if it doesn't have one. */
+ if (!varp->name)
+ varp->name = ML_(addStr)( di, "<anonymous>", -1 );
+
+ /* So now does it have enough info to be useful? */
+ /* NOTE: re typeR: this is a hack. If typeR is NULL then the
+ type didn't get resolved. Really, in that case something's
+ broken earlier on, and should be fixed, rather than just
+ skipping the variable. */
+ if (!varp->typeR) continue;
+ vg_assert(varp->gexpr);
+ vg_assert(varp->name);
+ vg_assert(varp->typeR);
+ vg_assert(varp->level >= 0);
+ vg_assert(varp->ranges);
+
+ /* Ok. So we're going to keep it. Call ML_(addVar) once for
+ each address range in which the variable exists. */
+ xa = varp->ranges;
+ if (varp->level == 0)
+ vg_assert( VG_(sizeXA)(xa) == 1 );
+
/* Level 0 is the global address range. So at level 0 we don't
want to bias pcMin/pcMax; but at all other levels we do since
those are derived from svmas in the Dwarf we're reading. Be
paranoid ... */
- vg_assert(varp->level >= 0);
- vg_assert(varp->pcMin <= varp->pcMax);
- if (varp->level == 0) {
- vg_assert(varp->pcMin == (Addr)0);
- vg_assert(varp->pcMax == ~(Addr)0);
- } else {
- /* vg_assert(varp->pcMin > (Addr)0);
- No .. we can legitmately expect to see ranges like
- 0x0-0x11D (pre-biasing, of course). */
- vg_assert(varp->pcMax < ~(Addr)0);
- }
- /* NOTE: re "if": this is a hack. If typeR is NULL then the
- type didn't get resolved. Really, in that case something's
- broken earlier on, and should be fixed, rather than just
- skipping the variable. */
- if (varp->typeR)
+ TRACE_D3(" ACQUIRE for range(s) ");
+ for (i = 0; i < VG_(sizeXA)( xa ); i++) {
+ AddrRange* range = VG_(indexXA)(xa, i);
+ Addr pcMin = range->aMin;
+ Addr pcMax = range->aMax;
+ vg_assert(pcMin <= pcMax);
+ if (varp->level == 0) {
+ vg_assert(pcMin == (Addr)0);
+ vg_assert(pcMax == ~(Addr)0);
+ } else {
+ /* vg_assert(pcMin > (Addr)0);
+ No .. we can legitimately expect to see ranges like
+ 0x0-0x11D (pre-biasing, of course). */
+ vg_assert(pcMax < ~(Addr)0);
+ }
+
+ if (i > 0 && (i%2) == 0) TRACE_D3("\n ");
+ TRACE_D3("[%p,%p] ", pcMin, pcMax );
+
ML_(addVar)(
di, varp->level,
- varp->pcMin + (varp->level==0 ? 0 : di->text_bias),
- varp->pcMax + (varp->level==0 ? 0 : di->text_bias),
+ pcMin + (varp->level==0 ? 0 : di->text_bias),
+ pcMax + (varp->level==0 ? 0 : di->text_bias),
varp->name, (void*)varp->typeR,
varp->gexpr, varp->fbGX,
varp->fName, varp->fLine, td3
);
+ }
+
+ TRACE_D3("\n\n");
+ /* and move on to the next var */
+ }
+
+ /* Now free all the TempVars */
+ for (varp = tempvars; varp; varp = varp2) {
+ varp2 = varp->next;
+ vg_assert(varp->ranges);
+ VG_(deleteXA)(varp->ranges);
ML_(dinfo_free)(varp);
}
tempvars = NULL;
+ /* And get rid of the temporary mapping table. */
+ VG_(deleteXA)( dioff_lookup_tab );
+
/* record the TyAdmins and the GExprs in di so they can be freed
later */
vg_assert(!di->admin_tyadmins);
@@ -3059,7 +3188,9 @@
/*------------------------------------------------------------*/
+/*--- ---*/
/*--- The "new" DWARF3 reader -- top level control logic ---*/
+/*--- ---*/
/*------------------------------------------------------------*/
/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
|
|
From: Tom H. <th...@cy...> - 2008-02-23 05:13:02
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2008-02-23 03:15:18 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 338 tests, 80 stderr failures, 1 stdout failure, 29 post failures == memcheck/tests/addressable (stderr) memcheck/tests/badjump (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-pool-0 (stderr) memcheck/tests/leak-pool-1 (stderr) memcheck/tests/leak-pool-2 (stderr) memcheck/tests/leak-pool-3 (stderr) memcheck/tests/leak-pool-4 (stderr) memcheck/tests/leak-pool-5 (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/lsframe1 (stderr) memcheck/tests/lsframe2 (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/noisy_child (stderr) memcheck/tests/partial_load_dflt (stderr) memcheck/tests/partial_load_ok (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/x86/bug152022 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/x86/xor-undef-x86 (stderr) memcheck/tests/xml1 (stderr) massif/tests/alloc-fns-A (post) massif/tests/alloc-fns-B (post) massif/tests/basic (post) massif/tests/basic2 (post) massif/tests/big-alloc (post) massif/tests/culling1 (stderr) massif/tests/culling2 (stderr) massif/tests/custom_alloc (post) massif/tests/deep-A (post) massif/tests/deep-B (stderr) massif/tests/deep-B (post) massif/tests/deep-C (stderr) massif/tests/deep-C (post) massif/tests/deep-D (post) massif/tests/ignoring (post) massif/tests/insig (post) massif/tests/long-names (post) massif/tests/long-time (post) massif/tests/new-cpp (post) massif/tests/null (post) massif/tests/one (post) massif/tests/overloaded-new (post) massif/tests/peak (post) massif/tests/peak2 (stderr) massif/tests/peak2 (post) massif/tests/realloc (stderr) massif/tests/realloc (post) massif/tests/thresholds_0_0 (post) massif/tests/thresholds_0_10 (post) massif/tests/thresholds_10_0 (post) massif/tests/thresholds_10_10 (post) massif/tests/thresholds_5_0 (post) massif/tests/thresholds_5_10 (post) massif/tests/zero1 (post) massif/tests/zero2 (post) none/tests/blockfault (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/hg06_readshared (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc02_simple_tls (stderr) helgrind/tests/tc03_re_excl (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc12_rwl_trivial (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tc24_nonzero_sem (stderr) exp-drd/tests/fp_race (stderr) exp-drd/tests/fp_race2 (stderr) exp-drd/tests/matinv (stderr) exp-drd/tests/pth_barrier (stderr) exp-drd/tests/pth_broadcast (stderr) exp-drd/tests/pth_cond_race (stderr) exp-drd/tests/pth_cond_race2 (stderr) exp-drd/tests/pth_create_chain (stderr) exp-drd/tests/pth_detached (stderr) exp-drd/tests/pth_detached2 (stderr) exp-drd/tests/sem_as_mutex (stderr) exp-drd/tests/sem_as_mutex2 (stderr) exp-drd/tests/sigalrm (stderr) exp-drd/tests/tc17_sembar (stderr) exp-drd/tests/tc18_semabuse (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-23 04:06:16
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2008-02-23 03:05:05 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 372 tests, 7 stderr failures, 2 stdout failures, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-23 03:48:41
|
Nightly build on aston ( x86_64, Fedora Core 5 ) started at 2008-02-23 03:20:08 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 378 tests, 8 stderr failures, 1 stdout failure, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/blockfault (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-02-23 03:42:46
|
Nightly build on trojan ( x86_64, Fedora Core 6 ) started at 2008-02-23 03:25:16 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 376 tests, 6 stderr failures, 5 stdout failures, 0 post failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/bug133694 (stdout) memcheck/tests/x86/bug133694 (stderr) memcheck/tests/x86/scalar (stderr) none/tests/cmdline1 (stdout) none/tests/cmdline2 (stdout) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |