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-04 22:30:50
|
Author: njn
Date: 2009-03-04 22:30:42 +0000 (Wed, 04 Mar 2009)
New Revision: 9321
Log:
Merge r9320 (DRD cleanups) from the trunk.
Modified:
branches/DARWIN/drd/drd_thread.c
branches/DARWIN/drd/drd_thread.h
Modified: branches/DARWIN/drd/drd_thread.c
===================================================================
--- branches/DARWIN/drd/drd_thread.c 2009-03-04 19:26:47 UTC (rev 9320)
+++ branches/DARWIN/drd/drd_thread.c 2009-03-04 22:30:42 UTC (rev 9321)
@@ -47,68 +47,72 @@
/* Local functions. */
-static void DRD_(thread_append_segment)(const DrdThreadId tid,
- Segment* const sg);
-static void DRD_(thread_discard_segment)(const DrdThreadId tid,
- Segment* const sg);
-static Bool DRD_(thread_conflict_set_up_to_date)(const DrdThreadId tid);
-static void DRD_(thread_compute_conflict_set)(struct bitmap** conflict_set,
- const DrdThreadId tid);
+static void thread_append_segment(const DrdThreadId tid, Segment* const sg);
+static void thread_discard_segment(const DrdThreadId tid, Segment* const sg);
+static void thread_compute_conflict_set(struct bitmap** conflict_set,
+ const DrdThreadId tid);
/* Local variables. */
-static ULong DRD_(s_context_switch_count);
-static ULong DRD_(s_discard_ordered_segments_count);
-static ULong DRD_(s_update_conflict_set_count);
-static ULong DRD_(s_conflict_set_new_segment_count);
-static ULong DRD_(s_conflict_set_combine_vc_count);
-static ULong DRD_(s_conflict_set_bitmap_creation_count);
-static ULong DRD_(s_conflict_set_bitmap2_creation_count);
-static ThreadId DRD_(s_vg_running_tid) = VG_INVALID_THREADID;
+static ULong s_context_switch_count;
+static ULong s_discard_ordered_segments_count;
+static ULong s_update_conflict_set_count;
+static ULong s_conflict_set_new_segment_count;
+static ULong s_conflict_set_combine_vc_count;
+static ULong s_conflict_set_bitmap_creation_count;
+static ULong s_conflict_set_bitmap2_creation_count;
+static ThreadId s_vg_running_tid = VG_INVALID_THREADID;
DrdThreadId DRD_(g_drd_running_tid) = DRD_INVALID_THREADID;
ThreadInfo DRD_(g_threadinfo)[DRD_N_THREADS];
struct bitmap* DRD_(g_conflict_set);
-static Bool DRD_(s_trace_context_switches) = False;
-static Bool DRD_(s_trace_conflict_set) = False;
-static Bool DRD_(s_trace_fork_join) = False;
-static Bool DRD_(s_segment_merging) = True;
+static Bool s_trace_context_switches = False;
+static Bool s_trace_conflict_set = False;
+static Bool s_trace_fork_join = False;
+static Bool s_segment_merging = True;
/* Function definitions. */
+/** Enables/disables context switch tracing. */
void DRD_(thread_trace_context_switches)(const Bool t)
{
tl_assert(t == False || t == True);
- DRD_(s_trace_context_switches) = t;
+ s_trace_context_switches = t;
}
+/** Enables/disables conflict set tracing. */
void DRD_(thread_trace_conflict_set)(const Bool t)
{
tl_assert(t == False || t == True);
- DRD_(s_trace_conflict_set) = t;
+ s_trace_conflict_set = t;
}
+/** Report whether fork/join tracing is enabled. */
Bool DRD_(thread_get_trace_fork_join)(void)
{
- return DRD_(s_trace_fork_join);
+ return s_trace_fork_join;
}
+/** Enables/disables fork/join tracing. */
void DRD_(thread_set_trace_fork_join)(const Bool t)
{
tl_assert(t == False || t == True);
- DRD_(s_trace_fork_join) = t;
+ s_trace_fork_join = t;
}
+/** Enables/disables segment merging. */
void DRD_(thread_set_segment_merging)(const Bool m)
{
tl_assert(m == False || m == True);
- DRD_(s_segment_merging) = m;
+ s_segment_merging = m;
}
/**
- * Convert Valgrind's ThreadId into a DrdThreadId. Report failure if
- * Valgrind's ThreadId does not yet exist.
+ * Convert Valgrind's ThreadId into a DrdThreadId.
+ *
+ * @return DRD thread ID upon success and DRD_INVALID_THREADID if the passed
+ * Valgrind ThreadId does not yet exist.
*/
DrdThreadId DRD_(VgThreadIdToDrdThreadId)(const ThreadId tid)
{
@@ -129,6 +133,7 @@
return DRD_INVALID_THREADID;
}
+/** Allocate a new DRD thread ID for the specified Valgrind thread ID. */
static DrdThreadId DRD_(VgThreadIdToNewDrdThreadId)(const ThreadId tid)
{
int i;
@@ -141,6 +146,8 @@
&& DRD_(g_threadinfo)[i].posix_thread_exists == False
&& DRD_(g_threadinfo)[i].detached_posix_thread == False)
{
+ tl_assert(! DRD_(IsValidDrdThreadId)(i));
+
DRD_(g_threadinfo)[i].vg_thread_exists = True;
DRD_(g_threadinfo)[i].vg_threadid = tid;
DRD_(g_threadinfo)[i].pt_threadid = INVALID_POSIX_THREADID;
@@ -150,10 +157,11 @@
DRD_(g_threadinfo)[i].stack_max = 0;
DRD_(g_threadinfo)[i].is_recording = True;
DRD_(g_threadinfo)[i].synchr_nesting = 0;
- if (DRD_(g_threadinfo)[i].first != 0)
- VG_(printf)("drd thread id = %d\n", i);
tl_assert(DRD_(g_threadinfo)[i].first == 0);
tl_assert(DRD_(g_threadinfo)[i].last == 0);
+
+ tl_assert(DRD_(IsValidDrdThreadId)(i));
+
return i;
}
}
@@ -163,6 +171,7 @@
return DRD_INVALID_THREADID;
}
+/** Convert a POSIX thread ID into a DRD thread ID. */
DrdThreadId DRD_(PtThreadIdToDrdThreadId)(const PThreadId tid)
{
int i;
@@ -180,6 +189,7 @@
return DRD_INVALID_THREADID;
}
+/** Convert a DRD thread ID into a Valgrind thread ID. */
ThreadId DRD_(DrdThreadIdToVgThreadId)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -221,6 +231,11 @@
* VG_(track_pre_thread_ll_create)(). The Valgrind core invokes this handler
* from the context of the creator thread, before the new thread has been
* created.
+ *
+ * @param[in] creator DRD thread ID of the creator thread.
+ * @param[in] vg_created Valgrind thread ID of the created thread.
+ *
+ * @return DRD thread ID of the created thread.
*/
DrdThreadId DRD_(thread_pre_create)(const DrdThreadId creator,
const ThreadId vg_created)
@@ -234,16 +249,20 @@
tl_assert(DRD_(g_threadinfo)[created].first == 0);
tl_assert(DRD_(g_threadinfo)[created].last == 0);
- DRD_(thread_append_segment)(created, DRD_(sg_new)(creator, created));
+ thread_append_segment(created, DRD_(sg_new)(creator, created));
return created;
}
/**
- * Initialize DRD_(g_threadinfo)[] for a newly created thread. Must be called after
- * the thread has been created and before any client instructioins are run
+ * Initialize DRD_(g_threadinfo)[] for a newly created thread. Must be called
+ * after the thread has been created and before any client instructions are run
* on the newly created thread, e.g. from the handler installed via
* VG_(track_pre_thread_first_insn)().
+ *
+ * @param[in] vg_created Valgrind thread ID of the newly created thread.
+ *
+ * @return DRD thread ID for the new thread.
*/
DrdThreadId DRD_(thread_post_create)(const ThreadId vg_created)
{
@@ -274,7 +293,7 @@
DRD_(thread_combine_vc)(drd_joiner, drd_joinee);
DRD_(thread_new_segment)(drd_joiner);
- if (DRD_(s_trace_fork_join))
+ if (s_trace_fork_join)
{
const ThreadId joiner = DRD_(DrdThreadIdToVgThreadId)(drd_joiner);
const ThreadId joinee = DRD_(DrdThreadIdToVgThreadId)(drd_joinee);
@@ -323,6 +342,7 @@
DRD_(g_threadinfo)[tid].stack_startup = stack_startup;
}
+/** Return the stack pointer for the specified thread. */
Addr DRD_(thread_get_stack_min)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -330,6 +350,10 @@
return DRD_(g_threadinfo)[tid].stack_min;
}
+/**
+ * Return the lowest value that was ever assigned to the stack pointer
+ * for the specified thread.
+ */
Addr DRD_(thread_get_stack_min_min)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -337,6 +361,7 @@
return DRD_(g_threadinfo)[tid].stack_min_min;
}
+/** Return the top address for the stack of the specified thread. */
Addr DRD_(thread_get_stack_max)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -344,6 +369,7 @@
return DRD_(g_threadinfo)[tid].stack_max;
}
+/** Return the maximum stack size for the specified thread. */
SizeT DRD_(thread_get_stack_size)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -360,8 +386,8 @@
Segment* sg;
Segment* sg_prev;
- tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
- && tid != DRD_INVALID_THREADID);
+ tl_assert(DRD_(IsValidDrdThreadId)(tid));
+
tl_assert(DRD_(g_threadinfo)[tid].synchr_nesting >= 0);
for (sg = DRD_(g_threadinfo)[tid].last; sg; sg = sg_prev)
{
@@ -375,6 +401,8 @@
tl_assert(DRD_(g_threadinfo)[tid].detached_posix_thread == False);
DRD_(g_threadinfo)[tid].first = 0;
DRD_(g_threadinfo)[tid].last = 0;
+
+ tl_assert(! DRD_(IsValidDrdThreadId)(tid));
}
/**
@@ -413,6 +441,7 @@
DRD_(g_threadinfo)[tid].synchr_nesting = 0;
}
+/** Store the POSIX thread ID for the specified thread. */
void DRD_(thread_set_pthreadid)(const DrdThreadId tid, const PThreadId ptid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -423,6 +452,7 @@
DRD_(g_threadinfo)[tid].pt_threadid = ptid;
}
+/** Returns true for joinable threads and false for detached threads. */
Bool DRD_(thread_get_joinable)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -430,6 +460,7 @@
return ! DRD_(g_threadinfo)[tid].detached_posix_thread;
}
+/** Store the thread mode: joinable or detached. */
void DRD_(thread_set_joinable)(const DrdThreadId tid, const Bool joinable)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -446,54 +477,70 @@
DRD_(g_threadinfo)[tid].detached_posix_thread = ! joinable;
}
+/**
+ * Update s_vg_running_tid, DRD_(g_drd_running_tid) and recalculate the
+ * conflict set.
+ */
void DRD_(thread_set_vg_running_tid)(const ThreadId vg_tid)
{
tl_assert(vg_tid != VG_INVALID_THREADID);
- if (vg_tid != DRD_(s_vg_running_tid))
+ if (vg_tid != s_vg_running_tid)
{
DRD_(thread_set_running_tid)(vg_tid,
DRD_(VgThreadIdToDrdThreadId)(vg_tid));
}
- tl_assert(DRD_(s_vg_running_tid) != VG_INVALID_THREADID);
+ tl_assert(s_vg_running_tid != VG_INVALID_THREADID);
tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID);
}
+/**
+ * Update s_vg_running_tid, DRD_(g_drd_running_tid) and recalculate the
+ * conflict set.
+ */
void DRD_(thread_set_running_tid)(const ThreadId vg_tid,
const DrdThreadId drd_tid)
{
tl_assert(vg_tid != VG_INVALID_THREADID);
tl_assert(drd_tid != DRD_INVALID_THREADID);
- if (vg_tid != DRD_(s_vg_running_tid))
+ if (vg_tid != s_vg_running_tid)
{
- if (DRD_(s_trace_context_switches)
+ if (s_trace_context_switches
&& DRD_(g_drd_running_tid) != DRD_INVALID_THREADID)
{
VG_(message)(Vg_DebugMsg,
"Context switch from thread %d/%d to thread %d/%d;"
" segments: %llu",
- DRD_(s_vg_running_tid), DRD_(g_drd_running_tid),
+ s_vg_running_tid, DRD_(g_drd_running_tid),
DRD_(DrdThreadIdToVgThreadId)(drd_tid), drd_tid,
DRD_(sg_get_segments_alive_count)());
}
- DRD_(s_vg_running_tid) = vg_tid;
+ s_vg_running_tid = vg_tid;
DRD_(g_drd_running_tid) = drd_tid;
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), drd_tid);
- DRD_(s_context_switch_count)++;
+ thread_compute_conflict_set(&DRD_(g_conflict_set), drd_tid);
+ s_context_switch_count++;
}
- tl_assert(DRD_(s_vg_running_tid) != VG_INVALID_THREADID);
+ tl_assert(s_vg_running_tid != VG_INVALID_THREADID);
tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID);
}
+/**
+ * Increase the synchronization nesting counter. Must be called before the
+ * client calls a synchronization function.
+ */
int DRD_(thread_enter_synchr)(const DrdThreadId tid)
{
tl_assert(DRD_(IsValidDrdThreadId)(tid));
return DRD_(g_threadinfo)[tid].synchr_nesting++;
}
+/**
+ * Decrease the synchronization nesting counter. Must be called after the
+ * client left a synchronization function.
+ */
int DRD_(thread_leave_synchr)(const DrdThreadId tid)
{
tl_assert(DRD_(IsValidDrdThreadId)(tid));
@@ -501,6 +548,7 @@
return --DRD_(g_threadinfo)[tid].synchr_nesting;
}
+/** Returns the synchronization nesting counter. */
int DRD_(thread_get_synchr_nesting_count)(const DrdThreadId tid)
{
tl_assert(DRD_(IsValidDrdThreadId)(tid));
@@ -509,7 +557,7 @@
/** Append a new segment at the end of the segment list. */
static
-void DRD_(thread_append_segment)(const DrdThreadId tid, Segment* const sg)
+void thread_append_segment(const DrdThreadId tid, Segment* const sg)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
@@ -529,7 +577,7 @@
* associated memory.
*/
static
-void DRD_(thread_discard_segment)(const DrdThreadId tid, Segment* const sg)
+void thread_discard_segment(const DrdThreadId tid, Segment* const sg)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
@@ -548,6 +596,10 @@
//tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid]));
}
+/**
+ * Returns a pointer to the vector clock of the most recent segment associated
+ * with thread 'tid'.
+ */
VectorClock* DRD_(thread_get_vc)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -573,6 +625,7 @@
/**
* Compute the minimum of all latest vector clocks of all threads
* (Michiel Ronsse calls this "clock snooping" in his papers about DIOTA).
+ *
* @param vc pointer to a vectorclock, holds result upon return.
*/
static void DRD_(thread_compute_minimum_vc)(VectorClock* vc)
@@ -597,6 +650,11 @@
}
}
+/**
+ * Compute the maximum of all latest vector clocks of all threads.
+ *
+ * @param vc pointer to a vectorclock, holds result upon return.
+ */
static void DRD_(thread_compute_maximum_vc)(VectorClock* vc)
{
unsigned i;
@@ -621,7 +679,7 @@
/**
* Discard all segments that have a defined order against the latest vector
- * clock of every thread -- these segments can no longer be involved in a
+ * clock of all threads -- these segments can no longer be involved in a
* data race.
*/
static void DRD_(thread_discard_ordered_segments)(void)
@@ -629,7 +687,7 @@
unsigned i;
VectorClock thread_vc_min;
- DRD_(s_discard_ordered_segments_count)++;
+ s_discard_ordered_segments_count++;
DRD_(vc_init)(&thread_vc_min, 0, 0);
DRD_(thread_compute_minimum_vc)(&thread_vc_min);
@@ -661,7 +719,7 @@
sg && (sg_next = sg->next) && DRD_(vc_lte)(&sg->vc, &thread_vc_min);
sg = sg_next)
{
- DRD_(thread_discard_segment)(i, sg);
+ thread_discard_segment(i, sg);
}
}
DRD_(vc_cleanup)(&thread_vc_min);
@@ -696,7 +754,7 @@
{
/* Merge sg and sg->next into sg. */
DRD_(sg_merge)(sg, sg->next);
- DRD_(thread_discard_segment)(i, sg->next);
+ thread_discard_segment(i, sg->next);
}
}
@@ -705,75 +763,6 @@
}
/**
- * Every change in the vector clock of a thread may cause segments that
- * were previously ordered to this thread to become unordered. Hence,
- * it may be necessary to recalculate the conflict set if the vector clock
- * of the current thread is updated. This function check whether such a
- * recalculation is necessary.
- *
- * @param tid Thread ID of the thread to which a new segment has been
- * appended.
- * @param new_sg Pointer to the most recent segment of thread tid.
- */
-static Bool conflict_set_update_needed(const DrdThreadId tid,
- const Segment* const new_sg)
-{
-#if 0
- unsigned i;
- const Segment* old_sg;
-
- tl_assert(new_sg);
-
- /* If a new segment was added to another thread than the running thread, */
- /* just tell the caller to update the conflict set. */
- if (tid != DRD_(g_drd_running_tid))
- return True;
-
- /* Always let the caller update the conflict set after creation of the */
- /* first segment. */
- old_sg = new_sg->prev;
- if (old_sg == 0)
- return True;
-
- for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]);
- i++)
- {
- Segment* q;
-
- if (i == DRD_(g_drd_running_tid))
- continue;
-
- for (q = DRD_(g_threadinfo)[i].last; q; q = q->prev)
- {
- /* If the expression below evaluates to false, this expression will */
- /* also evaluate to false for all subsequent iterations. So stop */
- /* iterating. */
- if (DRD_(vc_lte)(&q->vc, &old_sg->vc))
- break;
- /* If the vector clock of the 2nd the last segment is not ordered */
- /* to the vector clock of segment q, and the last segment is, ask */
- /* the caller to update the conflict set. */
- if (! DRD_(vc_lte)(&old_sg->vc, &q->vc))
- {
- return True;
- }
- /* If the vector clock of the last segment is not ordered to the */
- /* vector clock of segment q, ask the caller to update the conflict */
- /* set. */
- if (! DRD_(vc_lte)(&q->vc, &new_sg->vc) && ! DRD_(vc_lte)(&new_sg->vc, &q->vc))
- {
- return True;
- }
- }
- }
-
- return False;
-#else
- return True;
-#endif
-}
-
-/**
* Create a new segment for the specified thread, and discard any segments
* that cannot cause races anymore.
*/
@@ -785,22 +774,14 @@
&& tid != DRD_INVALID_THREADID);
new_sg = DRD_(sg_new)(tid, tid);
- DRD_(thread_append_segment)(tid, new_sg);
+ thread_append_segment(tid, new_sg);
- if (conflict_set_update_needed(tid, new_sg))
- {
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set),
- DRD_(g_drd_running_tid));
- DRD_(s_conflict_set_new_segment_count)++;
- }
- else if (tid == DRD_(g_drd_running_tid))
- {
- tl_assert(DRD_(thread_conflict_set_up_to_date)(DRD_(g_drd_running_tid)));
- }
+ thread_compute_conflict_set(&DRD_(g_conflict_set), DRD_(g_drd_running_tid));
+ s_conflict_set_new_segment_count++;
DRD_(thread_discard_ordered_segments)();
- if (DRD_(s_segment_merging))
+ if (s_segment_merging)
{
thread_merge_segments();
}
@@ -822,7 +803,7 @@
if (joiner == DRD_(g_drd_running_tid))
{
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), joiner);
+ thread_compute_conflict_set(&DRD_(g_conflict_set), joiner);
}
}
@@ -838,9 +819,9 @@
tl_assert(DRD_(g_threadinfo)[tid].last);
tl_assert(vc);
DRD_(vc_combine)(&DRD_(g_threadinfo)[tid].last->vc, vc);
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), tid);
+ thread_compute_conflict_set(&DRD_(g_conflict_set), tid);
DRD_(thread_discard_ordered_segments)();
- DRD_(s_conflict_set_combine_vc_count)++;
+ s_conflict_set_combine_vc_count++;
}
/**
@@ -881,11 +862,12 @@
if (other_user != DRD_INVALID_THREADID
&& DRD_(bm_has_any_access)(DRD_(g_conflict_set), a1, a2))
{
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set),
+ thread_compute_conflict_set(&DRD_(g_conflict_set),
DRD_(thread_get_running_tid)());
}
}
+/** Start recording memory access information. */
void DRD_(thread_start_recording)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -894,6 +876,7 @@
DRD_(g_threadinfo)[tid].is_recording = True;
}
+/** Stop recording memory access information. */
void DRD_(thread_stop_recording)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -902,6 +885,11 @@
DRD_(g_threadinfo)[tid].is_recording = False;
}
+/**
+ * Print the segment information for all threads.
+ *
+ * This function is only used for debugging purposes.
+ */
void DRD_(thread_print_all)(void)
{
unsigned i;
@@ -929,6 +917,7 @@
}
}
+/** Show a call stack involved in a data race. */
static void show_call_stack(const DrdThreadId tid,
const Char* const msg,
ExeContext* const callstack)
@@ -955,6 +944,7 @@
}
}
+/** Print information about the segments involved in a data race. */
static void
thread_report_conflicting_segments_segment(const DrdThreadId tid,
const Addr addr,
@@ -1001,6 +991,7 @@
}
}
+/** Print information about all segments involved in a data race. */
void DRD_(thread_report_conflicting_segments)(const DrdThreadId tid,
const Addr addr,
const SizeT size,
@@ -1022,35 +1013,11 @@
}
/**
- * Verify whether the conflict set for thread tid is up to date. Only perform
- * the check if the environment variable DRD_VERIFY_CONFLICT_SET has been set.
- */
-static Bool DRD_(thread_conflict_set_up_to_date)(const DrdThreadId tid)
-{
- static int do_verify_conflict_set = -1;
- Bool result;
- struct bitmap* computed_conflict_set = 0;
-
- if (do_verify_conflict_set < 0)
- {
- //VG_(message)(Vg_DebugMsg, "%s", VG_(getenv)("DRD_VERIFY_CONFLICT_SET"));
- do_verify_conflict_set = VG_(getenv)("DRD_VERIFY_CONFLICT_SET") != 0;
- }
- if (do_verify_conflict_set == 0)
- return True;
-
- DRD_(thread_compute_conflict_set)(&computed_conflict_set, tid);
- result = DRD_(bm_equal)(DRD_(g_conflict_set), computed_conflict_set);
- DRD_(bm_delete)(computed_conflict_set);
- return result;
-}
-
-/**
* 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 DRD_(thread_compute_conflict_set)(struct bitmap** conflict_set,
- const DrdThreadId tid)
+static void thread_compute_conflict_set(struct bitmap** conflict_set,
+ const DrdThreadId tid)
{
Segment* p;
@@ -1058,9 +1025,9 @@
&& tid != DRD_INVALID_THREADID);
tl_assert(tid == DRD_(g_drd_running_tid));
- DRD_(s_update_conflict_set_count)++;
- DRD_(s_conflict_set_bitmap_creation_count) -= DRD_(bm_get_bitmap_creation_count)();
- DRD_(s_conflict_set_bitmap2_creation_count) -= DRD_(bm_get_bitmap2_creation_count)();
+ s_update_conflict_set_count++;
+ s_conflict_set_bitmap_creation_count -= DRD_(bm_get_bitmap_creation_count)();
+ s_conflict_set_bitmap2_creation_count -= DRD_(bm_get_bitmap2_creation_count)();
if (*conflict_set)
{
@@ -1068,7 +1035,7 @@
}
*conflict_set = DRD_(bm_new)();
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
@@ -1085,7 +1052,7 @@
{
unsigned j;
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
@@ -1107,7 +1074,7 @@
{
if (! DRD_(vc_lte)(&q->vc, &p->vc) && ! DRD_(vc_lte)(&p->vc, &q->vc))
{
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -1121,7 +1088,7 @@
}
else
{
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -1137,10 +1104,10 @@
}
}
- DRD_(s_conflict_set_bitmap_creation_count) += DRD_(bm_get_bitmap_creation_count)();
- DRD_(s_conflict_set_bitmap2_creation_count) += DRD_(bm_get_bitmap2_creation_count)();
+ s_conflict_set_bitmap_creation_count += DRD_(bm_get_bitmap_creation_count)();
+ s_conflict_set_bitmap2_creation_count += DRD_(bm_get_bitmap2_creation_count)();
- if (0 && DRD_(s_trace_conflict_set))
+ if (0 && s_trace_conflict_set)
{
VG_(message)(Vg_UserMsg, "[%d] new conflict set:", tid);
DRD_(bm_print)(*conflict_set);
@@ -1148,31 +1115,42 @@
}
}
+/** Report the number of context switches performed. */
ULong DRD_(thread_get_context_switch_count)(void)
{
- return DRD_(s_context_switch_count);
+ return s_context_switch_count;
}
+/** Report the number of ordered segments that have been discarded. */
ULong DRD_(thread_get_discard_ordered_segments_count)(void)
{
- return DRD_(s_discard_ordered_segments_count);
+ return s_discard_ordered_segments_count;
}
+/** Return how many times the conflict set has been updated. */
ULong DRD_(thread_get_update_conflict_set_count)(ULong* dsnsc, ULong* dscvc)
{
tl_assert(dsnsc);
tl_assert(dscvc);
- *dsnsc = DRD_(s_conflict_set_new_segment_count);
- *dscvc = DRD_(s_conflict_set_combine_vc_count);
- return DRD_(s_update_conflict_set_count);
+ *dsnsc = s_conflict_set_new_segment_count;
+ *dscvc = s_conflict_set_combine_vc_count;
+ return s_update_conflict_set_count;
}
+/**
+ * Return the number of first-level bitmaps that have been created during
+ * conflict set updates.
+ */
ULong DRD_(thread_get_conflict_set_bitmap_creation_count)(void)
{
- return DRD_(s_conflict_set_bitmap_creation_count);
+ return s_conflict_set_bitmap_creation_count;
}
+/**
+ * Return the number of second-level bitmaps that have been created during
+ * conflict set updates.
+ */
ULong DRD_(thread_get_conflict_set_bitmap2_creation_count)(void)
{
- return DRD_(s_conflict_set_bitmap2_creation_count);
+ return s_conflict_set_bitmap2_creation_count;
}
Modified: branches/DARWIN/drd/drd_thread.h
===================================================================
--- branches/DARWIN/drd/drd_thread.h 2009-03-04 19:26:47 UTC (rev 9320)
+++ branches/DARWIN/drd/drd_thread.h 2009-03-04 22:30:42 UTC (rev 9321)
@@ -31,35 +31,45 @@
#include "drd_basics.h"
#include "drd_segment.h"
#include "pub_drd_bitmap.h"
-#include "pub_tool_libcassert.h" // tl_assert()
-#include "pub_tool_stacktrace.h" // StackTrace
-#include "pub_tool_threadstate.h" // VG_N_THREADS
+#include "pub_tool_libcassert.h" /* tl_assert() */
+#include "pub_tool_stacktrace.h" /* typedef StackTrace */
+#include "pub_tool_threadstate.h" /* VG_N_THREADS */
/* Defines. */
+/** Maximum number of threads DRD keeps information about. */
#define DRD_N_THREADS VG_N_THREADS
+/** A number different from any valid DRD thread ID. */
#define DRD_INVALID_THREADID 0
-/* Note: the PThreadId typedef and the INVALID_POSIX_THREADID depend on the */
-/* operating system and threading library in use. PThreadId must contain at */
-/* least the same number of bits as pthread_t, and INVALID_POSIX_THREADID */
-/* must be a value that will never be returned by pthread_self(). */
-
+/**
+ * A number different from any valid POSIX thread ID.
+ *
+ * @note The PThreadId typedef and the INVALID_POSIX_THREADID depend on the
+ * operating system and threading library in use. PThreadId must contain at
+ * least as many bits as pthread_t, and INVALID_POSIX_THREADID
+ * must be a value that will never be returned by pthread_self().
+ */
#define INVALID_POSIX_THREADID ((PThreadId)0)
/* Type definitions. */
+/**
+ * POSIX thread ID. The type PThreadId must be at least as wide as
+ * pthread_t.
+ */
typedef UWord PThreadId;
+/** Per-thread information managed by DRD. */
typedef struct
{
- Segment* first;
- Segment* last;
- ThreadId vg_threadid;
- PThreadId pt_threadid;
+ Segment* first; /**< Pointer to first segment. */
+ Segment* last; /**< Pointer to last segment. */
+ ThreadId vg_threadid; /**< Valgrind thread ID. */
+ PThreadId pt_threadid; /**< POSIX thread ID. */
Addr stack_min_min; /**< Lowest value stack pointer ever had. */
Addr stack_min; /**< Current stack pointer. */
Addr stack_startup; /**<Stack pointer after pthread_create() finished.*/
@@ -86,8 +96,15 @@
* can be accessed by inline functions.
*/
+/**
+ * DRD thread ID of the currently running thread. It is crucial for correct
+ * operation of DRD that this number is always in sync with
+ * VG_(get_running_tid)().
+ */
extern DrdThreadId DRD_(g_drd_running_tid);
+/** Per-thread information managed by DRD. */
extern ThreadInfo DRD_(g_threadinfo)[DRD_N_THREADS];
+/** Conflict set for the currently running thread. */
extern struct bitmap* DRD_(g_conflict_set);
@@ -152,6 +169,15 @@
/* Inline function definitions. */
+/**
+ * Whether or not the specified DRD thread ID is valid.
+ *
+ * A DRD thread ID is valid if and only if the following conditions are met:
+ * - The ID is a valid index of the DRD_(g_threadinfo)[] array.
+ * - The ID is not equal to DRD_INVALID_THREADID.
+ * - The ID refers either to a thread known by the Valgrind core, a joinable
+ * thread that has not yet been joined or a detached thread.
+ */
static __inline__
Bool DRD_(IsValidDrdThreadId)(const DrdThreadId tid)
{
@@ -161,6 +187,7 @@
&& DRD_(g_threadinfo)[tid].detached_posix_thread == False));
}
+/** Returns the DRD thread ID of the currently running thread. */
static __inline__
DrdThreadId DRD_(thread_get_running_tid)(void)
{
@@ -168,12 +195,17 @@
return DRD_(g_drd_running_tid);
}
+/** Returns a pointer to the conflict set for the currently running thread. */
static __inline__
struct bitmap* DRD_(thread_get_conflict_set)(void)
{
return DRD_(g_conflict_set);
}
+/**
+ * Reports whether or not memory access recording is enabled for the
+ * currently running thread.
+ */
static __inline__
Bool DRD_(running_thread_is_recording)(void)
{
@@ -185,6 +217,10 @@
&& DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].is_recording);
}
+/**
+ * Update the information about the lowest stack address that has ever been
+ * accessed by a thread.
+ */
static __inline__
void DRD_(thread_set_stack_min)(const DrdThreadId tid, const Addr stack_min)
{
@@ -236,4 +272,4 @@
return DRD_(thread_get_segment)(DRD_(g_drd_running_tid));
}
-#endif // __THREAD_H
+#endif /* __THREAD_H */
|
|
From: <sv...@va...> - 2009-03-04 19:26:52
|
Author: bart
Date: 2009-03-04 19:26:47 +0000 (Wed, 04 Mar 2009)
New Revision: 9320
Log:
- Added more comments.
- Removed DRD_() wrapper from around local functions and variables.
- Removed some obsolete code.
Modified:
trunk/drd/drd_thread.c
trunk/drd/drd_thread.h
Modified: trunk/drd/drd_thread.c
===================================================================
--- trunk/drd/drd_thread.c 2009-03-04 09:45:04 UTC (rev 9319)
+++ trunk/drd/drd_thread.c 2009-03-04 19:26:47 UTC (rev 9320)
@@ -47,68 +47,72 @@
/* Local functions. */
-static void DRD_(thread_append_segment)(const DrdThreadId tid,
- Segment* const sg);
-static void DRD_(thread_discard_segment)(const DrdThreadId tid,
- Segment* const sg);
-static Bool DRD_(thread_conflict_set_up_to_date)(const DrdThreadId tid);
-static void DRD_(thread_compute_conflict_set)(struct bitmap** conflict_set,
- const DrdThreadId tid);
+static void thread_append_segment(const DrdThreadId tid, Segment* const sg);
+static void thread_discard_segment(const DrdThreadId tid, Segment* const sg);
+static void thread_compute_conflict_set(struct bitmap** conflict_set,
+ const DrdThreadId tid);
/* Local variables. */
-static ULong DRD_(s_context_switch_count);
-static ULong DRD_(s_discard_ordered_segments_count);
-static ULong DRD_(s_update_conflict_set_count);
-static ULong DRD_(s_conflict_set_new_segment_count);
-static ULong DRD_(s_conflict_set_combine_vc_count);
-static ULong DRD_(s_conflict_set_bitmap_creation_count);
-static ULong DRD_(s_conflict_set_bitmap2_creation_count);
-static ThreadId DRD_(s_vg_running_tid) = VG_INVALID_THREADID;
+static ULong s_context_switch_count;
+static ULong s_discard_ordered_segments_count;
+static ULong s_update_conflict_set_count;
+static ULong s_conflict_set_new_segment_count;
+static ULong s_conflict_set_combine_vc_count;
+static ULong s_conflict_set_bitmap_creation_count;
+static ULong s_conflict_set_bitmap2_creation_count;
+static ThreadId s_vg_running_tid = VG_INVALID_THREADID;
DrdThreadId DRD_(g_drd_running_tid) = DRD_INVALID_THREADID;
ThreadInfo DRD_(g_threadinfo)[DRD_N_THREADS];
struct bitmap* DRD_(g_conflict_set);
-static Bool DRD_(s_trace_context_switches) = False;
-static Bool DRD_(s_trace_conflict_set) = False;
-static Bool DRD_(s_trace_fork_join) = False;
-static Bool DRD_(s_segment_merging) = True;
+static Bool s_trace_context_switches = False;
+static Bool s_trace_conflict_set = False;
+static Bool s_trace_fork_join = False;
+static Bool s_segment_merging = True;
/* Function definitions. */
+/** Enables/disables context switch tracing. */
void DRD_(thread_trace_context_switches)(const Bool t)
{
tl_assert(t == False || t == True);
- DRD_(s_trace_context_switches) = t;
+ s_trace_context_switches = t;
}
+/** Enables/disables conflict set tracing. */
void DRD_(thread_trace_conflict_set)(const Bool t)
{
tl_assert(t == False || t == True);
- DRD_(s_trace_conflict_set) = t;
+ s_trace_conflict_set = t;
}
+/** Report whether fork/join tracing is enabled. */
Bool DRD_(thread_get_trace_fork_join)(void)
{
- return DRD_(s_trace_fork_join);
+ return s_trace_fork_join;
}
+/** Enables/disables fork/join tracing. */
void DRD_(thread_set_trace_fork_join)(const Bool t)
{
tl_assert(t == False || t == True);
- DRD_(s_trace_fork_join) = t;
+ s_trace_fork_join = t;
}
+/** Enables/disables segment merging. */
void DRD_(thread_set_segment_merging)(const Bool m)
{
tl_assert(m == False || m == True);
- DRD_(s_segment_merging) = m;
+ s_segment_merging = m;
}
/**
- * Convert Valgrind's ThreadId into a DrdThreadId. Report failure if
- * Valgrind's ThreadId does not yet exist.
+ * Convert Valgrind's ThreadId into a DrdThreadId.
+ *
+ * @return DRD thread ID upon success and DRD_INVALID_THREADID if the passed
+ * Valgrind ThreadId does not yet exist.
*/
DrdThreadId DRD_(VgThreadIdToDrdThreadId)(const ThreadId tid)
{
@@ -129,6 +133,7 @@
return DRD_INVALID_THREADID;
}
+/** Allocate a new DRD thread ID for the specified Valgrind thread ID. */
static DrdThreadId DRD_(VgThreadIdToNewDrdThreadId)(const ThreadId tid)
{
int i;
@@ -141,6 +146,8 @@
&& DRD_(g_threadinfo)[i].posix_thread_exists == False
&& DRD_(g_threadinfo)[i].detached_posix_thread == False)
{
+ tl_assert(! DRD_(IsValidDrdThreadId)(i));
+
DRD_(g_threadinfo)[i].vg_thread_exists = True;
DRD_(g_threadinfo)[i].vg_threadid = tid;
DRD_(g_threadinfo)[i].pt_threadid = INVALID_POSIX_THREADID;
@@ -150,10 +157,11 @@
DRD_(g_threadinfo)[i].stack_max = 0;
DRD_(g_threadinfo)[i].is_recording = True;
DRD_(g_threadinfo)[i].synchr_nesting = 0;
- if (DRD_(g_threadinfo)[i].first != 0)
- VG_(printf)("drd thread id = %d\n", i);
tl_assert(DRD_(g_threadinfo)[i].first == 0);
tl_assert(DRD_(g_threadinfo)[i].last == 0);
+
+ tl_assert(DRD_(IsValidDrdThreadId)(i));
+
return i;
}
}
@@ -163,6 +171,7 @@
return DRD_INVALID_THREADID;
}
+/** Convert a POSIX thread ID into a DRD thread ID. */
DrdThreadId DRD_(PtThreadIdToDrdThreadId)(const PThreadId tid)
{
int i;
@@ -180,6 +189,7 @@
return DRD_INVALID_THREADID;
}
+/** Convert a DRD thread ID into a Valgrind thread ID. */
ThreadId DRD_(DrdThreadIdToVgThreadId)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -221,6 +231,11 @@
* VG_(track_pre_thread_ll_create)(). The Valgrind core invokes this handler
* from the context of the creator thread, before the new thread has been
* created.
+ *
+ * @param[in] creator DRD thread ID of the creator thread.
+ * @param[in] vg_created Valgrind thread ID of the created thread.
+ *
+ * @return DRD thread ID of the created thread.
*/
DrdThreadId DRD_(thread_pre_create)(const DrdThreadId creator,
const ThreadId vg_created)
@@ -234,16 +249,20 @@
tl_assert(DRD_(g_threadinfo)[created].first == 0);
tl_assert(DRD_(g_threadinfo)[created].last == 0);
- DRD_(thread_append_segment)(created, DRD_(sg_new)(creator, created));
+ thread_append_segment(created, DRD_(sg_new)(creator, created));
return created;
}
/**
- * Initialize DRD_(g_threadinfo)[] for a newly created thread. Must be called after
- * the thread has been created and before any client instructioins are run
+ * Initialize DRD_(g_threadinfo)[] for a newly created thread. Must be called
+ * after the thread has been created and before any client instructions are run
* on the newly created thread, e.g. from the handler installed via
* VG_(track_pre_thread_first_insn)().
+ *
+ * @param[in] vg_created Valgrind thread ID of the newly created thread.
+ *
+ * @return DRD thread ID for the new thread.
*/
DrdThreadId DRD_(thread_post_create)(const ThreadId vg_created)
{
@@ -274,7 +293,7 @@
DRD_(thread_combine_vc)(drd_joiner, drd_joinee);
DRD_(thread_new_segment)(drd_joiner);
- if (DRD_(s_trace_fork_join))
+ if (s_trace_fork_join)
{
const ThreadId joiner = DRD_(DrdThreadIdToVgThreadId)(drd_joiner);
const ThreadId joinee = DRD_(DrdThreadIdToVgThreadId)(drd_joinee);
@@ -323,6 +342,7 @@
DRD_(g_threadinfo)[tid].stack_startup = stack_startup;
}
+/** Return the stack pointer for the specified thread. */
Addr DRD_(thread_get_stack_min)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -330,6 +350,10 @@
return DRD_(g_threadinfo)[tid].stack_min;
}
+/**
+ * Return the lowest value that was ever assigned to the stack pointer
+ * for the specified thread.
+ */
Addr DRD_(thread_get_stack_min_min)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -337,6 +361,7 @@
return DRD_(g_threadinfo)[tid].stack_min_min;
}
+/** Return the top address for the stack of the specified thread. */
Addr DRD_(thread_get_stack_max)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -344,6 +369,7 @@
return DRD_(g_threadinfo)[tid].stack_max;
}
+/** Return the maximum stack size for the specified thread. */
SizeT DRD_(thread_get_stack_size)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -360,8 +386,8 @@
Segment* sg;
Segment* sg_prev;
- tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
- && tid != DRD_INVALID_THREADID);
+ tl_assert(DRD_(IsValidDrdThreadId)(tid));
+
tl_assert(DRD_(g_threadinfo)[tid].synchr_nesting >= 0);
for (sg = DRD_(g_threadinfo)[tid].last; sg; sg = sg_prev)
{
@@ -375,6 +401,8 @@
tl_assert(DRD_(g_threadinfo)[tid].detached_posix_thread == False);
DRD_(g_threadinfo)[tid].first = 0;
DRD_(g_threadinfo)[tid].last = 0;
+
+ tl_assert(! DRD_(IsValidDrdThreadId)(tid));
}
/**
@@ -413,6 +441,7 @@
DRD_(g_threadinfo)[tid].synchr_nesting = 0;
}
+/** Store the POSIX thread ID for the specified thread. */
void DRD_(thread_set_pthreadid)(const DrdThreadId tid, const PThreadId ptid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -423,6 +452,7 @@
DRD_(g_threadinfo)[tid].pt_threadid = ptid;
}
+/** Returns true for joinable threads and false for detached threads. */
Bool DRD_(thread_get_joinable)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -430,6 +460,7 @@
return ! DRD_(g_threadinfo)[tid].detached_posix_thread;
}
+/** Store the thread mode: joinable or detached. */
void DRD_(thread_set_joinable)(const DrdThreadId tid, const Bool joinable)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -446,54 +477,70 @@
DRD_(g_threadinfo)[tid].detached_posix_thread = ! joinable;
}
+/**
+ * Update s_vg_running_tid, DRD_(g_drd_running_tid) and recalculate the
+ * conflict set.
+ */
void DRD_(thread_set_vg_running_tid)(const ThreadId vg_tid)
{
tl_assert(vg_tid != VG_INVALID_THREADID);
- if (vg_tid != DRD_(s_vg_running_tid))
+ if (vg_tid != s_vg_running_tid)
{
DRD_(thread_set_running_tid)(vg_tid,
DRD_(VgThreadIdToDrdThreadId)(vg_tid));
}
- tl_assert(DRD_(s_vg_running_tid) != VG_INVALID_THREADID);
+ tl_assert(s_vg_running_tid != VG_INVALID_THREADID);
tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID);
}
+/**
+ * Update s_vg_running_tid, DRD_(g_drd_running_tid) and recalculate the
+ * conflict set.
+ */
void DRD_(thread_set_running_tid)(const ThreadId vg_tid,
const DrdThreadId drd_tid)
{
tl_assert(vg_tid != VG_INVALID_THREADID);
tl_assert(drd_tid != DRD_INVALID_THREADID);
- if (vg_tid != DRD_(s_vg_running_tid))
+ if (vg_tid != s_vg_running_tid)
{
- if (DRD_(s_trace_context_switches)
+ if (s_trace_context_switches
&& DRD_(g_drd_running_tid) != DRD_INVALID_THREADID)
{
VG_(message)(Vg_DebugMsg,
"Context switch from thread %d/%d to thread %d/%d;"
" segments: %llu",
- DRD_(s_vg_running_tid), DRD_(g_drd_running_tid),
+ s_vg_running_tid, DRD_(g_drd_running_tid),
DRD_(DrdThreadIdToVgThreadId)(drd_tid), drd_tid,
DRD_(sg_get_segments_alive_count)());
}
- DRD_(s_vg_running_tid) = vg_tid;
+ s_vg_running_tid = vg_tid;
DRD_(g_drd_running_tid) = drd_tid;
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), drd_tid);
- DRD_(s_context_switch_count)++;
+ thread_compute_conflict_set(&DRD_(g_conflict_set), drd_tid);
+ s_context_switch_count++;
}
- tl_assert(DRD_(s_vg_running_tid) != VG_INVALID_THREADID);
+ tl_assert(s_vg_running_tid != VG_INVALID_THREADID);
tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID);
}
+/**
+ * Increase the synchronization nesting counter. Must be called before the
+ * client calls a synchronization function.
+ */
int DRD_(thread_enter_synchr)(const DrdThreadId tid)
{
tl_assert(DRD_(IsValidDrdThreadId)(tid));
return DRD_(g_threadinfo)[tid].synchr_nesting++;
}
+/**
+ * Decrease the synchronization nesting counter. Must be called after the
+ * client left a synchronization function.
+ */
int DRD_(thread_leave_synchr)(const DrdThreadId tid)
{
tl_assert(DRD_(IsValidDrdThreadId)(tid));
@@ -501,6 +548,7 @@
return --DRD_(g_threadinfo)[tid].synchr_nesting;
}
+/** Returns the synchronization nesting counter. */
int DRD_(thread_get_synchr_nesting_count)(const DrdThreadId tid)
{
tl_assert(DRD_(IsValidDrdThreadId)(tid));
@@ -509,7 +557,7 @@
/** Append a new segment at the end of the segment list. */
static
-void DRD_(thread_append_segment)(const DrdThreadId tid, Segment* const sg)
+void thread_append_segment(const DrdThreadId tid, Segment* const sg)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
@@ -529,7 +577,7 @@
* associated memory.
*/
static
-void DRD_(thread_discard_segment)(const DrdThreadId tid, Segment* const sg)
+void thread_discard_segment(const DrdThreadId tid, Segment* const sg)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
@@ -548,6 +596,10 @@
//tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid]));
}
+/**
+ * Returns a pointer to the vector clock of the most recent segment associated
+ * with thread 'tid'.
+ */
VectorClock* DRD_(thread_get_vc)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -573,6 +625,7 @@
/**
* Compute the minimum of all latest vector clocks of all threads
* (Michiel Ronsse calls this "clock snooping" in his papers about DIOTA).
+ *
* @param vc pointer to a vectorclock, holds result upon return.
*/
static void DRD_(thread_compute_minimum_vc)(VectorClock* vc)
@@ -597,6 +650,11 @@
}
}
+/**
+ * Compute the maximum of all latest vector clocks of all threads.
+ *
+ * @param vc pointer to a vectorclock, holds result upon return.
+ */
static void DRD_(thread_compute_maximum_vc)(VectorClock* vc)
{
unsigned i;
@@ -621,7 +679,7 @@
/**
* Discard all segments that have a defined order against the latest vector
- * clock of every thread -- these segments can no longer be involved in a
+ * clock of all threads -- these segments can no longer be involved in a
* data race.
*/
static void DRD_(thread_discard_ordered_segments)(void)
@@ -629,7 +687,7 @@
unsigned i;
VectorClock thread_vc_min;
- DRD_(s_discard_ordered_segments_count)++;
+ s_discard_ordered_segments_count++;
DRD_(vc_init)(&thread_vc_min, 0, 0);
DRD_(thread_compute_minimum_vc)(&thread_vc_min);
@@ -661,7 +719,7 @@
sg && (sg_next = sg->next) && DRD_(vc_lte)(&sg->vc, &thread_vc_min);
sg = sg_next)
{
- DRD_(thread_discard_segment)(i, sg);
+ thread_discard_segment(i, sg);
}
}
DRD_(vc_cleanup)(&thread_vc_min);
@@ -696,7 +754,7 @@
{
/* Merge sg and sg->next into sg. */
DRD_(sg_merge)(sg, sg->next);
- DRD_(thread_discard_segment)(i, sg->next);
+ thread_discard_segment(i, sg->next);
}
}
@@ -705,75 +763,6 @@
}
/**
- * Every change in the vector clock of a thread may cause segments that
- * were previously ordered to this thread to become unordered. Hence,
- * it may be necessary to recalculate the conflict set if the vector clock
- * of the current thread is updated. This function check whether such a
- * recalculation is necessary.
- *
- * @param tid Thread ID of the thread to which a new segment has been
- * appended.
- * @param new_sg Pointer to the most recent segment of thread tid.
- */
-static Bool conflict_set_update_needed(const DrdThreadId tid,
- const Segment* const new_sg)
-{
-#if 0
- unsigned i;
- const Segment* old_sg;
-
- tl_assert(new_sg);
-
- /* If a new segment was added to another thread than the running thread, */
- /* just tell the caller to update the conflict set. */
- if (tid != DRD_(g_drd_running_tid))
- return True;
-
- /* Always let the caller update the conflict set after creation of the */
- /* first segment. */
- old_sg = new_sg->prev;
- if (old_sg == 0)
- return True;
-
- for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]);
- i++)
- {
- Segment* q;
-
- if (i == DRD_(g_drd_running_tid))
- continue;
-
- for (q = DRD_(g_threadinfo)[i].last; q; q = q->prev)
- {
- /* If the expression below evaluates to false, this expression will */
- /* also evaluate to false for all subsequent iterations. So stop */
- /* iterating. */
- if (DRD_(vc_lte)(&q->vc, &old_sg->vc))
- break;
- /* If the vector clock of the 2nd the last segment is not ordered */
- /* to the vector clock of segment q, and the last segment is, ask */
- /* the caller to update the conflict set. */
- if (! DRD_(vc_lte)(&old_sg->vc, &q->vc))
- {
- return True;
- }
- /* If the vector clock of the last segment is not ordered to the */
- /* vector clock of segment q, ask the caller to update the conflict */
- /* set. */
- if (! DRD_(vc_lte)(&q->vc, &new_sg->vc) && ! DRD_(vc_lte)(&new_sg->vc, &q->vc))
- {
- return True;
- }
- }
- }
-
- return False;
-#else
- return True;
-#endif
-}
-
-/**
* Create a new segment for the specified thread, and discard any segments
* that cannot cause races anymore.
*/
@@ -785,22 +774,14 @@
&& tid != DRD_INVALID_THREADID);
new_sg = DRD_(sg_new)(tid, tid);
- DRD_(thread_append_segment)(tid, new_sg);
+ thread_append_segment(tid, new_sg);
- if (conflict_set_update_needed(tid, new_sg))
- {
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set),
- DRD_(g_drd_running_tid));
- DRD_(s_conflict_set_new_segment_count)++;
- }
- else if (tid == DRD_(g_drd_running_tid))
- {
- tl_assert(DRD_(thread_conflict_set_up_to_date)(DRD_(g_drd_running_tid)));
- }
+ thread_compute_conflict_set(&DRD_(g_conflict_set), DRD_(g_drd_running_tid));
+ s_conflict_set_new_segment_count++;
DRD_(thread_discard_ordered_segments)();
- if (DRD_(s_segment_merging))
+ if (s_segment_merging)
{
thread_merge_segments();
}
@@ -822,7 +803,7 @@
if (joiner == DRD_(g_drd_running_tid))
{
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), joiner);
+ thread_compute_conflict_set(&DRD_(g_conflict_set), joiner);
}
}
@@ -838,9 +819,9 @@
tl_assert(DRD_(g_threadinfo)[tid].last);
tl_assert(vc);
DRD_(vc_combine)(&DRD_(g_threadinfo)[tid].last->vc, vc);
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), tid);
+ thread_compute_conflict_set(&DRD_(g_conflict_set), tid);
DRD_(thread_discard_ordered_segments)();
- DRD_(s_conflict_set_combine_vc_count)++;
+ s_conflict_set_combine_vc_count++;
}
/**
@@ -881,11 +862,12 @@
if (other_user != DRD_INVALID_THREADID
&& DRD_(bm_has_any_access)(DRD_(g_conflict_set), a1, a2))
{
- DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set),
+ thread_compute_conflict_set(&DRD_(g_conflict_set),
DRD_(thread_get_running_tid)());
}
}
+/** Start recording memory access information. */
void DRD_(thread_start_recording)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -894,6 +876,7 @@
DRD_(g_threadinfo)[tid].is_recording = True;
}
+/** Stop recording memory access information. */
void DRD_(thread_stop_recording)(const DrdThreadId tid)
{
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
@@ -902,6 +885,11 @@
DRD_(g_threadinfo)[tid].is_recording = False;
}
+/**
+ * Print the segment information for all threads.
+ *
+ * This function is only used for debugging purposes.
+ */
void DRD_(thread_print_all)(void)
{
unsigned i;
@@ -929,6 +917,7 @@
}
}
+/** Show a call stack involved in a data race. */
static void show_call_stack(const DrdThreadId tid,
const Char* const msg,
ExeContext* const callstack)
@@ -955,6 +944,7 @@
}
}
+/** Print information about the segments involved in a data race. */
static void
thread_report_conflicting_segments_segment(const DrdThreadId tid,
const Addr addr,
@@ -1001,6 +991,7 @@
}
}
+/** Print information about all segments involved in a data race. */
void DRD_(thread_report_conflicting_segments)(const DrdThreadId tid,
const Addr addr,
const SizeT size,
@@ -1022,35 +1013,11 @@
}
/**
- * Verify whether the conflict set for thread tid is up to date. Only perform
- * the check if the environment variable DRD_VERIFY_CONFLICT_SET has been set.
- */
-static Bool DRD_(thread_conflict_set_up_to_date)(const DrdThreadId tid)
-{
- static int do_verify_conflict_set = -1;
- Bool result;
- struct bitmap* computed_conflict_set = 0;
-
- if (do_verify_conflict_set < 0)
- {
- //VG_(message)(Vg_DebugMsg, "%s", VG_(getenv)("DRD_VERIFY_CONFLICT_SET"));
- do_verify_conflict_set = VG_(getenv)("DRD_VERIFY_CONFLICT_SET") != 0;
- }
- if (do_verify_conflict_set == 0)
- return True;
-
- DRD_(thread_compute_conflict_set)(&computed_conflict_set, tid);
- result = DRD_(bm_equal)(DRD_(g_conflict_set), computed_conflict_set);
- DRD_(bm_delete)(computed_conflict_set);
- return result;
-}
-
-/**
* 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 DRD_(thread_compute_conflict_set)(struct bitmap** conflict_set,
- const DrdThreadId tid)
+static void thread_compute_conflict_set(struct bitmap** conflict_set,
+ const DrdThreadId tid)
{
Segment* p;
@@ -1058,9 +1025,9 @@
&& tid != DRD_INVALID_THREADID);
tl_assert(tid == DRD_(g_drd_running_tid));
- DRD_(s_update_conflict_set_count)++;
- DRD_(s_conflict_set_bitmap_creation_count) -= DRD_(bm_get_bitmap_creation_count)();
- DRD_(s_conflict_set_bitmap2_creation_count) -= DRD_(bm_get_bitmap2_creation_count)();
+ s_update_conflict_set_count++;
+ s_conflict_set_bitmap_creation_count -= DRD_(bm_get_bitmap_creation_count)();
+ s_conflict_set_bitmap2_creation_count -= DRD_(bm_get_bitmap2_creation_count)();
if (*conflict_set)
{
@@ -1068,7 +1035,7 @@
}
*conflict_set = DRD_(bm_new)();
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
@@ -1085,7 +1052,7 @@
{
unsigned j;
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
@@ -1107,7 +1074,7 @@
{
if (! DRD_(vc_lte)(&q->vc, &p->vc) && ! DRD_(vc_lte)(&p->vc, &q->vc))
{
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -1121,7 +1088,7 @@
}
else
{
- if (DRD_(s_trace_conflict_set))
+ if (s_trace_conflict_set)
{
char msg[256];
VG_(snprintf)(msg, sizeof(msg),
@@ -1137,10 +1104,10 @@
}
}
- DRD_(s_conflict_set_bitmap_creation_count) += DRD_(bm_get_bitmap_creation_count)();
- DRD_(s_conflict_set_bitmap2_creation_count) += DRD_(bm_get_bitmap2_creation_count)();
+ s_conflict_set_bitmap_creation_count += DRD_(bm_get_bitmap_creation_count)();
+ s_conflict_set_bitmap2_creation_count += DRD_(bm_get_bitmap2_creation_count)();
- if (0 && DRD_(s_trace_conflict_set))
+ if (0 && s_trace_conflict_set)
{
VG_(message)(Vg_UserMsg, "[%d] new conflict set:", tid);
DRD_(bm_print)(*conflict_set);
@@ -1148,31 +1115,42 @@
}
}
+/** Report the number of context switches performed. */
ULong DRD_(thread_get_context_switch_count)(void)
{
- return DRD_(s_context_switch_count);
+ return s_context_switch_count;
}
+/** Report the number of ordered segments that have been discarded. */
ULong DRD_(thread_get_discard_ordered_segments_count)(void)
{
- return DRD_(s_discard_ordered_segments_count);
+ return s_discard_ordered_segments_count;
}
+/** Return how many times the conflict set has been updated. */
ULong DRD_(thread_get_update_conflict_set_count)(ULong* dsnsc, ULong* dscvc)
{
tl_assert(dsnsc);
tl_assert(dscvc);
- *dsnsc = DRD_(s_conflict_set_new_segment_count);
- *dscvc = DRD_(s_conflict_set_combine_vc_count);
- return DRD_(s_update_conflict_set_count);
+ *dsnsc = s_conflict_set_new_segment_count;
+ *dscvc = s_conflict_set_combine_vc_count;
+ return s_update_conflict_set_count;
}
+/**
+ * Return the number of first-level bitmaps that have been created during
+ * conflict set updates.
+ */
ULong DRD_(thread_get_conflict_set_bitmap_creation_count)(void)
{
- return DRD_(s_conflict_set_bitmap_creation_count);
+ return s_conflict_set_bitmap_creation_count;
}
+/**
+ * Return the number of second-level bitmaps that have been created during
+ * conflict set updates.
+ */
ULong DRD_(thread_get_conflict_set_bitmap2_creation_count)(void)
{
- return DRD_(s_conflict_set_bitmap2_creation_count);
+ return s_conflict_set_bitmap2_creation_count;
}
Modified: trunk/drd/drd_thread.h
===================================================================
--- trunk/drd/drd_thread.h 2009-03-04 09:45:04 UTC (rev 9319)
+++ trunk/drd/drd_thread.h 2009-03-04 19:26:47 UTC (rev 9320)
@@ -31,35 +31,45 @@
#include "drd_basics.h"
#include "drd_segment.h"
#include "pub_drd_bitmap.h"
-#include "pub_tool_libcassert.h" // tl_assert()
-#include "pub_tool_stacktrace.h" // StackTrace
-#include "pub_tool_threadstate.h" // VG_N_THREADS
+#include "pub_tool_libcassert.h" /* tl_assert() */
+#include "pub_tool_stacktrace.h" /* typedef StackTrace */
+#include "pub_tool_threadstate.h" /* VG_N_THREADS */
/* Defines. */
+/** Maximum number of threads DRD keeps information about. */
#define DRD_N_THREADS VG_N_THREADS
+/** A number different from any valid DRD thread ID. */
#define DRD_INVALID_THREADID 0
-/* Note: the PThreadId typedef and the INVALID_POSIX_THREADID depend on the */
-/* operating system and threading library in use. PThreadId must contain at */
-/* least the same number of bits as pthread_t, and INVALID_POSIX_THREADID */
-/* must be a value that will never be returned by pthread_self(). */
-
+/**
+ * A number different from any valid POSIX thread ID.
+ *
+ * @note The PThreadId typedef and the INVALID_POSIX_THREADID depend on the
+ * operating system and threading library in use. PThreadId must contain at
+ * least as many bits as pthread_t, and INVALID_POSIX_THREADID
+ * must be a value that will never be returned by pthread_self().
+ */
#define INVALID_POSIX_THREADID ((PThreadId)0)
/* Type definitions. */
+/**
+ * POSIX thread ID. The type PThreadId must be at least as wide as
+ * pthread_t.
+ */
typedef UWord PThreadId;
+/** Per-thread information managed by DRD. */
typedef struct
{
- Segment* first;
- Segment* last;
- ThreadId vg_threadid;
- PThreadId pt_threadid;
+ Segment* first; /**< Pointer to first segment. */
+ Segment* last; /**< Pointer to last segment. */
+ ThreadId vg_threadid; /**< Valgrind thread ID. */
+ PThreadId pt_threadid; /**< POSIX thread ID. */
Addr stack_min_min; /**< Lowest value stack pointer ever had. */
Addr stack_min; /**< Current stack pointer. */
Addr stack_startup; /**<Stack pointer after pthread_create() finished.*/
@@ -86,8 +96,15 @@
* can be accessed by inline functions.
*/
+/**
+ * DRD thread ID of the currently running thread. It is crucial for correct
+ * operation of DRD that this number is always in sync with
+ * VG_(get_running_tid)().
+ */
extern DrdThreadId DRD_(g_drd_running_tid);
+/** Per-thread information managed by DRD. */
extern ThreadInfo DRD_(g_threadinfo)[DRD_N_THREADS];
+/** Conflict set for the currently running thread. */
extern struct bitmap* DRD_(g_conflict_set);
@@ -152,6 +169,15 @@
/* Inline function definitions. */
+/**
+ * Whether or not the specified DRD thread ID is valid.
+ *
+ * A DRD thread ID is valid if and only if the following conditions are met:
+ * - The ID is a valid index of the DRD_(g_threadinfo)[] array.
+ * - The ID is not equal to DRD_INVALID_THREADID.
+ * - The ID refers either to a thread known by the Valgrind core, a joinable
+ * thread that has not yet been joined or a detached thread.
+ */
static __inline__
Bool DRD_(IsValidDrdThreadId)(const DrdThreadId tid)
{
@@ -161,6 +187,7 @@
&& DRD_(g_threadinfo)[tid].detached_posix_thread == False));
}
+/** Returns the DRD thread ID of the currently running thread. */
static __inline__
DrdThreadId DRD_(thread_get_running_tid)(void)
{
@@ -168,12 +195,17 @@
return DRD_(g_drd_running_tid);
}
+/** Returns a pointer to the conflict set for the currently running thread. */
static __inline__
struct bitmap* DRD_(thread_get_conflict_set)(void)
{
return DRD_(g_conflict_set);
}
+/**
+ * Reports whether or not memory access recording is enabled for the
+ * currently running thread.
+ */
static __inline__
Bool DRD_(running_thread_is_recording)(void)
{
@@ -185,6 +217,10 @@
&& DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].is_recording);
}
+/**
+ * Update the information about the lowest stack address that has ever been
+ * accessed by a thread.
+ */
static __inline__
void DRD_(thread_set_stack_min)(const DrdThreadId tid, const Addr stack_min)
{
@@ -236,4 +272,4 @@
return DRD_(thread_get_segment)(DRD_(g_drd_running_tid));
}
-#endif // __THREAD_H
+#endif /* __THREAD_H */
|
|
From: Bart V. A. <bar...@gm...> - 2009-03-04 14:36:19
|
Nightly build on georgia-tech-cellbuzz-native ( cellbuzz, ppc64, Fedora 7, native ) started at 2009-03-03 12:10:11 EST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 405 tests, 37 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-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) |
|
From: Konstantin S. <kon...@gm...> - 2009-03-04 11:52:37
|
On Tue, Mar 3, 2009 at 3:29 PM, Pınar Tözün <pin...@gm...> wrote:
> Hi,
>
> I am trying to implement the dynamic race detection algorithm
> "Goldilocks" into Helgrind but I am having some difficulties with the
> source code. The below c code is from the Valgrind Manual,
>
> #include <pthread.h>
>
> int var = 0;
>
> void* child_fn ( void* arg ) {
> var++; /* Unprotected relative to parent */ /* this is line 6 */
> return NULL;
> }
>
> int main ( void ) {
> pthread_t child;
> pthread_create(&child, NULL, child_fn, NULL);
> var++; /* Unprotected relative to child */ /* this is line 13 */
> pthread_join(child, NULL);
> return 0;
> }
>
> My question is; how can I understand when hg_handle_client_request is
> called and entered one of the LOCK cases, that it is not for the
> Helgrind's own locking procedures but it is for one of the locks in
> the checked c code. Because for the above example c code, although
> there is no locking for the variable 'var' it calls a lot of
> hg_handle_client_request with one of the LOCK cases in the switch
> statement.
Not sure I understood your problem.
Do you see LOCK/UNLOCK events when executing the program above?
There is probably some locking inside pthread_create...
--kcc
>
> Thank you!
> pinar
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|
|
From: <sv...@va...> - 2009-03-04 09:45:17
|
Author: njn
Date: 2009-03-04 09:45:04 +0000 (Wed, 04 Mar 2009)
New Revision: 9319
Log:
Merged r9316..9318 (split arch_test into two) from the trunk.
Added:
branches/DARWIN/tests/os_test.c
branches/DARWIN/tests/x86_amd64_features.c
Removed:
branches/DARWIN/tests/os_test.in
Modified:
branches/DARWIN/configure.in
branches/DARWIN/memcheck/tests/x86/fxsave.vgtest
branches/DARWIN/memcheck/tests/x86/sse1_memory.vgtest
branches/DARWIN/memcheck/tests/x86/sse2_memory.vgtest
branches/DARWIN/memcheck/tests/x86/xor-undef-x86.vgtest
branches/DARWIN/none/tests/amd64/insn_sse3.vgtest
branches/DARWIN/none/tests/amd64/insn_ssse3.vgtest
branches/DARWIN/none/tests/amd64/ssse3_misaligned.vgtest
branches/DARWIN/none/tests/x86/bug137714-x86.vgtest
branches/DARWIN/none/tests/x86/cse_fail.vgtest
branches/DARWIN/none/tests/x86/insn_cmov.vgtest
branches/DARWIN/none/tests/x86/insn_fpu.vgtest
branches/DARWIN/none/tests/x86/insn_mmx.vgtest
branches/DARWIN/none/tests/x86/insn_mmxext.vgtest
branches/DARWIN/none/tests/x86/insn_sse.vgtest
branches/DARWIN/none/tests/x86/insn_sse2.vgtest
branches/DARWIN/none/tests/x86/insn_sse3.vgtest
branches/DARWIN/none/tests/x86/insn_ssse3.vgtest
branches/DARWIN/none/tests/x86/ssse3_misaligned.vgtest
branches/DARWIN/tests/Makefile.am
branches/DARWIN/tests/arch_test.c
branches/DARWIN/tests/platform_test
branches/DARWIN/tests/vg_regtest.in
Modified: branches/DARWIN/configure.in
===================================================================
--- branches/DARWIN/configure.in 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/configure.in 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1802,7 +1802,6 @@
docs/xml/Makefile
tests/Makefile
tests/vg_regtest
- tests/os_test
perf/Makefile
perf/vg_perf
include/Makefile
Modified: branches/DARWIN/memcheck/tests/x86/fxsave.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/x86/fxsave.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/memcheck/tests/x86/fxsave.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,4 +1,4 @@
prog: fxsave
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
vgopts: -q
args: x
Modified: branches/DARWIN/memcheck/tests/x86/sse1_memory.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/x86/sse1_memory.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/memcheck/tests/x86/sse1_memory.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,4 +1,4 @@
prog: sse_memory
vgopts: -q
args: sse1
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
Modified: branches/DARWIN/memcheck/tests/x86/sse2_memory.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/x86/sse2_memory.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/memcheck/tests/x86/sse2_memory.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,4 +1,4 @@
prog: sse_memory
vgopts: -q
args: sse2
-prereq: ../../../tests/arch_test x86-sse2
+prereq: ../../../tests/x86_amd64_features x86-sse2
Modified: branches/DARWIN/memcheck/tests/x86/xor-undef-x86.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/x86/xor-undef-x86.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/memcheck/tests/x86/xor-undef-x86.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,2 +1,2 @@
prog: xor-undef-x86
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
Modified: branches/DARWIN/none/tests/amd64/insn_sse3.vgtest
===================================================================
--- branches/DARWIN/none/tests/amd64/insn_sse3.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/amd64/insn_sse3.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/amd64/insn_sse3
-prereq: ../../../tests/arch_test amd64-sse3
+prereq: ../../../tests/x86_amd64_features amd64-sse3
vgopts: -q
Modified: branches/DARWIN/none/tests/amd64/insn_ssse3.vgtest
===================================================================
--- branches/DARWIN/none/tests/amd64/insn_ssse3.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/amd64/insn_ssse3.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/amd64/insn_ssse3
-prereq: ../../../tests/arch_test amd64-sse3
+prereq: ../../../tests/x86_amd64_features amd64-ssse3
vgopts: -q
Modified: branches/DARWIN/none/tests/amd64/ssse3_misaligned.vgtest
===================================================================
--- branches/DARWIN/none/tests/amd64/ssse3_misaligned.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/amd64/ssse3_misaligned.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ssse3_misaligned
-prereq: ../../../tests/arch_test amd64-ssse3
+prereq: ../../../tests/x86_amd64_features amd64-ssse3
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/bug137714-x86.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/bug137714-x86.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/bug137714-x86.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: bug137714-x86
-prereq: ../../../tests/arch_test x86-sse2
+prereq: ../../../tests/x86_amd64_features x86-sse2
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/cse_fail.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/cse_fail.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/cse_fail.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: cse_fail
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_cmov.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_cmov.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_cmov.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_cmov
-prereq: ../../../tests/arch_test x86-cmov
+prereq: ../../../tests/x86_amd64_features x86-cmov
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_fpu.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_fpu.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_fpu.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_fpu
-prereq: ../../../tests/arch_test x86-fpu
+prereq: ../../../tests/x86_amd64_features x86-fpu
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_mmx.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_mmx.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_mmx.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_mmx
-prereq: ../../../tests/arch_test x86-mmx
+prereq: ../../../tests/x86_amd64_features x86-mmx
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_mmxext.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_mmxext.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_mmxext.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_mmxext
-prereq: ../../../tests/arch_test x86-mmxext
+prereq: ../../../tests/x86_amd64_features x86-mmxext
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_sse.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_sse.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_sse.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_sse
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_sse2.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_sse2.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_sse2.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_sse2
-prereq: ../../../tests/arch_test x86-sse2
+prereq: ../../../tests/x86_amd64_features x86-sse2
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_sse3.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_sse3.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_sse3.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_sse3
-prereq: ../../../tests/arch_test x86-sse3
+prereq: ../../../tests/x86_amd64_features x86-sse3
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/insn_ssse3.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/insn_ssse3.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/insn_ssse3.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_ssse3
-prereq: ../../../tests/arch_test x86-sse3
+prereq: ../../../tests/x86_amd64_features x86-ssse3
vgopts: -q
Modified: branches/DARWIN/none/tests/x86/ssse3_misaligned.vgtest
===================================================================
--- branches/DARWIN/none/tests/x86/ssse3_misaligned.vgtest 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/none/tests/x86/ssse3_misaligned.vgtest 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,3 +1,3 @@
prog: ssse3_misaligned
-prereq: ../../../tests/arch_test x86-ssse3
+prereq: ../../../tests/x86_amd64_features x86-ssse3
vgopts: -q
Modified: branches/DARWIN/tests/Makefile.am
===================================================================
--- branches/DARWIN/tests/Makefile.am 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/tests/Makefile.am 2009-03-04 09:45:04 UTC (rev 9319)
@@ -8,7 +8,6 @@
filter_numbers \
filter_stderr_basic \
filter_sink \
- os_test \
platform_test \
vg_regtest
@@ -16,7 +15,9 @@
check_PROGRAMS = \
arch_test \
- true
+ os_test \
+ true \
+ x86_amd64_features
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
Modified: branches/DARWIN/tests/arch_test.c
===================================================================
--- branches/DARWIN/tests/arch_test.c 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/tests/arch_test.c 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,18 +1,19 @@
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
-// This file determines which architectures that this Valgrind installation
-// supports, which depends on the machine's architecture. It also depends
-// on the configuration options; for example, if Valgrind is installed on
-// an AMD64 machine but has been configured with --enable-only32bit then
-// this program will not match "amd64".
+// This program determines which architectures that this Valgrind installation
+// supports, which depends on the what was chosen at configure-time. For
+// example, if Valgrind is installed on an AMD64 machine but has been
+// configured with --enable-only32bit then this program will match "x86" but
+// not "amd64".
//
// We return:
-// - 0 if the machine matches the asked-for cpu
-// - 1 if it didn't match, but did match the name of another arch
-// - 2 otherwise
+// - 0 if the machine matches the asked-for arch
+// - 1 if it doesn't match but does match the name of another arch
+// - 2 if it doesn't match the name of any arch
+// - 3 if there was a usage error (it also prints an error message)
// Nb: When updating this file for a new architecture, add the name to
// 'all_archs' as well as adding go().
@@ -22,179 +23,45 @@
typedef int Bool;
char* all_archs[] = {
+ "x86",
"amd64",
"ppc32",
"ppc64",
- "x86",
NULL
};
-//-----------------------------------------------------------------------------
-// ppc32-linux
-//---------------------------------------------------------------------------
-#if defined(VGP_ppc32_linux)
-static Bool go(char* cpu)
-{
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- return False;
-}
-#endif // VGP_ppc32_linux
+static Bool go(char* arch)
+{
+#if defined(VGP_x86_linux) || defined(VGP_x86_darwin)
+ if ( 0 == strcmp( arch, "x86" ) ) return True;
-//---------------------------------------------------------------------------
-// ppc64-linux
-//---------------------------------------------------------------------------
-#if defined(VGP_ppc64_linux)
-static Bool go(char* cpu)
-{
- if ( strcmp( cpu, "ppc64" ) == 0 )
- return True;
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- return False;
-}
-#endif // VGP_ppc64_linux
+#elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin)
+ if ( 0 == strcmp( arch, "x86" ) ) return True;
+ if ( 0 == strcmp( arch, "amd64" ) ) return True;
-//---------------------------------------------------------------------------
-// ppc{32,64}-aix
-//---------------------------------------------------------------------------
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-static Bool go(char* cpu)
-{
- if (sizeof(void*) == 8) {
- /* cpu is in 64-bit mode */
- if ( strcmp( cpu, "ppc64" ) == 0 )
- return True;
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- } else {
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- }
- return False;
-}
-#endif // VGP_ppc32_aix5 || VGP_ppc64_aix5
+#elif defined(VGP_ppc32_linux)
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
-//---------------------------------------------------------------------------
-// x86-linux, amd64-linux, amd64-darwin (part 1 of 2)
-//---------------------------------------------------------------------------
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux) || \
- defined(VGP_amd64_darwin)
-static void cpuid ( unsigned int n,
- unsigned int* a, unsigned int* b,
- unsigned int* c, unsigned int* d )
-{
- __asm__ __volatile__ (
- "cpuid"
- : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d) /* output */
- : "0" (n) /* input */
- );
-}
-#endif // VGP_x86_linux || VGP_amd64_linux || VGP_amd64_darwin
+#elif defined(VGP_ppc64_linux)
+ if ( 0 == strcmp( arch, "ppc64" ) ) return True;
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
-//---------------------------------------------------------------------------
-// x86-darwin (part 1 of 2)
-//---------------------------------------------------------------------------
-// We can't use the one above for x86-darwin, because we get this:
-//
-// arch_test.c:88: error: can't find a register in class ‘BREG’ while
-// reloading ‘asm’
-//
-// because %ebx is reserved for PIC. This version preserves %ebx.
-#if defined(VGP_x86_darwin)
-static void cpuid ( unsigned int n,
- unsigned int* a, unsigned int* b,
- unsigned int* c, unsigned int* d )
-{
- unsigned int abcd[4] = { n, 0, 0, 0 };
-
- __asm__ __volatile__ (
- "\tmovl %%ebx,%%esi\n"
- "\tmovl 0(%0),%%eax\n"
- "\tcpuid\n"
- "\tmovl %%eax,0(%0)\n"
- "\tmovl %%ebx,4(%0)\n"
- "\tmovl %%ecx,8(%0)\n"
- "\tmovl %%edx,12(%0)\n"
- "\tmovl %%esi,%%ebx\n"
- : /*out*/
- : /*in*/ "r"(abcd)
- : /*clobber*/ "eax", "esi", "ecx", "edx", "memory", "cc"
- );
-
- *a = abcd[0];
- *b = abcd[1];
- *c = abcd[2];
- *d = abcd[3];
-}
-#endif // VGP_x86_darwin
-
-//---------------------------------------------------------------------------
-// {x86,amd64}-{linux,darwin} (part 2 of 2)
-//---------------------------------------------------------------------------
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux) || \
- defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
-static Bool go(char* cpu)
-{
- unsigned int level = 0, cmask = 0, dmask = 0, a, b, c, d;
-
- if ( strcmp( cpu, "x86" ) == 0 ) {
- return True;
- } else if ( strcmp( cpu, "x86-fpu" ) == 0 ) {
- level = 1;
- dmask = 1 << 0;
- } else if ( strcmp( cpu, "x86-cmov" ) == 0 ) {
- level = 1;
- dmask = 1 << 15;
- } else if ( strcmp( cpu, "x86-mmx" ) == 0 ) {
- level = 1;
- dmask = 1 << 23;
- } else if ( strcmp( cpu, "x86-mmxext" ) == 0 ) {
- level = 0x80000001;
- dmask = 1 << 22;
- } else if ( strcmp( cpu, "x86-sse" ) == 0 ) {
- level = 1;
- dmask = 1 << 25;
- } else if ( strcmp( cpu, "x86-sse2" ) == 0 ) {
- level = 1;
- dmask = 1 << 26;
- } else if ( strcmp( cpu, "x86-sse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 0;
- } else if ( strcmp( cpu, "x86-ssse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 9;
-#if defined(VGA_amd64)
- } else if ( strcmp( cpu, "amd64" ) == 0 ) {
- return True;
- } else if ( strcmp( cpu, "amd64-sse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 0;
- } else if ( strcmp( cpu, "amd64-ssse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 9;
-#endif
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ if (sizeof(void*) == 8) {
+ /* CPU is in 64-bit mode */
+ if ( 0 == strcmp( arch, "ppc64" ) ) return True;
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
} else {
- return False;
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
}
- assert( !(cmask != 0 && dmask != 0) );
- assert( !(cmask == 0 && dmask == 0) );
+#else
+# error Unknown platform
+#endif // VGP_*
- cpuid( level & 0x80000000, &a, &b, &c, &d );
-
- if ( a >= level ) {
- cpuid( level, &a, &b, &c, &d );
-
- if (dmask > 0 && (d & dmask) != 0) return True;
- if (cmask > 0 && (c & cmask) != 0) return True;
- }
return False;
}
-#endif // VGP_x86_linux || VGP_amd64_linux ||
- // VGP_x86_darwin || VGP_amd64_darwin
-
//---------------------------------------------------------------------------
// main
//---------------------------------------------------------------------------
@@ -202,15 +69,15 @@
{
int i;
if ( argc != 2 ) {
- fprintf( stderr, "usage: arch_test <cpu-type>\n" );
- exit( 2 );
+ fprintf( stderr, "usage: arch_test <arch-type>\n" );
+ exit(3); // Usage error.
}
if (go( argv[1] )) {
- return 0; // matched
+ return 0; // Matched.
}
for (i = 0; NULL != all_archs[i]; i++) {
- if ( strcmp( argv[1], all_archs[i] ) == 0 )
- return 1;
+ if ( 0 == strcmp( argv[1], all_archs[i] ) )
+ return 1; // Didn't match, but named another arch.
}
- return 2;
+ return 2; // Didn't match any archs.
}
Copied: branches/DARWIN/tests/os_test.c (from rev 9316, trunk/tests/os_test.c)
===================================================================
--- branches/DARWIN/tests/os_test.c (rev 0)
+++ branches/DARWIN/tests/os_test.c 2009-03-04 09:45:04 UTC (rev 9319)
@@ -0,0 +1,66 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// This program determines which OS that this Valgrind installation
+// supports, which depends on what was chosen at configure-time.
+//
+// We return:
+// - 0 if the machine matches the asked-for OS
+// - 1 if it doesn't match but does match the name of another OS
+// - 2 if it doesn't match the name of any OS
+// - 3 if there was a usage error (it also prints an error message)
+
+// Nb: When updating this file for a new OS, add the name to
+// 'all_OSes' as well as adding go().
+
+#define False 0
+#define True 1
+typedef int Bool;
+
+char* all_OSes[] = {
+ "linux",
+ "aix5",
+ "darwin",
+ NULL
+};
+
+static Bool go(char* OS)
+{
+#if defined(VGO_linux)
+ if ( 0 == strcmp( OS, "linux" ) ) return True;
+
+#elif defined(VGO_aix5)
+ if ( 0 == strcmp( OS, "aix5" ) ) return True;
+
+#elif defined(VGO_darwin)
+ if ( 0 == strcmp( OS, "darwin" ) ) return True;
+
+#else
+# error Unknown OS
+#endif // VGO_*
+
+ return False;
+}
+
+//---------------------------------------------------------------------------
+// main
+//---------------------------------------------------------------------------
+int main(int argc, char **argv)
+{
+ int i;
+ if ( argc != 2 ) {
+ fprintf( stderr, "usage: os_test <OS-type>\n" );
+ exit(3); // Usage error.
+ }
+ if (go( argv[1] )) {
+ return 0; // Matched.
+ }
+ for (i = 0; NULL != all_OSes[i]; i++) {
+ if ( 0 == strcmp( argv[1], all_OSes[i] ) )
+ return 1; // Didn't match, but named another OS.
+ }
+ return 2; // Didn't match any OSes.
+}
+
Deleted: branches/DARWIN/tests/os_test.in
===================================================================
--- branches/DARWIN/tests/os_test.in 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/tests/os_test.in 2009-03-04 09:45:04 UTC (rev 9319)
@@ -1,29 +0,0 @@
-#! /bin/sh
-
-# This script determines which OSes that this Valgrind installation
-# supports, which depends on the machine's OS.
-# We return:
-# - 0 if the machine matches the asked-for OS
-# - 1 if it didn't match, but did match the name of another OS
-# - 2 otherwise
-
-# Nb: When updating this file for a new OS, add the name to 'all_OSes'.
-
-all_OSes="linux aix5 darwin"
-
-if [ $# -ne 1 ] ; then
- echo "usage: os_test <os-type>"
- exit 2;
-fi
-
-if [ $1 = @VGCONF_OS@ ] ; then
- exit 0; # Matches this OS.
-fi
-
-for os in $all_OSes ; do
- if [ $1 = $os ] ; then
- exit 1; # Matches another Valgrind-supported OS.
- fi
-done
-
-exit 2; # Doesn't match any Valgrind-supported OS.
Modified: branches/DARWIN/tests/platform_test
===================================================================
--- branches/DARWIN/tests/platform_test 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/tests/platform_test 2009-03-04 09:45:04 UTC (rev 9319)
@@ -24,7 +24,7 @@
# as the one holding this script.
dir=`dirname $0`
-if $dir/arch_test $1 && sh $dir/os_test $2 ; then
+if $dir/arch_test $1 && $dir/os_test $2 ; then
exit 0; # Matches this platform.
fi
Modified: branches/DARWIN/tests/vg_regtest.in
===================================================================
--- branches/DARWIN/tests/vg_regtest.in 2009-03-04 04:28:34 UTC (rev 9318)
+++ branches/DARWIN/tests/vg_regtest.in 2009-03-04 09:45:04 UTC (rev 9319)
@@ -68,13 +68,20 @@
# one stderr.exp* file. Any .exp* file that ends in '~' or '#' is ignored;
# this is because Emacs creates temporary files of these names.
#
-# The prerequisite command, if present, must return 0 otherwise the test is
-# skipped. The post-test command, if present, must return 0 and its stdout
-# must match the expected stdout which is kept in <test>.post.exp*.
-#
# If results don't match, the output can be found in <test>.std<strm>.out,
# and the diff between expected and actual in <test>.std<strm>.diff*.
#
+# The prerequisite command, if present, works like this:
+# - if it returns 0 the test is run
+# - if it returns 1 the test is skipped
+# - if it returns anything else the script aborts.
+# The idea here is results other than 0 or 1 are likely to be due to
+# problems with the commands, and you don't want to conflate them with the 1
+# case, which would happen if you just tested for zero or non-zero.
+#
+# The post-test command, if present, must return 0 and its stdout must match
+# the expected stdout which is kept in <test>.post.exp*.
+#
# Sometimes it is useful to run all the tests at a high sanity check
# level or with arbitrary other flags. To make this simple, extra
# options, applied to all tests run, are read from $EXTRA_REGTEST_OPTS,
@@ -309,9 +316,18 @@
read_vgtest_file($vgtest);
if (defined $prereq) {
- if (system("$prereq") != 0) {
+ my $prereq_res = system("$prereq");
+ if (0 == $prereq_res) {
+ # Do nothing (ie. continue with the test)
+ } elsif (256 == $prereq_res) {
+ # Nb: weird Perl-ism -- exit code of '1' is seen by Perl as 256...
+ # Prereq failed, skip.
printf("%-16s (skipping, prereq failed: $prereq)\n", "$name:");
return;
+ } else {
+ # Bad prereq; abort.
+ $prereq_res /= 256;
+ die "prereq returned $prereq_res: $prereq\n";
}
}
@@ -387,8 +403,8 @@
# ppc/ directories ('arch_test' returns 1 for this case). Likewise for
# the OS and platform.
# Nb: weird Perl-ism -- exit code of '1' is seen by Perl as 256...
- if (256 == system( "$tests_dir/tests/arch_test $dir")) { return; }
- if (256 == system("sh $tests_dir/tests/os_test $dir")) { return; }
+ if (256 == system("$tests_dir/tests/arch_test $dir")) { return; }
+ if (256 == system("$tests_dir/tests/os_test $dir")) { return; }
if ($dir =~ /(\w+)-(\w+)/ &&
256 == system("sh $tests_dir/tests/platform_test $1 $2")) { return; }
Copied: branches/DARWIN/tests/x86_amd64_features.c (from rev 9317, trunk/tests/x86_amd64_features.c)
===================================================================
--- branches/DARWIN/tests/x86_amd64_features.c (rev 0)
+++ branches/DARWIN/tests/x86_amd64_features.c 2009-03-04 09:45:04 UTC (rev 9319)
@@ -0,0 +1,152 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+// This file determines x86/AMD64 features a processor supports.
+//
+// We return:
+// - 0 if the machine matches the asked-for feature.
+// - 1 if the machine does not.
+// - 2 if the asked-for feature isn't recognised (this will be the case for
+// any feature if run on a non-x86/AMD64 machine).
+// - 3 if there was a usage error (it also prints an error message).
+
+#define False 0
+#define True 1
+typedef int Bool;
+
+//---------------------------------------------------------------------------
+// {x86,amd64}-linux (part 1 of 2)
+//---------------------------------------------------------------------------
+#if defined(VGP_x86_linux) || defined(VGP_amd64_linux) || \
+ defined(VGP_amd64_darwin)
+static void cpuid ( unsigned int n,
+ unsigned int* a, unsigned int* b,
+ unsigned int* c, unsigned int* d )
+{
+ __asm__ __volatile__ (
+ "cpuid"
+ : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d) /* output */
+ : "0" (n) /* input */
+ );
+}
+#endif // VGP_x86_linux || VGP_amd64_linux || VGP_amd64_darwin
+
+//---------------------------------------------------------------------------
+// x86-darwin (part 1 of 2)
+//---------------------------------------------------------------------------
+// We can't use the one above for x86-darwin, because we get this:
+//
+// arch_test.c:88: error: can't find a register in class ‘BREG’ while
+// reloading ‘asm’
+//
+// because %ebx is reserved for PIC. This version preserves %ebx.
+#if defined(VGP_x86_darwin)
+static void cpuid ( unsigned int n,
+ unsigned int* a, unsigned int* b,
+ unsigned int* c, unsigned int* d )
+{
+ unsigned int abcd[4] = { n, 0, 0, 0 };
+
+ __asm__ __volatile__ (
+ "\tmovl %%ebx,%%esi\n"
+ "\tmovl 0(%0),%%eax\n"
+ "\tcpuid\n"
+ "\tmovl %%eax,0(%0)\n"
+ "\tmovl %%ebx,4(%0)\n"
+ "\tmovl %%ecx,8(%0)\n"
+ "\tmovl %%edx,12(%0)\n"
+ "\tmovl %%esi,%%ebx\n"
+ : /*out*/
+ : /*in*/ "r"(abcd)
+ : /*clobber*/ "eax", "esi", "ecx", "edx", "memory", "cc"
+ );
+
+ *a = abcd[0];
+ *b = abcd[1];
+ *c = abcd[2];
+ *d = abcd[3];
+}
+#endif // VGP_x86_darwin
+
+//---------------------------------------------------------------------------
+// {x86,amd64}-{linux,darwin} (part 2 of 2)
+//---------------------------------------------------------------------------
+#if defined(VGA_x86) || defined(VGA_amd64)
+static Bool go(char* cpu)
+{
+ unsigned int level = 0, cmask = 0, dmask = 0, a, b, c, d;
+
+ if ( strcmp( cpu, "x86-fpu" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 0;
+ } else if ( strcmp( cpu, "x86-cmov" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 15;
+ } else if ( strcmp( cpu, "x86-mmx" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 23;
+ } else if ( strcmp( cpu, "x86-mmxext" ) == 0 ) {
+ level = 0x80000001;
+ dmask = 1 << 22;
+ } else if ( strcmp( cpu, "x86-sse" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 25;
+ } else if ( strcmp( cpu, "x86-sse2" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 26;
+ } else if ( strcmp( cpu, "x86-sse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 0;
+ } else if ( strcmp( cpu, "x86-ssse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 9;
+#if defined(VGA_amd64)
+ } else if ( strcmp( cpu, "amd64-sse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 0;
+ } else if ( strcmp( cpu, "amd64-ssse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 9;
+#endif
+ } else {
+ return 2; // Unrecognised feature.
+ }
+
+ assert( !(cmask != 0 && dmask != 0) );
+ assert( !(cmask == 0 && dmask == 0) );
+
+ cpuid( level & 0x80000000, &a, &b, &c, &d );
+
+ if ( a >= level ) {
+ cpuid( level, &a, &b, &c, &d );
+
+ if (dmask > 0 && (d & dmask) != 0) return 0; // Feature present.
+ if (cmask > 0 && (c & cmask) != 0) return 0; // Feature present.
+ }
+ return 1; // Feature not present.
+}
+
+#else
+
+static Bool go(char* cpu)
+{
+ return 2; // Feature not recognised (non-x86/AMD64 machine!)
+}
+
+#endif // defined(VGA_x86) || defined(VGA_amd64)
+
+
+//---------------------------------------------------------------------------
+// main
+//---------------------------------------------------------------------------
+int main(int argc, char **argv)
+{
+ if ( argc != 2 ) {
+ fprintf( stderr, "usage: x86_amd64_features <feature>\n" );
+ exit(3); // Usage error.
+ }
+ return go(argv[1]);
+}
|
|
From: Bart V. A. <bar...@gm...> - 2009-03-04 08:40:22
|
On Tue, Mar 3, 2009 at 1:29 PM, Pınar Tözün <pin...@gm...> wrote: > I am trying to implement the dynamic race detection algorithm > "Goldilocks" into Helgrind but I am having some difficulties with the > source code. What are the advantages of the Goldilocks algorithm over the algorithms implemented in Helgrind, Drd and ThreadSanitizer ? Bart. |
|
From: <sv...@va...> - 2009-03-04 04:28:40
|
Author: njn
Date: 2009-03-04 04:28:34 +0000 (Wed, 04 Mar 2009)
New Revision: 9318
Log:
Roll back accidental change that shouldn't have been in r9316.
Modified:
trunk/none/tests/x86/gen_insn_test.pl
Modified: trunk/none/tests/x86/gen_insn_test.pl
===================================================================
--- trunk/none/tests/x86/gen_insn_test.pl 2009-03-04 04:18:33 UTC (rev 9317)
+++ trunk/none/tests/x86/gen_insn_test.pl 2009-03-04 04:28:34 UTC (rev 9318)
@@ -49,8 +49,8 @@
our %RegNums = (
al => 0, ax => 0, eax => 0,
+ bl => 1, bx => 1, ebx => 1,
cl => 2, cx => 2, ecx => 2,
- bl => 1, bx => 1, ebx => 1,
dl => 3, dx => 3, edx => 3,
ah => 4,
bh => 5,
@@ -62,15 +62,15 @@
our %RegTypes = (
al => "r8", ah => "r8", ax => "r16", eax => "r32",
+ bl => "r8", bh => "r8", bx => "r16", ebx => "r32",
cl => "r8", ch => "r8", cx => "r16", ecx => "r32",
- bl => "r8", bh => "r8", bx => "r16", ebx => "r32",
dl => "r8", dh => "r8", dx => "r16", edx => "r32"
);
our @IntRegs = (
{ r8 => "al", r16 => "ax", r32 => "eax" },
+ { r8 => "bl", r16 => "bx", r32 => "ebx" },
{ r8 => "cl", r16 => "cx", r32 => "ecx" },
- { r8 => "bl", r16 => "bx", r32 => "ebx" },
{ r8 => "dl", r16 => "dx", r32 => "edx" },
{ r8 => "ah" },
{ r8 => "bh" },
|
|
From: <sv...@va...> - 2009-03-04 04:18:37
|
Author: njn
Date: 2009-03-04 04:18:33 +0000 (Wed, 04 Mar 2009)
New Revision: 9317
Log:
This should have been added to the last commit.
Added:
trunk/tests/x86_amd64_features.c
Added: trunk/tests/x86_amd64_features.c
===================================================================
--- trunk/tests/x86_amd64_features.c (rev 0)
+++ trunk/tests/x86_amd64_features.c 2009-03-04 04:18:33 UTC (rev 9317)
@@ -0,0 +1,114 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+// This file determines x86/AMD64 features a processor supports.
+//
+// We return:
+// - 0 if the machine matches the asked-for feature.
+// - 1 if the machine does not.
+// - 2 if the asked-for feature isn't recognised (this will be the case for
+// any feature if run on a non-x86/AMD64 machine).
+// - 3 if there was a usage error (it also prints an error message).
+
+#define False 0
+#define True 1
+typedef int Bool;
+
+//---------------------------------------------------------------------------
+// {x86,amd64}-linux (part 1 of 2)
+//---------------------------------------------------------------------------
+#if defined(VGP_x86_linux) || defined(VGP_amd64_linux)
+static void cpuid ( unsigned int n,
+ unsigned int* a, unsigned int* b,
+ unsigned int* c, unsigned int* d )
+{
+ __asm__ __volatile__ (
+ "cpuid"
+ : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d) /* output */
+ : "0" (n) /* input */
+ );
+}
+#endif // VGP_x86_linux || VGP_amd64_linux
+
+//---------------------------------------------------------------------------
+// {x86,amd64}-linux (part 2 of 2)
+//---------------------------------------------------------------------------
+#if defined(VGA_x86) || defined(VGA_amd64)
+static Bool go(char* cpu)
+{
+ unsigned int level = 0, cmask = 0, dmask = 0, a, b, c, d;
+
+ if ( strcmp( cpu, "x86-fpu" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 0;
+ } else if ( strcmp( cpu, "x86-cmov" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 15;
+ } else if ( strcmp( cpu, "x86-mmx" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 23;
+ } else if ( strcmp( cpu, "x86-mmxext" ) == 0 ) {
+ level = 0x80000001;
+ dmask = 1 << 22;
+ } else if ( strcmp( cpu, "x86-sse" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 25;
+ } else if ( strcmp( cpu, "x86-sse2" ) == 0 ) {
+ level = 1;
+ dmask = 1 << 26;
+ } else if ( strcmp( cpu, "x86-sse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 0;
+ } else if ( strcmp( cpu, "x86-ssse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 9;
+#if defined(VGA_amd64)
+ } else if ( strcmp( cpu, "amd64-sse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 0;
+ } else if ( strcmp( cpu, "amd64-ssse3" ) == 0 ) {
+ level = 1;
+ cmask = 1 << 9;
+#endif
+ } else {
+ return 2; // Unrecognised feature.
+ }
+
+ assert( !(cmask != 0 && dmask != 0) );
+ assert( !(cmask == 0 && dmask == 0) );
+
+ cpuid( level & 0x80000000, &a, &b, &c, &d );
+
+ if ( a >= level ) {
+ cpuid( level, &a, &b, &c, &d );
+
+ if (dmask > 0 && (d & dmask) != 0) return 0; // Feature present.
+ if (cmask > 0 && (c & cmask) != 0) return 0; // Feature present.
+ }
+ return 1; // Feature not present.
+}
+
+#else // defined(VGA_x86) || defined(VGA_amd64)
+
+static Bool go(char* cpu)
+{
+ return 2; // Feature not recognised (non-x86/AMD64 machine!)
+}
+
+#endif // defined(VGA_x86) || defined(VGA_amd64)
+
+
+//---------------------------------------------------------------------------
+// main
+//---------------------------------------------------------------------------
+int main(int argc, char **argv)
+{
+ if ( argc != 2 ) {
+ fprintf( stderr, "usage: x86_amd64_features <feature>\n" );
+ exit(3); // Usage error.
+ }
+ return go(argv[1]);
+}
|
|
From: <sv...@va...> - 2009-03-04 04:15:22
|
Author: njn
Date: 2009-03-04 04:15:16 +0000 (Wed, 04 Mar 2009)
New Revision: 9316
Log:
tests/arch_test is currently being used for two purposes:
- by vg_regtest for determining if a directory name matches an architecture;
- by various .vgtest files for detecting x86/AMD64 features.
This commit splits it in two for the two different purposes, which makes
things clearer.
Specific changes
- Moved the x86/AMD64 feature detection stuff out of arch_test.c, and
into the new x86_amd64_feature.c. Updated the relevant .vgtest files for
the change.
- In vg_regtest, now a prereq command must return 0 (prereq satisfied) or 1
(prereq not satisfied). Anything else makes vg_regtest abort. This
makes obvious any problems with prereq tests rather than just making the
tests skip innocuously. (We previously had exactly such a problem on the
DARWIN branch; the x86 feature detection tests caused segfaults so the
tests were incorrectly skipped. This change will catch any similar future
problem.)
- Changed os_test from a script to a C program, matching cpu_test.
- Removed some unintentional darwin stuff from platform_test.
Added:
trunk/tests/os_test.c
Removed:
trunk/tests/os_test.in
Modified:
trunk/configure.in
trunk/memcheck/tests/x86/fxsave.vgtest
trunk/memcheck/tests/x86/sse1_memory.vgtest
trunk/memcheck/tests/x86/sse2_memory.vgtest
trunk/memcheck/tests/x86/xor-undef-x86.vgtest
trunk/none/tests/amd64/insn_sse3.vgtest
trunk/none/tests/amd64/insn_ssse3.vgtest
trunk/none/tests/amd64/ssse3_misaligned.vgtest
trunk/none/tests/x86/bug137714-x86.vgtest
trunk/none/tests/x86/cse_fail.vgtest
trunk/none/tests/x86/gen_insn_test.pl
trunk/none/tests/x86/insn_cmov.vgtest
trunk/none/tests/x86/insn_fpu.vgtest
trunk/none/tests/x86/insn_mmx.vgtest
trunk/none/tests/x86/insn_mmxext.vgtest
trunk/none/tests/x86/insn_sse.vgtest
trunk/none/tests/x86/insn_sse2.vgtest
trunk/none/tests/x86/insn_sse3.vgtest
trunk/none/tests/x86/insn_ssse3.vgtest
trunk/none/tests/x86/ssse3_misaligned.vgtest
trunk/tests/Makefile.am
trunk/tests/arch_test.c
trunk/tests/platform_test
trunk/tests/vg_regtest.in
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/configure.in 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1709,7 +1709,6 @@
docs/xml/Makefile
tests/Makefile
tests/vg_regtest
- tests/os_test
perf/Makefile
perf/vg_perf
include/Makefile
Modified: trunk/memcheck/tests/x86/fxsave.vgtest
===================================================================
--- trunk/memcheck/tests/x86/fxsave.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/memcheck/tests/x86/fxsave.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,4 +1,4 @@
prog: fxsave
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
vgopts: -q
args: x
Modified: trunk/memcheck/tests/x86/sse1_memory.vgtest
===================================================================
--- trunk/memcheck/tests/x86/sse1_memory.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/memcheck/tests/x86/sse1_memory.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,4 +1,4 @@
prog: sse_memory
vgopts: -q
args: sse1
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
Modified: trunk/memcheck/tests/x86/sse2_memory.vgtest
===================================================================
--- trunk/memcheck/tests/x86/sse2_memory.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/memcheck/tests/x86/sse2_memory.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,4 +1,4 @@
prog: sse_memory
vgopts: -q
args: sse2
-prereq: ../../../tests/arch_test x86-sse2
+prereq: ../../../tests/x86_amd64_features x86-sse2
Modified: trunk/memcheck/tests/x86/xor-undef-x86.vgtest
===================================================================
--- trunk/memcheck/tests/x86/xor-undef-x86.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/memcheck/tests/x86/xor-undef-x86.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,2 +1,2 @@
prog: xor-undef-x86
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
Modified: trunk/none/tests/amd64/insn_sse3.vgtest
===================================================================
--- trunk/none/tests/amd64/insn_sse3.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/amd64/insn_sse3.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/amd64/insn_sse3
-prereq: ../../../tests/arch_test amd64-sse3
+prereq: ../../../tests/x86_amd64_features amd64-sse3
vgopts: -q
Modified: trunk/none/tests/amd64/insn_ssse3.vgtest
===================================================================
--- trunk/none/tests/amd64/insn_ssse3.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/amd64/insn_ssse3.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/amd64/insn_ssse3
-prereq: ../../../tests/arch_test amd64-ssse3
+prereq: ../../../tests/x86_amd64_features amd64-ssse3
vgopts: -q
Modified: trunk/none/tests/amd64/ssse3_misaligned.vgtest
===================================================================
--- trunk/none/tests/amd64/ssse3_misaligned.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/amd64/ssse3_misaligned.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ssse3_misaligned
-prereq: ../../../tests/arch_test amd64-ssse3
+prereq: ../../../tests/x86_amd64_features amd64-ssse3
vgopts: -q
Modified: trunk/none/tests/x86/bug137714-x86.vgtest
===================================================================
--- trunk/none/tests/x86/bug137714-x86.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/bug137714-x86.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: bug137714-x86
-prereq: ../../../tests/arch_test x86-sse2
+prereq: ../../../tests/x86_amd64_features x86-sse2
vgopts: -q
Modified: trunk/none/tests/x86/cse_fail.vgtest
===================================================================
--- trunk/none/tests/x86/cse_fail.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/cse_fail.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: cse_fail
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
vgopts: -q
Modified: trunk/none/tests/x86/gen_insn_test.pl
===================================================================
--- trunk/none/tests/x86/gen_insn_test.pl 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/gen_insn_test.pl 2009-03-04 04:15:16 UTC (rev 9316)
@@ -49,8 +49,8 @@
our %RegNums = (
al => 0, ax => 0, eax => 0,
+ cl => 2, cx => 2, ecx => 2,
bl => 1, bx => 1, ebx => 1,
- cl => 2, cx => 2, ecx => 2,
dl => 3, dx => 3, edx => 3,
ah => 4,
bh => 5,
@@ -62,15 +62,15 @@
our %RegTypes = (
al => "r8", ah => "r8", ax => "r16", eax => "r32",
+ cl => "r8", ch => "r8", cx => "r16", ecx => "r32",
bl => "r8", bh => "r8", bx => "r16", ebx => "r32",
- cl => "r8", ch => "r8", cx => "r16", ecx => "r32",
dl => "r8", dh => "r8", dx => "r16", edx => "r32"
);
our @IntRegs = (
{ r8 => "al", r16 => "ax", r32 => "eax" },
+ { r8 => "cl", r16 => "cx", r32 => "ecx" },
{ r8 => "bl", r16 => "bx", r32 => "ebx" },
- { r8 => "cl", r16 => "cx", r32 => "ecx" },
{ r8 => "dl", r16 => "dx", r32 => "edx" },
{ r8 => "ah" },
{ r8 => "bh" },
Modified: trunk/none/tests/x86/insn_cmov.vgtest
===================================================================
--- trunk/none/tests/x86/insn_cmov.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_cmov.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_cmov
-prereq: ../../../tests/arch_test x86-cmov
+prereq: ../../../tests/x86_amd64_features x86-cmov
vgopts: -q
Modified: trunk/none/tests/x86/insn_fpu.vgtest
===================================================================
--- trunk/none/tests/x86/insn_fpu.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_fpu.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_fpu
-prereq: ../../../tests/arch_test x86-fpu
+prereq: ../../../tests/x86_amd64_features x86-fpu
vgopts: -q
Modified: trunk/none/tests/x86/insn_mmx.vgtest
===================================================================
--- trunk/none/tests/x86/insn_mmx.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_mmx.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_mmx
-prereq: ../../../tests/arch_test x86-mmx
+prereq: ../../../tests/x86_amd64_features x86-mmx
vgopts: -q
Modified: trunk/none/tests/x86/insn_mmxext.vgtest
===================================================================
--- trunk/none/tests/x86/insn_mmxext.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_mmxext.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_mmxext
-prereq: ../../../tests/arch_test x86-mmxext
+prereq: ../../../tests/x86_amd64_features x86-mmxext
vgopts: -q
Modified: trunk/none/tests/x86/insn_sse.vgtest
===================================================================
--- trunk/none/tests/x86/insn_sse.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_sse.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_sse
-prereq: ../../../tests/arch_test x86-sse
+prereq: ../../../tests/x86_amd64_features x86-sse
vgopts: -q
Modified: trunk/none/tests/x86/insn_sse2.vgtest
===================================================================
--- trunk/none/tests/x86/insn_sse2.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_sse2.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_sse2
-prereq: ../../../tests/arch_test x86-sse2
+prereq: ../../../tests/x86_amd64_features x86-sse2
vgopts: -q
Modified: trunk/none/tests/x86/insn_sse3.vgtest
===================================================================
--- trunk/none/tests/x86/insn_sse3.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_sse3.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_sse3
-prereq: ../../../tests/arch_test x86-sse3
+prereq: ../../../tests/x86_amd64_features x86-sse3
vgopts: -q
Modified: trunk/none/tests/x86/insn_ssse3.vgtest
===================================================================
--- trunk/none/tests/x86/insn_ssse3.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/insn_ssse3.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ../../../none/tests/x86/insn_ssse3
-prereq: ../../../tests/arch_test x86-ssse3
+prereq: ../../../tests/x86_amd64_features x86-ssse3
vgopts: -q
Modified: trunk/none/tests/x86/ssse3_misaligned.vgtest
===================================================================
--- trunk/none/tests/x86/ssse3_misaligned.vgtest 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/none/tests/x86/ssse3_misaligned.vgtest 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,3 +1,3 @@
prog: ssse3_misaligned
-prereq: ../../../tests/arch_test x86-ssse3
+prereq: ../../../tests/x86_amd64_features x86-ssse3
vgopts: -q
Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/tests/Makefile.am 2009-03-04 04:15:16 UTC (rev 9316)
@@ -8,7 +8,6 @@
filter_numbers \
filter_stderr_basic \
filter_sink \
- os_test \
platform_test \
vg_regtest
@@ -16,7 +15,9 @@
check_PROGRAMS = \
arch_test \
- true
+ os_test \
+ true \
+ x86_amd64_features
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
Modified: trunk/tests/arch_test.c
===================================================================
--- trunk/tests/arch_test.c 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/tests/arch_test.c 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,18 +1,19 @@
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
-// This file determines which architectures that this Valgrind installation
-// supports, which depends on the machine's architecture. It also depends
-// on the configuration options; for example, if Valgrind is installed on
-// an AMD64 machine but has been configured with --enable-only32bit then
-// this program will not match "amd64".
+// This program determines which architectures that this Valgrind installation
+// supports, which depends on the what was chosen at configure-time. For
+// example, if Valgrind is installed on an AMD64 machine but has been
+// configured with --enable-only32bit then this program will match "x86" but
+// not "amd64".
//
// We return:
-// - 0 if the machine matches the asked-for cpu
-// - 1 if it didn't match, but did match the name of another arch
-// - 2 otherwise
+// - 0 if the machine matches the asked-for arch
+// - 1 if it doesn't match but does match the name of another arch
+// - 2 if it doesn't match the name of any arch
+// - 3 if there was a usage error (it also prints an error message)
// Nb: When updating this file for a new architecture, add the name to
// 'all_archs' as well as adding go().
@@ -22,139 +23,45 @@
typedef int Bool;
char* all_archs[] = {
+ "x86",
"amd64",
"ppc32",
"ppc64",
- "x86",
NULL
};
-//-----------------------------------------------------------------------------
-// ppc32-linux
-//---------------------------------------------------------------------------
-#if defined(VGP_ppc32_linux)
-static Bool go(char* cpu)
-{
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- return False;
-}
-#endif // VGP_ppc32_linux
+static Bool go(char* arch)
+{
+#if defined(VGP_x86_linux)
+ if ( 0 == strcmp( arch, "x86" ) ) return True;
-//---------------------------------------------------------------------------
-// ppc64-linux
-//---------------------------------------------------------------------------
-#if defined(VGP_ppc64_linux)
-static Bool go(char* cpu)
-{
- if ( strcmp( cpu, "ppc64" ) == 0 )
- return True;
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- return False;
-}
-#endif // VGP_ppc64_linux
+#elif defined(VGP_amd64_linux)
+ if ( 0 == strcmp( arch, "x86" ) ) return True;
+ if ( 0 == strcmp( arch, "amd64" ) ) return True;
-//---------------------------------------------------------------------------
-// ppc{32,64}-aix
-//---------------------------------------------------------------------------
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-static Bool go(char* cpu)
-{
- if (sizeof(void*) == 8) {
- /* cpu is in 64-bit mode */
- if ( strcmp( cpu, "ppc64" ) == 0 )
- return True;
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- } else {
- if ( strcmp( cpu, "ppc32" ) == 0 )
- return True;
- }
- return False;
-}
-#endif // VGP_ppc32_aix5 || VGP_ppc64_aix5
+#elif defined(VGP_ppc32_linux)
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
-//---------------------------------------------------------------------------
-// {x86,amd64}-linux (part 1 of 2)
-//---------------------------------------------------------------------------
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux)
-static void cpuid ( unsigned int n,
- unsigned int* a, unsigned int* b,
- unsigned int* c, unsigned int* d )
-{
- __asm__ __volatile__ (
- "cpuid"
- : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d) /* output */
- : "0" (n) /* input */
- );
-}
-#endif // VGP_x86_linux || VGP_amd64_linux
+#elif defined(VGP_ppc64_linux)
+ if ( 0 == strcmp( arch, "ppc64" ) ) return True;
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
-//---------------------------------------------------------------------------
-// {x86,amd64}-linux (part 2 of 2)
-//---------------------------------------------------------------------------
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux)
-static Bool go(char* cpu)
-{
- unsigned int level = 0, cmask = 0, dmask = 0, a, b, c, d;
-
- if ( strcmp( cpu, "x86" ) == 0 ) {
- return True;
- } else if ( strcmp( cpu, "x86-fpu" ) == 0 ) {
- level = 1;
- dmask = 1 << 0;
- } else if ( strcmp( cpu, "x86-cmov" ) == 0 ) {
- level = 1;
- dmask = 1 << 15;
- } else if ( strcmp( cpu, "x86-mmx" ) == 0 ) {
- level = 1;
- dmask = 1 << 23;
- } else if ( strcmp( cpu, "x86-mmxext" ) == 0 ) {
- level = 0x80000001;
- dmask = 1 << 22;
- } else if ( strcmp( cpu, "x86-sse" ) == 0 ) {
- level = 1;
- dmask = 1 << 25;
- } else if ( strcmp( cpu, "x86-sse2" ) == 0 ) {
- level = 1;
- dmask = 1 << 26;
- } else if ( strcmp( cpu, "x86-sse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 0;
- } else if ( strcmp( cpu, "x86-ssse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 9;
-#if defined(VGA_amd64)
- } else if ( strcmp( cpu, "amd64" ) == 0 ) {
- return True;
- } else if ( strcmp( cpu, "amd64-sse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 0;
- } else if ( strcmp( cpu, "amd64-ssse3" ) == 0 ) {
- level = 1;
- cmask = 1 << 9;
-#endif
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+ if (sizeof(void*) == 8) {
+ /* CPU is in 64-bit mode */
+ if ( 0 == strcmp( arch, "ppc64" ) ) return True;
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
} else {
- return False;
+ if ( 0 == strcmp( arch, "ppc32" ) ) return True;
}
- assert( !(cmask != 0 && dmask != 0) );
- assert( !(cmask == 0 && dmask == 0) );
+#else
+# error Unknown platform
+#endif // VGP_*
- cpuid( level & 0x80000000, &a, &b, &c, &d );
-
- if ( a >= level ) {
- cpuid( level, &a, &b, &c, &d );
-
- if (dmask > 0 && (d & dmask) != 0) return True;
- if (cmask > 0 && (c & cmask) != 0) return True;
- }
return False;
}
-#endif // VGP_x86_linux || VGP_amd64_linux
-
//---------------------------------------------------------------------------
// main
//---------------------------------------------------------------------------
@@ -162,15 +69,15 @@
{
int i;
if ( argc != 2 ) {
- fprintf( stderr, "usage: arch_test <cpu-type>\n" );
- exit( 2 );
+ fprintf( stderr, "usage: arch_test <arch-type>\n" );
+ exit(3); // Usage error.
}
if (go( argv[1] )) {
- return 0; // matched
+ return 0; // Matched.
}
for (i = 0; NULL != all_archs[i]; i++) {
- if ( strcmp( argv[1], all_archs[i] ) == 0 )
- return 1;
+ if ( 0 == strcmp( argv[1], all_archs[i] ) )
+ return 1; // Didn't match, but named another arch.
}
- return 2;
+ return 2; // Didn't match any archs.
}
Added: trunk/tests/os_test.c
===================================================================
--- trunk/tests/os_test.c (rev 0)
+++ trunk/tests/os_test.c 2009-03-04 04:15:16 UTC (rev 9316)
@@ -0,0 +1,62 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// This program determines which OS that this Valgrind installation
+// supports, which depends on what was chosen at configure-time.
+//
+// We return:
+// - 0 if the machine matches the asked-for OS
+// - 1 if it doesn't match but does match the name of another OS
+// - 2 if it doesn't match the name of any OS
+// - 3 if there was a usage error (it also prints an error message)
+
+// Nb: When updating this file for a new OS, add the name to
+// 'all_OSes' as well as adding go().
+
+#define False 0
+#define True 1
+typedef int Bool;
+
+char* all_OSes[] = {
+ "linux",
+ "aix5",
+ NULL
+};
+
+static Bool go(char* OS)
+{
+#if defined(VGO_linux)
+ if ( 0 == strcmp( OS, "linux" ) ) return True;
+
+#elif defined(VGO_aix5)
+ if ( 0 == strcmp( OS, "aix5" ) ) return True;
+
+#else
+# error Unknown OS
+#endif // VGO_*
+
+ return False;
+}
+
+//---------------------------------------------------------------------------
+// main
+//---------------------------------------------------------------------------
+int main(int argc, char **argv)
+{
+ int i;
+ if ( argc != 2 ) {
+ fprintf( stderr, "usage: os_test <OS-type>\n" );
+ exit(3); // Usage error.
+ }
+ if (go( argv[1] )) {
+ return 0; // Matched.
+ }
+ for (i = 0; NULL != all_OSes[i]; i++) {
+ if ( 0 == strcmp( argv[1], all_OSes[i] ) )
+ return 1; // Didn't match, but named another OS.
+ }
+ return 2; // Didn't match any OSes.
+}
+
Deleted: trunk/tests/os_test.in
===================================================================
--- trunk/tests/os_test.in 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/tests/os_test.in 2009-03-04 04:15:16 UTC (rev 9316)
@@ -1,29 +0,0 @@
-#! /bin/sh
-
-# This script determines which OSes that this Valgrind installation
-# supports, which depends on the machine's OS.
-# We return:
-# - 0 if the machine matches the asked-for OS
-# - 1 if it didn't match, but did match the name of another OS
-# - 2 otherwise
-
-# Nb: When updating this file for a new OS, add the name to 'all_OSes'.
-
-all_OSes="linux aix5 darwin"
-
-if [ $# -ne 1 ] ; then
- echo "usage: os_test <os-type>"
- exit 2;
-fi
-
-if [ $1 = @VGCONF_OS@ ] ; then
- exit 0; # Matches this OS.
-fi
-
-for os in $all_OSes ; do
- if [ $1 = $os ] ; then
- exit 1; # Matches another Valgrind-supported OS.
- fi
-done
-
-exit 2; # Doesn't match any Valgrind-supported OS.
Modified: trunk/tests/platform_test
===================================================================
--- trunk/tests/platform_test 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/tests/platform_test 2009-03-04 04:15:16 UTC (rev 9316)
@@ -13,7 +13,6 @@
all_platforms=
all_platforms="$all_platforms x86-linux amd64-linux ppc32-linux ppc64-linux"
all_platforms="$all_platforms ppc32-aix5 ppc64-aix5"
-all_platforms="$all_platforms x86-darwin amd64-darwin"
if [ $# -ne 2 ] ; then
echo "usage: platform_test <arch-type> <OS-type>"
@@ -24,7 +23,7 @@
# as the one holding this script.
dir=`dirname $0`
-if $dir/arch_test $1 && sh $dir/os_test $2 ; then
+if $dir/arch_test $1 && $dir/os_test $2 ; then
exit 0; # Matches this platform.
fi
Modified: trunk/tests/vg_regtest.in
===================================================================
--- trunk/tests/vg_regtest.in 2009-03-04 04:11:52 UTC (rev 9315)
+++ trunk/tests/vg_regtest.in 2009-03-04 04:15:16 UTC (rev 9316)
@@ -67,13 +67,20 @@
# one stderr.exp* file. Any .exp* file that ends in '~' or '#' is ignored;
# this is because Emacs creates temporary files of these names.
#
-# The prerequisite command, if present, must return 0 otherwise the test is
-# skipped. The post-test command, if present, must return 0 and its stdout
-# must match the expected stdout which is kept in <test>.post.exp*.
-#
# If results don't match, the output can be found in <test>.std<strm>.out,
# and the diff between expected and actual in <test>.std<strm>.diff*.
#
+# The prerequisite command, if present, works like this:
+# - if it returns 0 the test is run
+# - if it returns 1 the test is skipped
+# - if it returns anything else the script aborts.
+# The idea here is results other than 0 or 1 are likely to be due to
+# problems with the commands, and you don't want to conflate them with the 1
+# case, which would happen if you just tested for zero or non-zero.
+#
+# The post-test command, if present, must return 0 and its stdout must match
+# the expected stdout which is kept in <test>.post.exp*.
+#
# Sometimes it is useful to run all the tests at a high sanity check
# level or with arbitrary other flags. To make this simple, extra
# options, applied to all tests run, are read from $EXTRA_REGTEST_OPTS,
@@ -308,9 +315,18 @@
read_vgtest_file($vgtest);
if (defined $prereq) {
- if (system("$prereq") != 0) {
+ my $prereq_res = system("$prereq");
+ if (0 == $prereq_res) {
+ # Do nothing (ie. continue with the test)
+ } elsif (256 == $prereq_res) {
+ # Nb: weird Perl-ism -- exit code of '1' is seen by Perl as 256...
+ # Prereq failed, skip.
printf("%-16s (skipping, prereq failed: $prereq)\n", "$name:");
return;
+ } else {
+ # Bad prereq; abort.
+ $prereq_res /= 256;
+ die "prereq returned $prereq_res: $prereq\n";
}
}
@@ -386,8 +402,8 @@
# ppc/ directories ('arch_test' returns 1 for this case). Likewise for
# the OS and platform.
# Nb: weird Perl-ism -- exit code of '1' is seen by Perl as 256...
- if (256 == system( "$tests_dir/tests/arch_test $dir")) { return; }
- if (256 == system("sh $tests_dir/tests/os_test $dir")) { return; }
+ if (256 == system("$tests_dir/tests/arch_test $dir")) { return; }
+ if (256 == system("$tests_dir/tests/os_test $dir")) { return; }
if ($dir =~ /(\w+)-(\w+)/ &&
256 == system("sh $tests_dir/tests/platform_test $1 $2")) { return; }
|
|
From: <sv...@va...> - 2009-03-04 04:12:01
|
Author: njn
Date: 2009-03-04 04:11:52 +0000 (Wed, 04 Mar 2009)
New Revision: 9315
Log:
Avoid using %ebx in the insn_* tests, because it's the PIC register and
must not be clobbered (PIC is apparently on by default on Darwin). They all
now give the right stdout output, and the stderr output is wrong only
because of a warning about sigaction() being unimplemented.
Modified:
branches/DARWIN/none/tests/x86/Makefile.am
branches/DARWIN/none/tests/x86/gen_insn_test.pl
branches/DARWIN/none/tests/x86/insn_basic.def
Modified: branches/DARWIN/none/tests/x86/Makefile.am
===================================================================
--- branches/DARWIN/none/tests/x86/Makefile.am 2009-03-04 01:23:04 UTC (rev 9314)
+++ branches/DARWIN/none/tests/x86/Makefile.am 2009-03-04 04:11:52 UTC (rev 9315)
@@ -65,6 +65,7 @@
cse_fail \
fpu_lazy_eflags \
getseg \
+ $(INSN_TESTS) \
movx int pushpopseg \
smc1 yield
if BUILD_SSSE3_TESTS
@@ -84,7 +85,6 @@
fcmovnu \
fxtract \
incdec_alt \
- $(INSN_TESTS) \
jcxz \
lahf \
looper \
Modified: branches/DARWIN/none/tests/x86/gen_insn_test.pl
===================================================================
--- branches/DARWIN/none/tests/x86/gen_insn_test.pl 2009-03-04 01:23:04 UTC (rev 9314)
+++ branches/DARWIN/none/tests/x86/gen_insn_test.pl 2009-03-04 04:11:52 UTC (rev 9315)
@@ -48,34 +48,36 @@
);
our %RegNums = (
+ # We avoid using %ebx and %bx because %ebx is the PIC
+ # register on Darwin and so cannot be clobbered.
al => 0, ax => 0, eax => 0,
- bl => 1, bx => 1, ebx => 1,
- cl => 2, cx => 2, ecx => 2,
- dl => 3, dx => 3, edx => 3,
+ cl => 1, cx => 1, ecx => 1,
+ dl => 2, dx => 2, edx => 2,
+ bl => 3, si => 3, esi => 3,
ah => 4,
- bh => 5,
- ch => 6,
- dh => 7,
+ ch => 5,
+ dh => 6,
+ bh => 7,
st0 => 0, st1 => 1, st2 => 2, st3 => 3,
st4 => 4, st5 => 5, st6 => 6, st7 => 7
);
our %RegTypes = (
al => "r8", ah => "r8", ax => "r16", eax => "r32",
- bl => "r8", bh => "r8", bx => "r16", ebx => "r32",
cl => "r8", ch => "r8", cx => "r16", ecx => "r32",
- dl => "r8", dh => "r8", dx => "r16", edx => "r32"
+ dl => "r8", dh => "r8", dx => "r16", edx => "r32",
+ bl => "r8", bh => "r8", si => "r16", esi => "r32"
);
our @IntRegs = (
{ r8 => "al", r16 => "ax", r32 => "eax" },
- { r8 => "bl", r16 => "bx", r32 => "ebx" },
{ r8 => "cl", r16 => "cx", r32 => "ecx" },
{ r8 => "dl", r16 => "dx", r32 => "edx" },
+ { r8 => "bl", r16 => "si", r32 => "esi" },
{ r8 => "ah" },
- { r8 => "bh" },
{ r8 => "ch" },
- { r8 => "dh" }
+ { r8 => "dh" },
+ { r8 => "bh" }
);
print <<EOF;
@@ -328,7 +330,7 @@
{
my $name = "arg$argc";
- if ($arg =~ /^([abcd]l|[abcd]x|e[abcd]x|r8|r16|r32|mm|xmm|m8|m16|m32|m64|m128)\.(sb|ub|sw|uw|sd|ud|sq|uq|ps|pd)\[([^\]]+)\]$/)
+ if ($arg =~ /^([abcd]l|[abcd]x|e[abcd]x|si|esi|r8|r16|r32|mm|xmm|m8|m16|m32|m64|m128)\.(sb|ub|sw|uw|sd|ud|sq|uq|ps|pd)\[([^\]]+)\]$/)
{
my $type = $RegTypes{$1} || $1;
my $regnum = $RegNums{$1};
Modified: branches/DARWIN/none/tests/x86/insn_basic.def
===================================================================
--- branches/DARWIN/none/tests/x86/insn_basic.def 2009-03-04 01:23:04 UTC (rev 9314)
+++ branches/DARWIN/none/tests/x86/insn_basic.def 2009-03-04 04:11:52 UTC (rev 9315)
@@ -20,8 +20,8 @@
###aas eflags[0x11,0x10] al.ub[0xf] ah.ub[0x2] : => al.ub[0x9] ah.ub[0x01] eflags[0x11,0x11]
adcb eflags[0x1,0x0] : imm8[12] al.ub[34] => 1.ub[46]
adcb eflags[0x1,0x1] : imm8[12] al.ub[34] => 1.ub[47]
-adcb eflags[0x1,0x0] : imm8[12] bl.ub[34] => 1.ub[46]
-adcb eflags[0x1,0x1] : imm8[12] bl.ub[34] => 1.ub[47]
+adcb eflags[0x1,0x0] : imm8[12] cl.ub[34] => 1.ub[46]
+adcb eflags[0x1,0x1] : imm8[12] cl.ub[34] => 1.ub[47]
adcb eflags[0x1,0x0] : imm8[12] m8.ub[34] => 1.ub[46]
adcb eflags[0x1,0x1] : imm8[12] m8.ub[34] => 1.ub[47]
adcb eflags[0x1,0x0] : r8.ub[12] r8.ub[34] => 1.ub[46]
@@ -34,8 +34,8 @@
adcw eflags[0x1,0x1] : imm8[12] r16.uw[3456] => 1.uw[3469]
adcw eflags[0x1,0x0] : imm16[1234] ax.uw[5678] => 1.uw[6912]
adcw eflags[0x1,0x1] : imm16[1234] ax.uw[5678] => 1.uw[6913]
-adcw eflags[0x1,0x0] : imm16[1234] bx.uw[5678] => 1.uw[6912]
-adcw eflags[0x1,0x1] : imm16[1234] bx.uw[5678] => 1.uw[6913]
+adcw eflags[0x1,0x0] : imm16[1234] si.uw[5678] => 1.uw[6912]
+adcw eflags[0x1,0x1] : imm16[1234] si.uw[5678] => 1.uw[6913]
adcw eflags[0x1,0x0] : imm16[1234] m16.uw[5678] => 1.uw[6912]
adcw eflags[0x1,0x1] : imm16[1234] m16.uw[5678] => 1.uw[6913]
adcw eflags[0x1,0x0] : r16.uw[1234] r16.uw[5678] => 1.uw[6912]
@@ -48,8 +48,8 @@
adcl eflags[0x1,0x1] : imm8[12] r32.ud[87654321] => 1.ud[87654334]
adcl eflags[0x1,0x0] : imm32[12345678] eax.ud[87654321] => 1.ud[99999999]
adcl eflags[0x1,0x1] : imm32[12345678] eax.ud[87654321] => 1.ud[100000000]
-adcl eflags[0x1,0x0] : imm32[12345678] ebx.ud[87654321] => 1.ud[99999999]
-adcl eflags[0x1,0x1] : imm32[12345678] ebx.ud[87654321] => 1.ud[100000000]
+adcl eflags[0x1,0x0] : imm32[12345678] esi.ud[87654321] => 1.ud[99999999]
+adcl eflags[0x1,0x1] : imm32[12345678] esi.ud[87654321] => 1.ud[100000000]
adcl eflags[0x1,0x0] : imm32[12345678] m32.ud[87654321] => 1.ud[99999999]
adcl eflags[0x1,0x1] : imm32[12345678] m32.ud[87654321] => 1.ud[100000000]
adcl eflags[0x1,0x0] : r32.ud[12345678] r32.ud[87654321] => 1.ud[99999999]
@@ -59,41 +59,41 @@
adcl eflags[0x1,0x0] : m32.ud[12345678] r32.ud[87654321] => 1.ud[99999999]
adcl eflags[0x1,0x1] : m32.ud[12345678] r32.ud[87654321] => 1.ud[100000000]
addb imm8[12] al.ub[34] => 1.ub[46]
-addb imm8[12] bl.ub[34] => 1.ub[46]
+addb imm8[12] cl.ub[34] => 1.ub[46]
addb imm8[12] m8.ub[34] => 1.ub[46]
addb r8.ub[12] r8.ub[34] => 1.ub[46]
addb r8.ub[12] m8.ub[34] => 1.ub[46]
addb m8.ub[12] r8.ub[34] => 1.ub[46]
addw imm8[12] r16.uw[3456] => 1.uw[3468]
addw imm16[1234] ax.uw[5678] => 1.uw[6912]
-addw imm16[1234] bx.uw[5678] => 1.uw[6912]
+addw imm16[1234] si.uw[5678] => 1.uw[6912]
addw imm16[1234] m16.uw[5678] => 1.uw[6912]
addw r16.uw[1234] r16.uw[5678] => 1.uw[6912]
addw r16.uw[1234] m16.uw[5678] => 1.uw[6912]
addw m16.uw[1234] r16.uw[5678] => 1.uw[6912]
addl imm8[12] r32.ud[87654321] => 1.ud[87654333]
addl imm32[12345678] eax.ud[87654321] => 1.ud[99999999]
-addl imm32[12345678] ebx.ud[87654321] => 1.ud[99999999]
+addl imm32[12345678] esi.ud[87654321] => 1.ud[99999999]
addl imm32[12345678] m32.ud[87654321] => 1.ud[99999999]
addl r32.ud[12345678] r32.ud[87654321] => 1.ud[99999999]
addl r32.ud[12345678] m32.ud[87654321] => 1.ud[99999999]
addl m32.ud[12345678] r32.ud[87654321] => 1.ud[99999999]
andb imm8[0x34] al.ub[0x56] => 1.ub[0x14]
-andb imm8[0x34] bl.ub[0x56] => 1.ub[0x14]
+andb imm8[0x34] cl.ub[0x56] => 1.ub[0x14]
andb imm8[0x34] m8.ub[0x56] => 1.ub[0x14]
andb r8.ub[0x34] r8.ub[0x56] => 1.ub[0x14]
andb r8.ub[0x34] m8.ub[0x56] => 1.ub[0x14]
andb m8.ub[0x34] r8.ub[0x56] => 1.ub[0x14]
andw imm8[0x31] r16.uw[0x1234] => 1.uw[0x0030]
andw imm16[0x4231] ax.uw[0x1234] => 1.uw[0x0230]
-andw imm16[0x4231] bx.uw[0x1234] => 1.uw[0x0230]
+andw imm16[0x4231] si.uw[0x1234] => 1.uw[0x0230]
andw imm16[0x4231] m16.uw[0x1234] => 1.uw[0x0230]
andw r16.uw[0x4231] r16.uw[0x1234] => 1.uw[0x0230]
andw r16.uw[0x4231] m16.uw[0x1234] => 1.uw[0x0230]
andw m16.uw[0x4231] r16.uw[0x1234] => 1.uw[0x0230]
andl imm8[0x31] r32.ud[0x12345678] => 1.ud[0x00000030]
andl imm32[0x86427531] eax.ud[0x12345678] => 1.ud[0x02005430]
-andl imm32[0x86427531] ebx.ud[0x12345678] => 1.ud[0x02005430]
+andl imm32[0x86427531] esi.ud[0x12345678] => 1.ud[0x02005430]
andl imm32[0x86427531] m32.ud[0x12345678] => 1.ud[0x02005430]
andl r32.ud[0x86427531] r32.ud[0x12345678] => 1.ud[0x02005430]
andl r32.ud[0x86427531] m32.ud[0x12345678] => 1.ud[0x02005430]
@@ -514,21 +514,21 @@
notl r32.ud[0xff00f0ca] => 0.ud[0x00ff0f35]
notl m32.ud[0xff00f0ca] => 0.ud[0x00ff0f35]
orb imm8[0x34] al.ub[0x56] => 1.ub[0x76]
-orb imm8[0x34] bl.ub[0x56] => 1.ub[0x76]
+orb imm8[0x34] cl.ub[0x56] => 1.ub[0x76]
orb imm8[0x34] m8.ub[0x56] => 1.ub[0x76]
orb r8.ub[0x34] r8.ub[0x56] => 1.ub[0x76]
orb r8.ub[0x34] m8.ub[0x56] => 1.ub[0x76]
orb m8.ub[0x34] r8.ub[0x56] => 1.ub[0x76]
orw imm8[0x31] r16.uw[0x1234] => 1.uw[0x1235]
orw imm16[0x4231] ax.uw[0x1234] => 1.uw[0x5235]
-orw imm16[0x4231] bx.uw[0x1234] => 1.uw[0x5235]
+orw imm16[0x4231] si.uw[0x1234] => 1.uw[0x5235]
orw imm16[0x4231] m16.uw[0x1234] => 1.uw[0x5235]
orw r16.uw[0x4231] r16.uw[0x1234] => 1.uw[0x5235]
orw r16.uw[0x4231] m16.uw[0x1234] => 1.uw[0x5235]
orw m16.uw[0x4231] r16.uw[0x1234] => 1.uw[0x5235]
orl imm8[0x31] r32.ud[0x12345678] => 1.ud[0x12345679]
orl imm32[0x86427531] eax.ud[0x12345678] => 1.ud[0x96767779]
-orl imm32[0x86427531] ebx.ud[0x12345678] => 1.ud[0x96767779]
+orl imm32[0x86427531] esi.ud[0x12345678] => 1.ud[0x96767779]
orl imm32[0x86427531] m32.ud[0x12345678] => 1.ud[0x96767779]
orl r32.ud[0x86427531] r32.ud[0x12345678] => 1.ud[0x96767779]
orl r32.ud[0x86427531] m32.ud[0x12345678] => 1.ud[0x96767779]
@@ -645,8 +645,8 @@
sarl cl.ub[8] m32.ud[0xff00f0ca] => 1.ud[0xffff00f0]
sbbb eflags[0x1,0x0] : imm8[12] al.ub[34] => 1.ub[22]
sbbb eflags[0x1,0x1] : imm8[12] al.ub[34] => 1.ub[21]
-sbbb eflags[0x1,0x0] : imm8[12] bl.ub[34] => 1.ub[22]
-sbbb eflags[0x1,0x1] : imm8[12] bl.ub[34] => 1.ub[21]
+sbbb eflags[0x1,0x0] : imm8[12] cl.ub[34] => 1.ub[22]
+sbbb eflags[0x1,0x1] : imm8[12] cl.ub[34] => 1.ub[21]
sbbb eflags[0x1,0x0] : imm8[12] m8.ub[34] => 1.ub[22]
sbbb eflags[0x1,0x1] : imm8[12] m8.ub[34] => 1.ub[21]
sbbb eflags[0x1,0x0] : r8.ub[12] r8.ub[34] => 1.ub[22]
@@ -659,8 +659,8 @@
sbbw eflags[0x1,0x1] : imm8[12] r16.uw[3456] => 1.uw[3443]
sbbw eflags[0x1,0x0] : imm16[1234] ax.uw[5678] => 1.uw[4444]
sbbw eflags[0x1,0x1] : imm16[1234] ax.uw[5678] => 1.uw[4443]
-sbbw eflags[0x1,0x0] : imm16[1234] bx.uw[5678] => 1.uw[4444]
-sbbw eflags[0x1,0x1] : imm16[1234] bx.uw[5678] => 1.uw[4443]
+sbbw eflags[0x1,0x0] : imm16[1234] si.uw[5678] => 1.uw[4444]
+sbbw eflags[0x1,0x1] : imm16[1234] si.uw[5678] => 1.uw[4443]
sbbw eflags[0x1,0x0] : imm16[1234] m16.uw[5678] => 1.uw[4444]
sbbw eflags[0x1,0x1] : imm16[1234] m16.uw[5678] => 1.uw[4443]
sbbw eflags[0x1,0x0] : r16.uw[1234] r16.uw[5678] => 1.uw[4444]
@@ -673,8 +673,8 @@
sbbl eflags[0x1,0x1] : imm8[12] r32.ud[87654321] => 1.ud[87654308]
sbbl eflags[0x1,0x0] : imm32[12345678] eax.ud[87654321] => 1.ud[75308643]
sbbl eflags[0x1,0x1] : imm32[12345678] eax.ud[87654321] => 1.ud[75308642]
-sbbl eflags[0x1,0x0] : imm32[12345678] ebx.ud[87654321] => 1.ud[75308643]
-sbbl eflags[0x1,0x1] : imm32[12345678] ebx.ud[87654321] => 1.ud[75308642]
+sbbl eflags[0x1,0x0] : imm32[12345678] esi.ud[87654321] => 1.ud[75308643]
+sbbl eflags[0x1,0x1] : imm32[12345678] esi.ud[87654321] => 1.ud[75308642]
sbbl eflags[0x1,0x0] : imm32[12345678] m32.ud[87654321] => 1.ud[75308643]
sbbl eflags[0x1,0x1] : imm32[12345678] m32.ud[87654321] => 1.ud[75308642]
sbbl eflags[0x1,0x0] : r32.ud[12345678] r32.ud[87654321] => 1.ud[75308643]
@@ -948,14 +948,14 @@
std eflags[0x400,0x000] : => eflags[0x400,0x400]
std eflags[0x400,0x400] : => eflags[0x400,0x400]
subb imm8[12] al.ub[34] => 1.ub[22]
-subb imm8[12] bl.ub[34] => 1.ub[22]
+subb imm8[12] cl.ub[34] => 1.ub[22]
subb imm8[12] m8.ub[34] => 1.ub[22]
subb r8.ub[12] r8.ub[34] => 1.ub[22]
subb r8.ub[12] m8.ub[34] => 1.ub[22]
subb m8.ub[12] r8.ub[34] => 1.ub[22]
subw imm8[12] r16.uw[3456] => 1.uw[3444]
subw imm16[1234] ax.uw[5678] => 1.uw[4444]
-subw imm16[1234] bx.uw[5678] => 1.uw[4444]
+subw imm16[1234] si.uw[5678] => 1.uw[4444]
subw imm16[1234] m16.uw[5678] => 1.uw[4444]
subw r16.uw[1234] r16.uw[5678] => 1.uw[4444]
subw r16.uw[1234] m16.uw[5678] => 1.uw[4444]
@@ -963,7 +963,7 @@
subl imm8[12] r32.ud[87654321] => 1.ud[87654309]
subl imm32[12345678] r32.ud[87654321] => 1.ud[75308643]
subl imm32[12345678] eax.ud[87654321] => 1.ud[75308643]
-subl imm32[12345678] ebx.ud[87654321] => 1.ud[75308643]
+subl imm32[12345678] esi.ud[87654321] => 1.ud[75308643]
subl r32.ud[12345678] r32.ud[87654321] => 1.ud[75308643]
subl r32.ud[12345678] m32.ud[87654321] => 1.ud[75308643]
subl m32.ud[12345678] r32.ud[87654321] => 1.ud[75308643]
@@ -972,11 +972,11 @@
testb imm8[0x1a] al.ub[0xa1] => eflags[0x8c5,0x044]
testb imm8[0xa1] al.ub[0xa1] => eflags[0x8c5,0x080]
testb imm8[0xa5] al.ub[0xa5] => eflags[0x8c5,0x084]
-testb imm8[0x1a] bl.ub[0x1a] => eflags[0x8c5,0x000]
-testb imm8[0x5a] bl.ub[0x5a] => eflags[0x8c5,0x004]
-testb imm8[0x1a] bl.ub[0xa1] => eflags[0x8c5,0x044]
-testb imm8[0xa1] bl.ub[0xa1] => eflags[0x8c5,0x080]
-testb imm8[0xa5] bl.ub[0xa5] => eflags[0x8c5,0x084]
+testb imm8[0x1a] cl.ub[0x1a] => eflags[0x8c5,0x000]
+testb imm8[0x5a] cl.ub[0x5a] => eflags[0x8c5,0x004]
+testb imm8[0x1a] cl.ub[0xa1] => eflags[0x8c5,0x044]
+testb imm8[0xa1] cl.ub[0xa1] => eflags[0x8c5,0x080]
+testb imm8[0xa5] cl.ub[0xa5] => eflags[0x8c5,0x084]
testb imm8[0x1a] m8.ub[0x1a] => eflags[0x8c5,0x000]
testb imm8[0x5a] m8.ub[0x5a] => eflags[0x8c5,0x004]
testb imm8[0x1a] m8.ub[0xa1] => eflags[0x8c5,0x044]
@@ -997,11 +997,11 @@
testw imm16[0x1a1a] ax.uw[0xa1a1] => eflags[0x8c5,0x044]
testw imm16[0xa1a1] ax.uw[0xa1a1] => eflags[0x8c5,0x080]
testw imm16[0xa5a5] ax.uw[0xa5a5] => eflags[0x8c5,0x084]
-testw imm16[0x1a1a] bx.uw[0x1a1a] => eflags[0x8c5,0x000]
-testw imm16[0x5a5a] bx.uw[0x5a5a] => eflags[0x8c5,0x004]
-testw imm16[0x1a1a] bx.uw[0xa1a1] => eflags[0x8c5,0x044]
-testw imm16[0xa1a1] bx.uw[0xa1a1] => eflags[0x8c5,0x080]
-testw imm16[0xa5a5] bx.uw[0xa5a5] => eflags[0x8c5,0x084]
+testw imm16[0x1a1a] si.uw[0x1a1a] => eflags[0x8c5,0x000]
+testw imm16[0x5a5a] si.uw[0x5a5a] => eflags[0x8c5,0x004]
+testw imm16[0x1a1a] si.uw[0xa1a1] => eflags[0x8c5,0x044]
+testw imm16[0xa1a1] si.uw[0xa1a1] => eflags[0x8c5,0x080]
+testw imm16[0xa5a5] si.uw[0xa5a5] => eflags[0x8c5,0x084]
testw imm16[0x1a1a] m16.uw[0x1a1a] => eflags[0x8c5,0x000]
testw imm16[0x5a5a] m16.uw[0x5a5a] => eflags[0x8c5,0x004]
testw imm16[0x1a1a] m16.uw[0xa1a1] => eflags[0x8c5,0x044]
@@ -1022,11 +1022,11 @@
testl imm32[0x1a1a1a1a] eax.ud[0xa1a1a1a1] => eflags[0x8c5,0x044]
testl imm32[0xa1a1a1a1] eax.ud[0xa1a1a1a1] => eflags[0x8c5,0x080]
testl imm32[0xa5a5a5a5] eax.ud[0xa5a5a5a5] => eflags[0x8c5,0x084]
-testl imm32[0x1a1a1a1a] ebx.ud[0x1a1a1a1a] => eflags[0x8c5,0x000]
-testl imm32[0x5a5a5a5a] ebx.ud[0x5a5a5a5a] => eflags[0x8c5,0x004]
-testl imm32[0x1a1a1a1a] ebx.ud[0xa1a1a1a1] => eflags[0x8c5,0x044]
-testl imm32[0xa1a1a1a1] ebx.ud[0xa1a1a1a1] => eflags[0x8c5,0x080]
-testl imm32[0xa5a5a5a5] ebx.ud[0xa5a5a5a5] => eflags[0x8c5,0x084]
+testl imm32[0x1a1a1a1a] esi.ud[0x1a1a1a1a] => eflags[0x8c5,0x000]
+testl imm32[0x5a5a5a5a] esi.ud[0x5a5a5a5a] => eflags[0x8c5,0x004]
+testl imm32[0x1a1a1a1a] esi.ud[0xa1a1a1a1] => eflags[0x8c5,0x044]
+testl imm32[0xa1a1a1a1] esi.ud[0xa1a1a1a1] => eflags[0x8c5,0x080]
+testl imm32[0xa5a5a5a5] esi.ud[0xa5a5a5a5] => eflags[0x8c5,0x084]
testl imm32[0x1a1a1a1a] m32.ud[0x1a1a1a1a] => eflags[0x8c5,0x000]
testl imm32[0x5a5a5a5a] m32.ud[0x5a5a5a5a] => eflags[0x8c5,0x004]
testl imm32[0x1a1a1a1a] m32.ud[0xa1a1a1a1] => eflags[0x8c5,0x044]
@@ -1051,32 +1051,32 @@
xchgb r8.ub[12] r8.ub[34] => 0.ub[34] 1.ub[12]
xchgb r8.ub[12] m8.ub[34] => 0.ub[34] 1.ub[12]
xchgb m8.ub[12] r8.ub[34] => 0.ub[34] 1.ub[12]
-xchgw ax.uw[1234] bx.uw[5678] => 0.uw[5678] 1.uw[1234]
-xchgw bx.uw[1234] ax.uw[5678] => 0.uw[5678] 1.uw[1234]
+xchgw ax.uw[1234] si.uw[5678] => 0.uw[5678] 1.uw[1234]
+xchgw si.uw[1234] ax.uw[5678] => 0.uw[5678] 1.uw[1234]
xchgw ax.uw[1234] cx.uw[5678] => 0.uw[5678] 1.uw[1234]
xchgw r16.uw[1234] m16.uw[5678] => 0.uw[5678] 1.uw[1234]
xchgw m16.uw[1234] r16.uw[5678] => 0.uw[5678] 1.uw[1234]
-xchgl eax.ud[12345678] ebx.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
-xchgl ebx.ud[12345678] eax.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
-xchgl ebx.ud[12345678] ecx.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
+xchgl eax.ud[12345678] esi.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
+xchgl esi.ud[12345678] eax.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
+xchgl esi.ud[12345678] ecx.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
xchgl r32.ud[12345678] m32.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
xchgl m32.ud[12345678] r32.ud[87654321] => 0.ud[87654321] 1.ud[12345678]
xorb imm8[0x34] al.ub[0x56] => 1.ub[0x62]
-xorb imm8[0x34] bl.ub[0x56] => 1.ub[0x62]
+xorb imm8[0x34] cl.ub[0x56] => 1.ub[0x62]
xorb imm8[0x34] m8.ub[0x56] => 1.ub[0x62]
xorb r8.ub[0x34] r8.ub[0x56] => 1.ub[0x62]
xorb r8.ub[0x34] m8.ub[0x56] => 1.ub[0x62]
xorb m8.ub[0x34] r8.ub[0x56] => 1.ub[0x62]
xorw imm8[0x31] r16.uw[0x1234] => 1.uw[0x1205]
xorw imm16[0x4231] ax.uw[0x1234] => 1.uw[0x5005]
-xorw imm16[0x4231] bx.uw[0x1234] => 1.uw[0x5005]
+xorw imm16[0x4231] si.uw[0x1234] => 1.uw[0x5005]
xorw imm16[0x4231] m16.uw[0x1234] => 1.uw[0x5005]
xorw r16.uw[0x4231] r16.uw[0x1234] => 1.uw[0x5005]
xorw r16.uw[0x4231] m16.uw[0x1234] => 1.uw[0x5005]
xorw m16.uw[0x4231] r16.uw[0x1234] => 1.uw[0x5005]
xorl imm8[0x31] r32.ud[0x12345678] => 1.ud[0x12345649]
xorl imm32[0x86427531] eax.ud[0x12345678] => 1.ud[0x94762349]
-xorl imm32[0x86427531] ebx.ud[0x12345678] => 1.ud[0x94762349]
+xorl imm32[0x86427531] esi.ud[0x12345678] => 1.ud[0x94762349]
xorl imm32[0x86427531] m32.ud[0x12345678] => 1.ud[0x94762349]
xorl r32.ud[0x86427531] r32.ud[0x12345678] => 1.ud[0x94762349]
xorl r32.ud[0x86427531] m32.ud[0x12345678] => 1.ud[0x94762349]
|
|
From: Tom H. <th...@cy...> - 2009-03-04 03:48:43
|
Nightly build on vauxhall ( x86_64, Fedora 10 ) started at 2009-03-04 03:20:05 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
== 485 tests, 1 stderr failure, 0 stdout failures, 0 post failures ==
helgrind/tests/hg05_race2 (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
== 485 tests, 0 stderr failures, 0 stdout failures, 0 post failures ==
=================================================
== Difference between 24 hours ago and now ==
=================================================
*** old.short Wed Mar 4 03:34:30 2009
--- new.short Wed Mar 4 03:48:39 2009
***************
*** 4,6 ****
Building valgrind ... done
! Running regression tests ... done
--- 4,6 ----
Building valgrind ... done
! Running regression tests ... failed
***************
*** 8,10 ****
! == 485 tests, 0 stderr failures, 0 stdout failures, 0 post failures ==
--- 8,11 ----
! == 485 tests, 1 stderr failure, 0 stdout failures, 0 post failures ==
! helgrind/tests/hg05_race2 (stderr)
|
|
From: Tom H. <th...@cy...> - 2009-03-04 03:44:56
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2009-03-04 03:05:06 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 == 476 tests, 5 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) |
|
From: Tom H. <th...@cy...> - 2009-03-04 03:32:13
|
Nightly build on mg ( x86_64, Fedora 9 ) started at 2009-03-04 03:10:06 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 == 482 tests, 4 stderr failures, 2 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) memcheck/tests/linux/timerfd-syscall (stdout) none/tests/linux/mremap2 (stdout) |
|
From: <sv...@va...> - 2009-03-04 01:23:08
|
Author: njn
Date: 2009-03-04 01:23:04 +0000 (Wed, 04 Mar 2009)
New Revision: 9314
Log:
Remove darwin code that crept into the trunk.
Modified:
trunk/tests/arch_test.c
Modified: trunk/tests/arch_test.c
===================================================================
--- trunk/tests/arch_test.c 2009-03-03 06:29:26 UTC (rev 9313)
+++ trunk/tests/arch_test.c 2009-03-04 01:23:04 UTC (rev 9314)
@@ -92,39 +92,9 @@
#endif // VGP_x86_linux || VGP_amd64_linux
//---------------------------------------------------------------------------
-// {x86,amd64}-darwin (part 1 of 2)
+// {x86,amd64}-linux (part 2 of 2)
//---------------------------------------------------------------------------
-#if defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
-static void cpuid ( unsigned int n,
- unsigned int* a, unsigned int* b,
- unsigned int* c, unsigned int* d )
-{
- __asm__ __volatile__ (
- "pushl %%eax\n\t"
- "pushl %%ebx\n\t"
- "pushl %%ecx\n\t"
- "pushl %%edx\n\t"
- "movl %4, %%eax\n\t"
- "cpuid\n\t"
- "movl %%eax,%0\n\t"
- "movl %%ebx,%1\n\t"
- "movl %%ecx,%2\n\t"
- "movl %%edx,%3\n\t"
- "popl %%edx\n\t"
- "popl %%ecx\n\t"
- "popl %%ebx\n\t"
- "popl %%eax\n\t"
- : "=m" (*a), "=m" (*b), "=m" (*c), "=m" (*d)
- : "mr" (n)
- );
-}
-#endif // VGP_x86_darwin || VGP_amd64_darwin
-
-//---------------------------------------------------------------------------
-// {x86,amd64}-{linux,darwin} (part 2 of 2)
-//---------------------------------------------------------------------------
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux) || \
- defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
+#if defined(VGP_x86_linux) || defined(VGP_amd64_linux)
static Bool go(char* cpu)
{
unsigned int level = 0, cmask = 0, dmask = 0, a, b, c, d;
@@ -182,8 +152,7 @@
}
return False;
}
-#endif // VGP_x86_linux || VGP_amd64_linux ||
- // VGP_x86_darwin || VGP_amd64_darwin
+#endif // VGP_x86_linux || VGP_amd64_linux
//---------------------------------------------------------------------------
|