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
(11) |
2
(9) |
3
(14) |
4
(18) |
5
(13) |
|
6
(4) |
7
(12) |
8
(16) |
9
(14) |
10
(8) |
11
(9) |
12
(7) |
|
13
(12) |
14
(6) |
15
(14) |
16
(5) |
17
(10) |
18
(8) |
19
(5) |
|
20
(10) |
21
(16) |
22
(5) |
23
(14) |
24
(10) |
25
(11) |
26
(6) |
|
27
(9) |
28
(8) |
29
(11) |
30
(9) |
31
(18) |
|
|
|
From: <sv...@va...> - 2008-01-04 23:58:30
|
Author: tom
Date: 2008-01-04 23:58:32 +0000 (Fri, 04 Jan 2008)
New Revision: 7316
Log:
Add const qualifiers to fix compiler warnings.
Patch from Bart Van Assche <bar...@gm...>.
Modified:
trunk/memcheck/tests/oset_test.c
Modified: trunk/memcheck/tests/oset_test.c
===================================================================
--- trunk/memcheck/tests/oset_test.c 2008-01-04 23:57:15 UTC (rev 7315)
+++ trunk/memcheck/tests/oset_test.c 2008-01-04 23:58:32 UTC (rev 7316)
@@ -347,10 +347,10 @@
return buf;
}
-static Word blockCmp(void* vkey, void* velem)
+static Word blockCmp(const void* vkey, const void* velem)
{
- Addr key = *(Addr*)vkey;
- Block* elem = (Block*)velem;
+ Addr key = *(const Addr*)vkey;
+ const Block* elem = (const Block*)velem;
assert(elem->first <= elem->last);
if (key < elem->first) return -1;
|
|
From: <sv...@va...> - 2008-01-04 23:57:16
|
Author: tom Date: 2008-01-04 23:57:15 +0000 (Fri, 04 Jan 2008) New Revision: 7315 Log: Add missing include to fix compiler warning. Patch from Bart Van Assche <bar...@gm...>. Modified: trunk/exp-drd/drd_segment.c Modified: trunk/exp-drd/drd_segment.c =================================================================== --- trunk/exp-drd/drd_segment.c 2008-01-04 23:55:27 UTC (rev 7314) +++ trunk/exp-drd/drd_segment.c 2008-01-04 23:57:15 UTC (rev 7315) @@ -31,6 +31,7 @@ #include "pub_tool_libcassert.h" // tl_assert() #include "pub_tool_libcbase.h" // VG_(strlen)() #include "pub_tool_libcprint.h" // VG_(printf)() +#include "pub_tool_machine.h" // VG_(get_SP)() #include "pub_tool_mallocfree.h" // VG_(malloc)(), VG_(free)() #include "pub_tool_threadstate.h" // VG_INVALID_THREADID |
|
From: <sv...@va...> - 2008-01-04 23:55:26
|
Author: tom
Date: 2008-01-04 23:55:27 +0000 (Fri, 04 Jan 2008)
New Revision: 7314
Log:
Fix compiler warning.
Patch from Bart Van Assche <bar...@gm...>.
Modified:
trunk/memcheck/tests/sigprocmask.c
Modified: trunk/memcheck/tests/sigprocmask.c
===================================================================
--- trunk/memcheck/tests/sigprocmask.c 2008-01-04 13:09:44 UTC (rev 7313)
+++ trunk/memcheck/tests/sigprocmask.c 2008-01-04 23:55:27 UTC (rev 7314)
@@ -11,10 +11,10 @@
int main(void)
{
+#if defined(__NR_sigprocmask) && !defined(__powerpc64__) && !defined(_AIX)
+
int x[6], *s, *os, i;
-#if defined(__NR_sigprocmask) && !defined(__powerpc64__) && !defined(_AIX)
-
x[0] = 0x11111111;
x[1] = 0x89abcdef;
x[2] = 0x22222222;
|
|
From: Bart V. A. <bar...@gm...> - 2008-01-04 20:30:54
|
I had a look at the non-drd regression test that fail on all
platforms. Is the patch below a correct fix for the
memcheck/tests/pointer-trace regression test ?
Index: memcheck/tests/pointer-trace.stderr.exp
===================================================================
--- memcheck/tests/pointer-trace.stderr.exp (revision 7313)
+++ memcheck/tests/pointer-trace.stderr.exp (working copy)
@@ -19,12 +19,10 @@
1,048,576 bytes in 1 blocks are definitely lost in loss record 1 of 1
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (pointer-trace.c:43)
+ by 0x........: main (pointer-trace.c:47)
LEAK SUMMARY:
definitely lost: 1,048,576 bytes in 1 blocks.
possibly lost: 0 bytes in 0 blocks.
still reachable: 0 bytes in 0 blocks.
suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --leak-check=full --show-reachable=yes
|
|
From: Bart V. A. <bar...@gm...> - 2008-01-04 20:02:42
|
Can the attached patch please be reviewed and applied ? Thanks, Bart. |
|
From: Bart V. A. <bar...@gm...> - 2008-01-04 19:52:36
|
On Jan 1, 2008 7:11 PM, Julian Seward <js...@ac...> wrote: > > A more serious module-related question for drd is that it should not > include pub_core_*.h. Tools may only include pub_tool_*.h, in order > to control the complexity of the core/tool interface. For one thing > that will require adding the drd suppression file to DEFAULT_SUPP > in configure.in - not a problem. Can you list precisely the stuff from > the core_*.h includes that you need, that is not present in the > tool_*.h files? The attached patch solves this issue for exp-drd/drd_main.c. Can you please review and apply the attached patch ? Thanks, Bart. |
|
From: Bart V. A. <bar...@gm...> - 2008-01-04 19:48:41
|
I don't know how it is possible, but an #include directive was missing in
the patch I submitted. The attached patch fixes this. Can this patch please
be applied ?
Thanks,
Bart.
---------- Forwarded message ----------
From: <sv...@va...>
Date: Jan 2, 2008 11:07 AM
Subject: [Valgrind-developers] valgrind: r7309 - trunk/exp-drd
To: val...@li...
Author: tom
Date: 2008-01-02 10:07:44 +0000 (Wed, 02 Jan 2008)
New Revision: 7309
Log:
Stop drd trying to get a backtrace when there is no stack pointer.
Patch from Bart Van Assche <bar...@gm...>.
Modified:
trunk/exp-drd/drd_segment.c
Modified: trunk/exp-drd/drd_segment.c
===================================================================
--- trunk/exp-drd/drd_segment.c 2007-12-30 12:28:26 UTC (rev 7308)
+++ trunk/exp-drd/drd_segment.c 2008-01-02 10:07:44 UTC (rev 7309)
@@ -64,7 +64,7 @@
sg->next = 0;
sg->prev = 0;
- if (vg_created != VG_INVALID_THREADID)
+ if (vg_created != VG_INVALID_THREADID && VG_(get_SP)(vg_created) != 0)
sg->stacktrace = VG_(record_ExeContext)(vg_created, 0);
else
sg->stacktrace = 0;
|
|
From: Bart V. A. <bar...@gm...> - 2008-01-04 19:44:46
|
Can the attached patch please be reviewed and applied ? Thanks, Bart. |
|
From: Bart V. A. <bar...@gm...> - 2008-01-04 19:34:47
|
On Dec 30, 2007 1:28 PM, Tom Hughes <to...@co...> wrote: > On 27/12/2007, Bart Van Assche <bar...@gm...> wrote: > > > I know that not everyone uses the const keyword wherever possible, but I > > would appreciate if the Valgrind core would support programmers that > follow > > this style. Currently it is not possible to pass pointers to const keys > to > > the OSet-manipulating functions without having to cast away constness in > > order to avoid compiler errors. Can the attached patch please be > reviewed > > and committed on the trunk ? > > Looks good to me - committed. > > Tom > Hello Tom, It seems that I overlooked that osets are also used in regression tests. Can you please apply the attached patch ? Thanks, Bart. |
|
From: <sv...@va...> - 2008-01-04 13:10:00
|
Author: sewardj
Date: 2008-01-04 13:09:44 +0000 (Fri, 04 Jan 2008)
New Revision: 7313
Log:
Rename the VG_AR_SYMTAB arena to VG_AR_DINFO to reflect more
accurately its purpose.
Modified:
branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c
branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c
branches/DATASYMS/coregrind/m_debuginfo/readelf.c
branches/DATASYMS/coregrind/m_debuginfo/readstabs.c
branches/DATASYMS/coregrind/m_debuginfo/readxcoff.c
branches/DATASYMS/coregrind/m_debuginfo/storage.c
branches/DATASYMS/coregrind/m_mallocfree.c
branches/DATASYMS/coregrind/m_redir.c
branches/DATASYMS/coregrind/pub_core_mallocfree.h
Modified: branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -119,13 +119,13 @@
vg_assert(filename);
- si = VG_(arena_calloc)(VG_AR_SYMTAB, 1, sizeof(SegInfo));
+ si = VG_(arena_calloc)(VG_AR_DINFO, 1, sizeof(SegInfo));
si->text_start_avma = start;
si->text_size = size;
si->foffset = foffset;
- si->filename = VG_(arena_strdup)(VG_AR_SYMTAB, filename);
+ si->filename = VG_(arena_strdup)(VG_AR_DINFO, filename);
si->memname = memname
- ? VG_(arena_strdup)(VG_AR_SYMTAB, memname)
+ ? VG_(arena_strdup)(VG_AR_DINFO, memname)
: NULL;
/* Everything else -- pointers, sizes, arrays -- is zeroed by calloc.
@@ -151,17 +151,17 @@
{
struct strchunk *chunk, *next;
vg_assert(si != NULL);
- if (si->filename) VG_(arena_free)(VG_AR_SYMTAB, si->filename);
- if (si->symtab) VG_(arena_free)(VG_AR_SYMTAB, si->symtab);
- if (si->loctab) VG_(arena_free)(VG_AR_SYMTAB, si->loctab);
- if (si->cfsi) VG_(arena_free)(VG_AR_SYMTAB, si->cfsi);
+ if (si->filename) VG_(arena_free)(VG_AR_DINFO, si->filename);
+ if (si->symtab) VG_(arena_free)(VG_AR_DINFO, si->symtab);
+ if (si->loctab) VG_(arena_free)(VG_AR_DINFO, si->loctab);
+ if (si->cfsi) VG_(arena_free)(VG_AR_DINFO, si->cfsi);
if (si->cfsi_exprs) VG_(deleteXA)(si->cfsi_exprs);
for (chunk = si->strchunks; chunk != NULL; chunk = next) {
next = chunk->next;
- VG_(arena_free)(VG_AR_SYMTAB, chunk);
+ VG_(arena_free)(VG_AR_DINFO, chunk);
}
- VG_(arena_free)(VG_AR_SYMTAB, si);
+ VG_(arena_free)(VG_AR_DINFO, si);
}
@@ -354,7 +354,7 @@
if (!filename)
return;
- filename = VG_(arena_strdup)( VG_AR_SYMTAB, filename );
+ filename = VG_(arena_strdup)( VG_AR_DINFO, filename );
ok = (seg->kind == SkFileC || (seg->kind == SkFileV && allow_SkFileV))
&& seg->offset == 0
@@ -365,7 +365,7 @@
&& ML_(is_elf_object_file)( (const void*)seg->start );
if (!ok) {
- VG_(arena_free)(VG_AR_SYMTAB, filename);
+ VG_(arena_free)(VG_AR_DINFO, filename);
return;
}
@@ -379,7 +379,7 @@
/* acquire_syms_for_range makes its own copy of filename, so is
safe to free it. */
- VG_(arena_free)(VG_AR_SYMTAB, filename);
+ VG_(arena_free)(VG_AR_DINFO, filename);
}
Modified: branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -75,7 +75,7 @@
{
if (wa->tab) {
vg_assert(wa->tab_size > 0);
- VG_(arena_free)(VG_AR_SYMTAB, wa->tab);
+ VG_(arena_free)(VG_AR_DINFO, wa->tab);
}
init_WordArray(wa);
}
@@ -97,14 +97,14 @@
vg_assert( (wa->tab_size == 0 && wa->tab == NULL)
|| (wa->tab_size != 0 && wa->tab != NULL) );
new_size = wa->tab_size == 0 ? 8 : 2 * wa->tab_size;
- new_tab = VG_(arena_malloc)(VG_AR_SYMTAB,
+ new_tab = VG_(arena_malloc)(VG_AR_DINFO,
new_size * sizeof(Word));
vg_assert(new_tab != NULL);
for (i = 0; i < wa->tab_used; i++)
new_tab[i] = wa->tab[i];
wa->tab_size = new_size;
if (wa->tab)
- VG_(arena_free)(VG_AR_SYMTAB, wa->tab);
+ VG_(arena_free)(VG_AR_DINFO, wa->tab);
wa->tab = new_tab;
}
@@ -1948,10 +1948,10 @@
}
static void* symtab_alloc ( SizeT szB ) {
- return VG_(arena_malloc)( VG_AR_SYMTAB, szB );
+ return VG_(arena_malloc)( VG_AR_DINFO, szB );
}
static void symtab_free ( void* v ) {
- VG_(arena_free)( VG_AR_SYMTAB, v );
+ VG_(arena_free)( VG_AR_DINFO, v );
}
static void initUnwindContext ( /*OUT*/UnwindContext* ctx )
Modified: branches/DATASYMS/coregrind/m_debuginfo/readelf.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readelf.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_debuginfo/readelf.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -477,10 +477,10 @@
return (Word)VG_(strcmp)(key1->name, elem2->key.name);
}
static void* oset_malloc ( SizeT szB ) {
- return VG_(arena_malloc)(VG_AR_SYMTAB, szB);
+ return VG_(arena_malloc)(VG_AR_DINFO, szB);
}
static void oset_free ( void* p ) {
- VG_(arena_free)(VG_AR_SYMTAB, p);
+ VG_(arena_free)(VG_AR_DINFO, p);
}
static
@@ -776,7 +776,7 @@
static
Addr find_debug_file( Char* objpath, Char* debugname, UInt crc, UInt* size )
{
- Char *objdir = VG_(arena_strdup)(VG_AR_SYMTAB, objpath);
+ Char *objdir = VG_(arena_strdup)(VG_AR_DINFO, objpath);
Char *objdirptr;
Char *debugpath;
Addr addr = 0;
@@ -784,7 +784,7 @@
if ((objdirptr = VG_(strrchr)(objdir, '/')) != NULL)
*objdirptr = '\0';
- debugpath = VG_(arena_malloc)(VG_AR_SYMTAB, VG_(strlen)(objdir) + VG_(strlen)(debugname) + 16);
+ debugpath = VG_(arena_malloc)(VG_AR_DINFO, VG_(strlen)(objdir) + VG_(strlen)(debugname) + 16);
VG_(sprintf)(debugpath, "%s/%s", objdir, debugname);
@@ -796,8 +796,8 @@
}
}
- VG_(arena_free)(VG_AR_SYMTAB, debugpath);
- VG_(arena_free)(VG_AR_SYMTAB, objdir);
+ VG_(arena_free)(VG_AR_DINFO, debugpath);
+ VG_(arena_free)(VG_AR_DINFO, objdir);
return addr;
}
@@ -925,7 +925,7 @@
if (stroff != -1 && strtab != 0) {
TRACE_SYMTAB("soname=%s\n", strtab+stroff);
- si->soname = VG_(arena_strdup)(VG_AR_SYMTAB, strtab+stroff);
+ si->soname = VG_(arena_strdup)(VG_AR_DINFO, strtab+stroff);
}
}
Modified: branches/DATASYMS/coregrind/m_debuginfo/readstabs.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readstabs.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_debuginfo/readstabs.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -176,11 +176,11 @@
qbuflen = 16;
while ((qidx + qlen) >= qbuflen)
qbuflen *= 2;
- n = VG_(arena_malloc)(VG_AR_SYMTAB, qbuflen);
+ n = VG_(arena_malloc)(VG_AR_DINFO, qbuflen);
VG_(memcpy)(n, qbuf, qidx);
if (qbuf != NULL)
- VG_(arena_free)(VG_AR_SYMTAB, qbuf);
+ VG_(arena_free)(VG_AR_DINFO, qbuf);
qbuf = n;
}
@@ -207,7 +207,7 @@
if (qbuf != NULL) {
i--; /* overstepped */
string = ML_(addStr)(si, qbuf, qidx);
- VG_(arena_free)(VG_AR_SYMTAB, qbuf);
+ VG_(arena_free)(VG_AR_DINFO, qbuf);
if (contdebug)
VG_(printf)("made composite: \"%s\"\n", string);
}
Modified: branches/DATASYMS/coregrind/m_debuginfo/readxcoff.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readxcoff.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_debuginfo/readxcoff.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -494,10 +494,10 @@
}
static void* malloc_AR_SYMTAB ( SizeT nbytes ) {
- return VG_(arena_malloc)(VG_AR_SYMTAB, nbytes);
+ return VG_(arena_malloc)(VG_AR_DINFO, nbytes);
}
static void free_AR_SYMTAB ( void* ptr ) {
- return VG_(arena_free)(VG_AR_SYMTAB, ptr);
+ return VG_(arena_free)(VG_AR_DINFO, ptr);
}
/* Read symbol and line number info for the given text section. (This
@@ -2455,7 +2455,7 @@
si->soname = so;
} else {
/* no member name, hence soname = "archive.a" */
- si->soname = VG_(arena_strdup)(VG_AR_SYMTAB, p);
+ si->soname = VG_(arena_strdup)(VG_AR_DINFO, p);
}
}
if (SHOW)
Modified: branches/DATASYMS/coregrind/m_debuginfo/storage.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/storage.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_debuginfo/storage.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -152,7 +152,7 @@
if (si->strchunks == NULL ||
(si->strchunks->strtab_used
+ space_needed) > SEGINFO_STRCHUNKSIZE) {
- chunk = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(*chunk));
+ chunk = VG_(arena_malloc)(VG_AR_DINFO, sizeof(*chunk));
chunk->strtab_used = 0;
chunk->next = si->strchunks;
si->strchunks = chunk;
@@ -181,11 +181,11 @@
if (si->symtab_used == si->symtab_size) {
new_sz = 2 * si->symtab_size;
if (new_sz == 0) new_sz = 500;
- new_tab = VG_(arena_malloc)(VG_AR_SYMTAB, new_sz * sizeof(DiSym) );
+ new_tab = VG_(arena_malloc)(VG_AR_DINFO, new_sz * sizeof(DiSym) );
if (si->symtab != NULL) {
for (i = 0; i < si->symtab_used; i++)
new_tab[i] = si->symtab[i];
- VG_(arena_free)(VG_AR_SYMTAB, si->symtab);
+ VG_(arena_free)(VG_AR_DINFO, si->symtab);
}
si->symtab = new_tab;
si->symtab_size = new_sz;
@@ -210,11 +210,11 @@
if (si->loctab_used == si->loctab_size) {
new_sz = 2 * si->loctab_size;
if (new_sz == 0) new_sz = 500;
- new_tab = VG_(arena_malloc)(VG_AR_SYMTAB, new_sz * sizeof(DiLoc) );
+ new_tab = VG_(arena_malloc)(VG_AR_DINFO, new_sz * sizeof(DiLoc) );
if (si->loctab != NULL) {
for (i = 0; i < si->loctab_used; i++)
new_tab[i] = si->loctab[i];
- VG_(arena_free)(VG_AR_SYMTAB, si->loctab);
+ VG_(arena_free)(VG_AR_DINFO, si->loctab);
}
si->loctab = new_tab;
si->loctab_size = new_sz;
@@ -366,11 +366,11 @@
if (si->cfsi_used == si->cfsi_size) {
new_sz = 2 * si->cfsi_size;
if (new_sz == 0) new_sz = 20;
- new_tab = VG_(arena_malloc)(VG_AR_SYMTAB, new_sz * sizeof(DiCfSI) );
+ new_tab = VG_(arena_malloc)(VG_AR_DINFO, new_sz * sizeof(DiCfSI) );
if (si->cfsi != NULL) {
for (i = 0; i < si->cfsi_used; i++)
new_tab[i] = si->cfsi[i];
- VG_(arena_free)(VG_AR_SYMTAB, si->cfsi);
+ VG_(arena_free)(VG_AR_DINFO, si->cfsi);
}
si->cfsi = new_tab;
si->cfsi_size = new_sz;
Modified: branches/DATASYMS/coregrind/m_mallocfree.c
===================================================================
--- branches/DATASYMS/coregrind/m_mallocfree.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_mallocfree.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -518,7 +518,7 @@
// Initialise the non-client arenas
arena_init ( VG_AR_CORE, "core", 4, 1048576 );
arena_init ( VG_AR_TOOL, "tool", 4, 4194304 );
- arena_init ( VG_AR_SYMTAB, "symtab", 4, 1048576 );
+ arena_init ( VG_AR_DINFO, "dinfo", 4, 1048576 );
arena_init ( VG_AR_DEMANGLE, "demangle", 4, 65536 );
arena_init ( VG_AR_EXECTXT, "exectxt", 4, 1048576 );
arena_init ( VG_AR_ERRORS, "errors", 4, 65536 );
Modified: branches/DATASYMS/coregrind/m_redir.c
===================================================================
--- branches/DATASYMS/coregrind/m_redir.c 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/m_redir.c 2008-01-04 13:09:44 UTC (rev 7313)
@@ -280,9 +280,9 @@
static void maybe_add_active ( Active /*by value; callee copies*/ );
-static void* symtab_zalloc(SizeT);
-static void symtab_free(void*);
-static HChar* symtab_strdup(HChar*);
+static void* dinfo_zalloc(SizeT);
+static void dinfo_free(void*);
+static HChar* dinfo_strdup(HChar*);
static Bool is_plausible_guest_addr(Addr);
static Bool is_aix5_glink_idiom(Addr);
@@ -365,10 +365,10 @@
the following loop, and complain at that point. */
continue;
}
- spec = symtab_zalloc(sizeof(Spec));
+ spec = dinfo_zalloc(sizeof(Spec));
vg_assert(spec);
- spec->from_sopatt = symtab_strdup(demangled_sopatt);
- spec->from_fnpatt = symtab_strdup(demangled_fnpatt);
+ spec->from_sopatt = dinfo_strdup(demangled_sopatt);
+ spec->from_fnpatt = dinfo_strdup(demangled_fnpatt);
vg_assert(spec->from_sopatt);
vg_assert(spec->from_fnpatt);
spec->to_addr = sym_addr;
@@ -412,7 +412,7 @@
/* Ok. Now specList holds the list of specs from the SegInfo.
Build a new TopSpec, but don't add it to topSpecs yet. */
- newts = symtab_zalloc(sizeof(TopSpec));
+ newts = dinfo_zalloc(sizeof(TopSpec));
vg_assert(newts);
newts->next = NULL; /* not significant */
newts->seginfo = newsi;
@@ -680,7 +680,7 @@
/* Traverse the actives, copying the addresses of those we intend
to delete into tmpSet. */
- tmpSet = VG_(OSetWord_Create)(symtab_zalloc, symtab_free);
+ tmpSet = VG_(OSetWord_Create)(dinfo_zalloc, dinfo_free);
ts->mark = True;
@@ -729,10 +729,10 @@
/* The Actives set is now cleaned up. Free up this TopSpec and
everything hanging off it. */
for (sp = ts->specs; sp; sp = sp_next) {
- if (sp->from_sopatt) symtab_free(sp->from_sopatt);
- if (sp->from_fnpatt) symtab_free(sp->from_fnpatt);
+ if (sp->from_sopatt) dinfo_free(sp->from_sopatt);
+ if (sp->from_fnpatt) dinfo_free(sp->from_fnpatt);
sp_next = sp->next;
- symtab_free(sp);
+ dinfo_free(sp);
}
if (tsPrev == NULL) {
@@ -741,7 +741,7 @@
} else {
tsPrev->next = ts->next;
}
- symtab_free(ts);
+ dinfo_free(ts);
if (VG_(clo_trace_redir))
show_redir_state("after VG_(redir_notify_delete_SegInfo)");
@@ -798,11 +798,11 @@
Addr to_addr,
HChar* mandatory )
{
- Spec* spec = symtab_zalloc(sizeof(Spec));
+ Spec* spec = dinfo_zalloc(sizeof(Spec));
vg_assert(spec);
if (topSpecs == NULL) {
- topSpecs = symtab_zalloc(sizeof(TopSpec));
+ topSpecs = dinfo_zalloc(sizeof(TopSpec));
vg_assert(topSpecs);
/* symtab_zalloc sets all fields to zero */
}
@@ -839,8 +839,8 @@
// Initialise active mapping.
activeSet = VG_(OSetGen_Create)(offsetof(Active, from_addr),
NULL, // Use fast comparison
- symtab_zalloc,
- symtab_free);
+ dinfo_zalloc,
+ dinfo_free);
// The rest of this function just adds initial Specs.
@@ -937,23 +937,23 @@
/*--- MISC HELPERS ---*/
/*------------------------------------------------------------*/
-static void* symtab_zalloc(SizeT n) {
+static void* dinfo_zalloc(SizeT n) {
void* p;
vg_assert(n > 0);
- p = VG_(arena_malloc)(VG_AR_SYMTAB, n);
+ p = VG_(arena_malloc)(VG_AR_DINFO, n);
tl_assert(p);
VG_(memset)(p, 0, n);
return p;
}
-static void symtab_free(void* p) {
+static void dinfo_free(void* p) {
tl_assert(p);
- return VG_(arena_free)(VG_AR_SYMTAB, p);
+ return VG_(arena_free)(VG_AR_DINFO, p);
}
-static HChar* symtab_strdup(HChar* str)
+static HChar* dinfo_strdup(HChar* str)
{
- return VG_(arena_strdup)(VG_AR_SYMTAB, str);
+ return VG_(arena_strdup)(VG_AR_DINFO, str);
}
/* Really this should be merged with translations_allowable_from_seg
Modified: branches/DATASYMS/coregrind/pub_core_mallocfree.h
===================================================================
--- branches/DATASYMS/coregrind/pub_core_mallocfree.h 2008-01-04 11:36:41 UTC (rev 7312)
+++ branches/DATASYMS/coregrind/pub_core_mallocfree.h 2008-01-04 13:09:44 UTC (rev 7313)
@@ -42,7 +42,7 @@
CORE for the core's general use.
TOOL for the tool to use (and the only one it uses).
- SYMTAB for Valgrind's symbol table storage.
+ DINFO for debug info (symbols, line #s, CFI, etc) storage.
CLIENT for the client's mallocs/frees, if the tool replaces glibc's
malloc() et al -- redzone size is chosen by the tool.
DEMANGLE for the C++ demangler.
@@ -59,7 +59,7 @@
#define VG_AR_CORE 0
#define VG_AR_TOOL 1
-#define VG_AR_SYMTAB 2
+#define VG_AR_DINFO 2
#define VG_AR_CLIENT 3
#define VG_AR_DEMANGLE 4
#define VG_AR_EXECTXT 5
|
|
From: <sv...@va...> - 2008-01-04 11:36:42
|
Author: sewardj
Date: 2008-01-04 11:36:41 +0000 (Fri, 04 Jan 2008)
New Revision: 7312
Log:
Rename drd_preloaded.c to drd_intercepts.c (Bart Van Assche)
Added:
trunk/exp-drd/drd_intercepts.c
Removed:
trunk/exp-drd/drd_preloaded.c
Modified:
trunk/exp-drd/Makefile.am
trunk/exp-drd/tests/pth_cond_race.stderr.exp
Modified: trunk/exp-drd/Makefile.am
===================================================================
--- trunk/exp-drd/Makefile.am 2008-01-04 11:08:38 UTC (rev 7311)
+++ trunk/exp-drd/Makefile.am 2008-01-04 11:36:41 UTC (rev 7312)
@@ -20,7 +20,7 @@
noinst_PROGRAMS += exp-drd-ppc64-aix5 vgpreload_exp-drd-ppc64-aix5.so
endif
-VGPRELOAD_DRD_SOURCES_COMMON = drd_preloaded.c
+VGPRELOAD_DRD_SOURCES_COMMON = drd_intercepts.c
vgpreload_exp_drd_x86_linux_so_SOURCES = $(VGPRELOAD_DRD_SOURCES_COMMON)
vgpreload_exp_drd_x86_linux_so_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX)
Copied: trunk/exp-drd/drd_intercepts.c (from rev 7310, trunk/exp-drd/drd_preloaded.c)
===================================================================
--- trunk/exp-drd/drd_intercepts.c (rev 0)
+++ trunk/exp-drd/drd_intercepts.c 2008-01-04 11:36:41 UTC (rev 7312)
@@ -0,0 +1,530 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Client-space code for drd. drd_preloaded.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of drd, a data race detector.
+
+ Copyright (C) 2006-2007 Bart Van Assche
+ bar...@gm...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+/* ---------------------------------------------------------------------
+ ALL THE CODE IN THIS FILE RUNS ON THE SIMULATED CPU.
+
+ These functions are not called directly - they're the targets of code
+ redirection or load notifications (see pub_core_redir.h for info).
+ They're named weirdly so that the intercept code can find them when the
+ shared object is initially loaded.
+
+ Note that this filename has the "drd_" prefix because it can appear
+ in stack traces, and the "drd_" makes it a little clearer that it
+ originates from Valgrind.
+ ------------------------------------------------------------------ */
+
+// Make sure pthread_spinlock_t is available on glibc 2.3.2 systems.
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <assert.h>
+#include <inttypes.h> // uintptr_t
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include "drd_clientreq.h"
+#include "pub_core_basics.h"
+#include "pub_core_clreq.h"
+#include "pub_core_debuginfo.h" // Needed for pub_core_redir.h
+#include "pub_core_redir.h" // For VG_NOTIFY_ON_LOAD
+#include "pub_tool_threadstate.h"// VG_N_THREADS
+
+
+// Defines.
+
+#define PTH_FUNC(ret_ty, f, args...) \
+ ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
+ ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
+
+
+// Local data structures.
+
+typedef struct
+{
+ void* (*start)(void*);
+ void* arg;
+ int detachstate;
+#if 0
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+#else
+ int wrapper_started;
+#endif
+} VgPosixThreadArgs;
+
+
+// Local variables.
+
+static int vg_main_thread_state_is_set = 0;
+
+
+// Function definitions.
+
+static void vg_start_suppression(const void* const p, size_t const size)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_SUPPRESSION,
+ p, size, 0, 0, 0);
+}
+
+#if 0
+static void vg_finish_suppression(const void* const p, size_t const size)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_FINISH_SUPPRESSION,
+ p, size, 0, 0, 0);
+}
+#endif
+
+static void vg_start_recording(void)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_RECORDING,
+ pthread_self(), 0, 0, 0, 0);
+}
+
+static void vg_stop_recording(void)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_STOP_RECORDING,
+ pthread_self(), 0, 0, 0, 0);
+}
+
+static void vg_set_joinable(const pthread_t tid, const int joinable)
+{
+ int res;
+ assert(joinable == 0 || joinable == 1);
+#if 0
+ printf("vg_set_joinable(%ld, %d)\n", tid, joinable);
+#endif
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_JOINABLE,
+ tid, joinable, 0, 0, 0);
+}
+
+static void* vg_thread_wrapper(void* arg)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
+ 0, 0, 0, 0, 0);
+
+ {
+ VgPosixThreadArgs* const arg_ptr = (VgPosixThreadArgs*)arg;
+ VgPosixThreadArgs const arg_copy = *arg_ptr;
+ void* result;
+
+#if 0
+ pthread_mutex_lock(arg_ptr->mutex);
+ pthread_cond_signal(arg_ptr->cond);
+ pthread_mutex_unlock(arg_ptr->mutex);
+#else
+ arg_ptr->wrapper_started = 1;
+#endif
+
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREADID,
+ pthread_self(), 0, 0, 0, 0);
+ vg_set_joinable(pthread_self(),
+ arg_copy.detachstate == PTHREAD_CREATE_JOINABLE);
+ result = (arg_copy.start)(arg_copy.arg);
+ return result;
+ }
+}
+
+static void vg_set_main_thread_state(void)
+{
+ int res;
+
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
+ 0, 0, 0, 0, 0);
+
+ // Make sure that DRD knows about the main thread's POSIX thread ID.
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREADID,
+ pthread_self(), 0, 0, 0, 0);
+
+}
+
+// pthread_create
+PTH_FUNC(int, pthreadZucreateZAZa, // pthread_create@*
+ pthread_t *thread, const pthread_attr_t *attr,
+ void *(*start) (void *), void *arg)
+{
+ int ret;
+ OrigFn fn;
+ VgPosixThreadArgs vgargs;
+
+ VALGRIND_GET_ORIG_FN(fn);
+
+ if (vg_main_thread_state_is_set == 0)
+ {
+ vg_set_main_thread_state();
+ vg_main_thread_state_is_set = 1;
+ }
+ vg_start_suppression(&vgargs.wrapper_started,
+ sizeof(vgargs.wrapper_started));
+ vgargs.start = start;
+ vgargs.arg = arg;
+ vgargs.wrapper_started = 0;
+ vgargs.detachstate = PTHREAD_CREATE_JOINABLE;
+ if (attr)
+ {
+ if (pthread_attr_getdetachstate(attr, &vgargs.detachstate) != 0)
+ {
+ assert(0);
+ }
+ }
+ assert(vgargs.detachstate == PTHREAD_CREATE_JOINABLE
+ || vgargs.detachstate == PTHREAD_CREATE_DETACHED);
+#if 0
+ pthread_mutex_init(&vgargs.mutex, 0);
+ pthread_cond_init(&vgargs.cond, 0);
+ pthread_mutex_lock(&vgargs.mutex);
+#endif
+ vg_stop_recording();
+ CALL_FN_W_WWWW(ret, fn, thread, attr, vg_thread_wrapper, &vgargs);
+ vg_start_recording();
+#if 0
+ pthread_cond_wait(&vgargs.cond, &vgargs.mutex);
+ pthread_mutex_unlock(&vgargs.mutex);
+ pthread_cond_destroy(&vgargs.cond);
+ pthread_mutex_destroy(&vgargs.mutex);
+#else
+ // Yes, you see it correctly, busy waiting ... The problem is that
+ // POSIX threads functions cannot be called here -- the functions defined
+ // in this file (vg_preloaded.c) would be called instead of those in
+ // libpthread.so. This loop is necessary because vgargs is allocated on the
+ // stack, and the created thread reads it.
+ if (ret == 0)
+ {
+ while (! vgargs.wrapper_started)
+ {
+ sched_yield();
+ }
+ }
+#endif
+ return ret;
+}
+
+// pthread_join
+PTH_FUNC(int, pthreadZujoin, // pthread_join
+ pthread_t pt_joinee, void **thread_return)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_WW(ret, fn, pt_joinee, thread_return);
+ if (ret == 0)
+ {
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_THREAD_JOIN,
+ pt_joinee, 0, 0, 0, 0);
+ }
+ return ret;
+}
+
+// pthread_detach
+PTH_FUNC(int, pthreadZudetach, pthread_t pt_thread)
+{
+ int ret;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ {
+ CALL_FN_W_W(ret, fn, pt_thread);
+ if (ret == 0)
+ {
+ vg_set_joinable(pt_thread, 0);
+ }
+ }
+ return ret;
+}
+
+// pthread_mutex_init
+PTH_FUNC(int, pthreadZumutexZuinit,
+ pthread_mutex_t *mutex,
+ const pthread_mutexattr_t* attr)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_INIT,
+ mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
+ CALL_FN_W_WW(ret, fn, mutex, attr);
+ return ret;
+}
+
+// pthread_mutex_destroy
+PTH_FUNC(int, pthreadZumutexZudestroy,
+ pthread_mutex_t *mutex)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_W(ret, fn, mutex);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_DESTROY,
+ mutex, mutex_type_mutex, 0, 0, 0);
+ return ret;
+}
+
+// pthread_mutex_lock
+PTH_FUNC(int, pthreadZumutexZulock, // pthread_mutex_lock
+ pthread_mutex_t *mutex)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK,
+ mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
+#if 1
+ // The only purpose of the system call below is to make drd work on AMD64
+ // systems. Without this system call, clients crash (SIGSEGV) in
+ // std::locale::locale().
+ write(1, "", 0);
+#endif
+ CALL_FN_W_W(ret, fn, mutex);
+ if (ret == 0)
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
+ mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
+ return ret;
+}
+
+// pthread_mutex_trylock
+PTH_FUNC(int, pthreadZumutexZutrylock, // pthread_mutex_trylock
+ pthread_mutex_t *mutex)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_W(ret, fn, mutex);
+ if (ret == 0)
+ {
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
+ mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
+ }
+ return ret;
+}
+
+// pthread_mutex_unlock
+PTH_FUNC(int, pthreadZumutexZuunlock, // pthread_mutex_unlock
+ pthread_mutex_t *mutex)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1,
+ VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK,
+ mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
+ CALL_FN_W_W(ret, fn, mutex);
+ return ret;
+}
+
+// pthread_cond_init
+PTH_FUNC(int, pthreadZucondZuinitZAZa, // pthread_cond_init@*
+ pthread_cond_t* cond,
+ const pthread_condattr_t* attr)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_WW(ret, fn, cond, attr);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_INIT,
+ cond, sizeof(*cond), 0, 0, 0);
+ return ret;
+}
+
+// pthread_cond_destroy
+PTH_FUNC(int, pthreadZucondZudestroyZAZa, // pthread_cond_destroy@*
+ pthread_cond_t* cond)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_DESTROY,
+ cond, 0, 0, 0, 0);
+ CALL_FN_W_W(ret, fn, cond);
+ return ret;
+}
+
+// pthread_cond_wait
+PTH_FUNC(int, pthreadZucondZuwaitZAZa, // pthread_cond_wait@*
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_WAIT,
+ cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
+ CALL_FN_W_WW(ret, fn, cond, mutex);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT,
+ cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
+ return ret;
+}
+
+// pthread_cond_timedwait
+PTH_FUNC(int, pthreadZucondZutimedwaitZAZa, // pthread_cond_timedwait@*
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec* abstime)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_WAIT,
+ cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
+ CALL_FN_W_WWW(ret, fn, cond, mutex, abstime);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT,
+ cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
+ return ret;
+}
+
+// pthread_cond_signal
+PTH_FUNC(int, pthreadZucondZusignalZAZa, // pthread_cond_signal@*
+ pthread_cond_t* cond)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_SIGNAL,
+ cond, 0, 0, 0, 0);
+ CALL_FN_W_W(ret, fn, cond);
+ return ret;
+}
+
+// pthread_cond_broadcast
+PTH_FUNC(int, pthreadZucondZubroadcastZAZa, // pthread_cond_broadcast@*
+ pthread_cond_t* cond)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_BROADCAST,
+ cond, 0, 0, 0, 0);
+ CALL_FN_W_W(ret, fn, cond);
+ return ret;
+}
+
+
+// pthread_spin_init
+PTH_FUNC(int, pthreadZuspinZuinit, // pthread_spin_init
+ pthread_spinlock_t *spinlock,
+ int pshared)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SPIN_INIT_OR_UNLOCK,
+ spinlock, sizeof(*spinlock),
+ mutex_type_spinlock, 0, 0);
+ CALL_FN_W_WW(ret, fn, spinlock, pshared);
+ return ret;
+}
+
+// pthread_spin_destroy
+PTH_FUNC(int, pthreadZuspinZudestroy, // pthread_spin_destroy
+ pthread_spinlock_t *spinlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_W(ret, fn, spinlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_DESTROY,
+ spinlock, mutex_type_spinlock, 0, 0, 0);
+ return ret;
+}
+
+// pthread_spin_lock
+PTH_FUNC(int, pthreadZuspinZulock, // pthread_spin_lock
+ pthread_spinlock_t *spinlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_W(ret, fn, spinlock);
+ if (ret == 0)
+ {
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
+ spinlock, sizeof(*spinlock),
+ mutex_type_spinlock, 0, 0);
+ }
+ return ret;
+}
+
+// pthread_spin_trylock
+PTH_FUNC(int, pthreadZuspinZutrylock, // pthread_spin_trylock
+ pthread_spinlock_t *spinlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_W(ret, fn, spinlock);
+ if (ret == 0)
+ {
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
+ spinlock, sizeof(*spinlock),
+ mutex_type_spinlock, 0, 0);
+ }
+ return ret;
+}
+
+// pthread_spin_unlock
+PTH_FUNC(int, pthreadZuspinZuunlock, // pthread_spin_unlock
+ pthread_spinlock_t *spinlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SPIN_INIT_OR_UNLOCK,
+ spinlock, sizeof(*spinlock),
+ mutex_type_spinlock, 0, 0);
+ CALL_FN_W_W(ret, fn, spinlock);
+ return ret;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 3
+ * End:
+ */
Deleted: trunk/exp-drd/drd_preloaded.c
===================================================================
--- trunk/exp-drd/drd_preloaded.c 2008-01-04 11:08:38 UTC (rev 7311)
+++ trunk/exp-drd/drd_preloaded.c 2008-01-04 11:36:41 UTC (rev 7312)
@@ -1,530 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Client-space code for drd. drd_preloaded.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of drd, a data race detector.
-
- Copyright (C) 2006-2007 Bart Van Assche
- bar...@gm...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-/* ---------------------------------------------------------------------
- ALL THE CODE IN THIS FILE RUNS ON THE SIMULATED CPU.
-
- These functions are not called directly - they're the targets of code
- redirection or load notifications (see pub_core_redir.h for info).
- They're named weirdly so that the intercept code can find them when the
- shared object is initially loaded.
-
- Note that this filename has the "drd_" prefix because it can appear
- in stack traces, and the "drd_" makes it a little clearer that it
- originates from Valgrind.
- ------------------------------------------------------------------ */
-
-// Make sure pthread_spinlock_t is available on glibc 2.3.2 systems.
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <assert.h>
-#include <inttypes.h> // uintptr_t
-#include <stdio.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "drd_clientreq.h"
-#include "pub_core_basics.h"
-#include "pub_core_clreq.h"
-#include "pub_core_debuginfo.h" // Needed for pub_core_redir.h
-#include "pub_core_redir.h" // For VG_NOTIFY_ON_LOAD
-#include "pub_tool_threadstate.h"// VG_N_THREADS
-
-
-// Defines.
-
-#define PTH_FUNC(ret_ty, f, args...) \
- ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
- ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
-
-
-// Local data structures.
-
-typedef struct
-{
- void* (*start)(void*);
- void* arg;
- int detachstate;
-#if 0
- pthread_mutex_t mutex;
- pthread_cond_t cond;
-#else
- int wrapper_started;
-#endif
-} VgPosixThreadArgs;
-
-
-// Local variables.
-
-static int vg_main_thread_state_is_set = 0;
-
-
-// Function definitions.
-
-static void vg_start_suppression(const void* const p, size_t const size)
-{
- int res;
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_SUPPRESSION,
- p, size, 0, 0, 0);
-}
-
-#if 0
-static void vg_finish_suppression(const void* const p, size_t const size)
-{
- int res;
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_FINISH_SUPPRESSION,
- p, size, 0, 0, 0);
-}
-#endif
-
-static void vg_start_recording(void)
-{
- int res;
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_RECORDING,
- pthread_self(), 0, 0, 0, 0);
-}
-
-static void vg_stop_recording(void)
-{
- int res;
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_STOP_RECORDING,
- pthread_self(), 0, 0, 0, 0);
-}
-
-static void vg_set_joinable(const pthread_t tid, const int joinable)
-{
- int res;
- assert(joinable == 0 || joinable == 1);
-#if 0
- printf("vg_set_joinable(%ld, %d)\n", tid, joinable);
-#endif
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_JOINABLE,
- tid, joinable, 0, 0, 0);
-}
-
-static void* vg_thread_wrapper(void* arg)
-{
- int res;
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
- 0, 0, 0, 0, 0);
-
- {
- VgPosixThreadArgs* const arg_ptr = (VgPosixThreadArgs*)arg;
- VgPosixThreadArgs const arg_copy = *arg_ptr;
- void* result;
-
-#if 0
- pthread_mutex_lock(arg_ptr->mutex);
- pthread_cond_signal(arg_ptr->cond);
- pthread_mutex_unlock(arg_ptr->mutex);
-#else
- arg_ptr->wrapper_started = 1;
-#endif
-
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREADID,
- pthread_self(), 0, 0, 0, 0);
- vg_set_joinable(pthread_self(),
- arg_copy.detachstate == PTHREAD_CREATE_JOINABLE);
- result = (arg_copy.start)(arg_copy.arg);
- return result;
- }
-}
-
-static void vg_set_main_thread_state(void)
-{
- int res;
-
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
- 0, 0, 0, 0, 0);
-
- // Make sure that DRD knows about the main thread's POSIX thread ID.
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREADID,
- pthread_self(), 0, 0, 0, 0);
-
-}
-
-// pthread_create
-PTH_FUNC(int, pthreadZucreateZAZa, // pthread_create@*
- pthread_t *thread, const pthread_attr_t *attr,
- void *(*start) (void *), void *arg)
-{
- int ret;
- OrigFn fn;
- VgPosixThreadArgs vgargs;
-
- VALGRIND_GET_ORIG_FN(fn);
-
- if (vg_main_thread_state_is_set == 0)
- {
- vg_set_main_thread_state();
- vg_main_thread_state_is_set = 1;
- }
- vg_start_suppression(&vgargs.wrapper_started,
- sizeof(vgargs.wrapper_started));
- vgargs.start = start;
- vgargs.arg = arg;
- vgargs.wrapper_started = 0;
- vgargs.detachstate = PTHREAD_CREATE_JOINABLE;
- if (attr)
- {
- if (pthread_attr_getdetachstate(attr, &vgargs.detachstate) != 0)
- {
- assert(0);
- }
- }
- assert(vgargs.detachstate == PTHREAD_CREATE_JOINABLE
- || vgargs.detachstate == PTHREAD_CREATE_DETACHED);
-#if 0
- pthread_mutex_init(&vgargs.mutex, 0);
- pthread_cond_init(&vgargs.cond, 0);
- pthread_mutex_lock(&vgargs.mutex);
-#endif
- vg_stop_recording();
- CALL_FN_W_WWWW(ret, fn, thread, attr, vg_thread_wrapper, &vgargs);
- vg_start_recording();
-#if 0
- pthread_cond_wait(&vgargs.cond, &vgargs.mutex);
- pthread_mutex_unlock(&vgargs.mutex);
- pthread_cond_destroy(&vgargs.cond);
- pthread_mutex_destroy(&vgargs.mutex);
-#else
- // Yes, you see it correctly, busy waiting ... The problem is that
- // POSIX threads functions cannot be called here -- the functions defined
- // in this file (vg_preloaded.c) would be called instead of those in
- // libpthread.so. This loop is necessary because vgargs is allocated on the
- // stack, and the created thread reads it.
- if (ret == 0)
- {
- while (! vgargs.wrapper_started)
- {
- sched_yield();
- }
- }
-#endif
- return ret;
-}
-
-// pthread_join
-PTH_FUNC(int, pthreadZujoin, // pthread_join
- pthread_t pt_joinee, void **thread_return)
-{
- int ret;
- int res;
- OrigFn fn;
-
- VALGRIND_GET_ORIG_FN(fn);
- CALL_FN_W_WW(ret, fn, pt_joinee, thread_return);
- if (ret == 0)
- {
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_THREAD_JOIN,
- pt_joinee, 0, 0, 0, 0);
- }
- return ret;
-}
-
-// pthread_detach
-PTH_FUNC(int, pthreadZudetach, pthread_t pt_thread)
-{
- int ret;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- {
- CALL_FN_W_W(ret, fn, pt_thread);
- if (ret == 0)
- {
- vg_set_joinable(pt_thread, 0);
- }
- }
- return ret;
-}
-
-// pthread_mutex_init
-PTH_FUNC(int, pthreadZumutexZuinit,
- pthread_mutex_t *mutex,
- const pthread_mutexattr_t* attr)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_INIT,
- mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
- CALL_FN_W_WW(ret, fn, mutex, attr);
- return ret;
-}
-
-// pthread_mutex_destroy
-PTH_FUNC(int, pthreadZumutexZudestroy,
- pthread_mutex_t *mutex)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- CALL_FN_W_W(ret, fn, mutex);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_DESTROY,
- mutex, mutex_type_mutex, 0, 0, 0);
- return ret;
-}
-
-// pthread_mutex_lock
-PTH_FUNC(int, pthreadZumutexZulock, // pthread_mutex_lock
- pthread_mutex_t *mutex)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK,
- mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
-#if 1
- // The only purpose of the system call below is to make drd work on AMD64
- // systems. Without this system call, clients crash (SIGSEGV) in
- // std::locale::locale().
- write(1, "", 0);
-#endif
- CALL_FN_W_W(ret, fn, mutex);
- if (ret == 0)
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
- return ret;
-}
-
-// pthread_mutex_trylock
-PTH_FUNC(int, pthreadZumutexZutrylock, // pthread_mutex_trylock
- pthread_mutex_t *mutex)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- CALL_FN_W_W(ret, fn, mutex);
- if (ret == 0)
- {
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
- }
- return ret;
-}
-
-// pthread_mutex_unlock
-PTH_FUNC(int, pthreadZumutexZuunlock, // pthread_mutex_unlock
- pthread_mutex_t *mutex)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1,
- VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK,
- mutex, sizeof(*mutex), mutex_type_mutex, 0, 0);
- CALL_FN_W_W(ret, fn, mutex);
- return ret;
-}
-
-// pthread_cond_init
-PTH_FUNC(int, pthreadZucondZuinitZAZa, // pthread_cond_init@*
- pthread_cond_t* cond,
- const pthread_condattr_t* attr)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- CALL_FN_W_WW(ret, fn, cond, attr);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_INIT,
- cond, sizeof(*cond), 0, 0, 0);
- return ret;
-}
-
-// pthread_cond_destroy
-PTH_FUNC(int, pthreadZucondZudestroyZAZa, // pthread_cond_destroy@*
- pthread_cond_t* cond)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_DESTROY,
- cond, 0, 0, 0, 0);
- CALL_FN_W_W(ret, fn, cond);
- return ret;
-}
-
-// pthread_cond_wait
-PTH_FUNC(int, pthreadZucondZuwaitZAZa, // pthread_cond_wait@*
- pthread_cond_t *cond,
- pthread_mutex_t *mutex)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_WAIT,
- cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
- CALL_FN_W_WW(ret, fn, cond, mutex);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT,
- cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
- return ret;
-}
-
-// pthread_cond_timedwait
-PTH_FUNC(int, pthreadZucondZutimedwaitZAZa, // pthread_cond_timedwait@*
- pthread_cond_t *cond,
- pthread_mutex_t *mutex,
- const struct timespec* abstime)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_WAIT,
- cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
- CALL_FN_W_WWW(ret, fn, cond, mutex, abstime);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT,
- cond, sizeof(*cond), mutex, sizeof(*mutex), 0);
- return ret;
-}
-
-// pthread_cond_signal
-PTH_FUNC(int, pthreadZucondZusignalZAZa, // pthread_cond_signal@*
- pthread_cond_t* cond)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_SIGNAL,
- cond, 0, 0, 0, 0);
- CALL_FN_W_W(ret, fn, cond);
- return ret;
-}
-
-// pthread_cond_broadcast
-PTH_FUNC(int, pthreadZucondZubroadcastZAZa, // pthread_cond_broadcast@*
- pthread_cond_t* cond)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_BROADCAST,
- cond, 0, 0, 0, 0);
- CALL_FN_W_W(ret, fn, cond);
- return ret;
-}
-
-
-// pthread_spin_init
-PTH_FUNC(int, pthreadZuspinZuinit, // pthread_spin_init
- pthread_spinlock_t *spinlock,
- int pshared)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SPIN_INIT_OR_UNLOCK,
- spinlock, sizeof(*spinlock),
- mutex_type_spinlock, 0, 0);
- CALL_FN_W_WW(ret, fn, spinlock, pshared);
- return ret;
-}
-
-// pthread_spin_destroy
-PTH_FUNC(int, pthreadZuspinZudestroy, // pthread_spin_destroy
- pthread_spinlock_t *spinlock)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- CALL_FN_W_W(ret, fn, spinlock);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_DESTROY,
- spinlock, mutex_type_spinlock, 0, 0, 0);
- return ret;
-}
-
-// pthread_spin_lock
-PTH_FUNC(int, pthreadZuspinZulock, // pthread_spin_lock
- pthread_spinlock_t *spinlock)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- CALL_FN_W_W(ret, fn, spinlock);
- if (ret == 0)
- {
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- spinlock, sizeof(*spinlock),
- mutex_type_spinlock, 0, 0);
- }
- return ret;
-}
-
-// pthread_spin_trylock
-PTH_FUNC(int, pthreadZuspinZutrylock, // pthread_spin_trylock
- pthread_spinlock_t *spinlock)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- CALL_FN_W_W(ret, fn, spinlock);
- if (ret == 0)
- {
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- spinlock, sizeof(*spinlock),
- mutex_type_spinlock, 0, 0);
- }
- return ret;
-}
-
-// pthread_spin_unlock
-PTH_FUNC(int, pthreadZuspinZuunlock, // pthread_spin_unlock
- pthread_spinlock_t *spinlock)
-{
- int ret;
- int res;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SPIN_INIT_OR_UNLOCK,
- spinlock, sizeof(*spinlock),
- mutex_type_spinlock, 0, 0);
- CALL_FN_W_W(ret, fn, spinlock);
- return ret;
-}
-
-/*
- * Local variables:
- * c-basic-offset: 3
- * End:
- */
Modified: trunk/exp-drd/tests/pth_cond_race.stderr.exp
===================================================================
--- trunk/exp-drd/tests/pth_cond_race.stderr.exp 2008-01-04 11:08:38 UTC (rev 7311)
+++ trunk/exp-drd/tests/pth_cond_race.stderr.exp 2008-01-04 11:36:41 UTC (rev 7312)
@@ -1,9 +1,9 @@
Thread 2:
Race condition: condition variable 0x........ has been signalled but the associated mutex 0x........ is not locked by the signalling thread
- at 0x........: pthread_cond_signal@* (drd_preloaded.c:?)
+ at 0x........: pthread_cond_signal@* (drd_intercepts.c:?)
by 0x........: thread_func (pth_cond_race.c:?)
- by 0x........: vg_thread_wrapper (drd_preloaded.c:?)
+ by 0x........: vg_thread_wrapper (drd_intercepts.c:?)
by 0x........: start_thread (in libpthread-?.?.so)
by 0x........: clone (in /...libc...)
|
|
From: <sv...@va...> - 2008-01-04 11:08:37
|
Author: sewardj Date: 2008-01-04 11:08:38 +0000 (Fri, 04 Jan 2008) New Revision: 7311 Log: Create a copy of trunk r7310 intended to be used for improving reading of data symbols. Added: branches/DATASYMS/ Copied: branches/DATASYMS (from rev 7310, trunk) |
|
From: Tom H. <th...@cy...> - 2008-01-04 04:01:13
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2008-01-04 03:15:10 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 == 323 tests, 66 stderr failures, 1 stdout failure, 28 post failures == memcheck/tests/addressable (stderr) memcheck/tests/badjump (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-pool-0 (stderr) memcheck/tests/leak-pool-1 (stderr) memcheck/tests/leak-pool-2 (stderr) memcheck/tests/leak-pool-3 (stderr) memcheck/tests/leak-pool-4 (stderr) memcheck/tests/leak-pool-5 (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/lsframe1 (stderr) memcheck/tests/lsframe2 (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/noisy_child (stderr) memcheck/tests/partial_load_dflt (stderr) memcheck/tests/partial_load_ok (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/supp_unknown (stderr) memcheck/tests/x86/bug152022 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/x86/xor-undef-x86 (stderr) memcheck/tests/xml1 (stderr) massif/tests/alloc-fns-A (post) massif/tests/alloc-fns-B (post) massif/tests/basic (post) massif/tests/basic2 (post) massif/tests/big-alloc (post) massif/tests/culling1 (stderr) massif/tests/culling2 (stderr) massif/tests/custom_alloc (post) massif/tests/deep-A (post) massif/tests/deep-B (stderr) massif/tests/deep-B (post) massif/tests/deep-C (stderr) massif/tests/deep-C (post) massif/tests/deep-D (post) massif/tests/ignoring (post) massif/tests/insig (post) massif/tests/long-time (post) massif/tests/new-cpp (post) massif/tests/null (post) massif/tests/one (post) massif/tests/overloaded-new (post) massif/tests/peak (post) massif/tests/peak2 (stderr) massif/tests/peak2 (post) massif/tests/realloc (stderr) massif/tests/realloc (post) massif/tests/thresholds_0_0 (post) massif/tests/thresholds_0_10 (post) massif/tests/thresholds_10_0 (post) massif/tests/thresholds_10_10 (post) massif/tests/thresholds_5_0 (post) massif/tests/thresholds_5_10 (post) massif/tests/zero1 (post) massif/tests/zero2 (post) none/tests/blockfault (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/hg06_readshared (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc02_simple_tls (stderr) helgrind/tests/tc03_re_excl (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc12_rwl_trivial (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tc24_nonzero_sem (stderr) |
|
From: Tom H. <th...@cy...> - 2008-01-04 03:38:12
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2008-01-04 03:05:14 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 == 357 tests, 7 stderr failures, 2 stdout failures, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-01-04 03:28:23
|
Nightly build on dellow ( x86_64, Fedora 8 ) started at 2008-01-04 03:10:05 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 357 tests, 8 stderr failures, 2 stdout failures, 0 post failures == memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) |
|
From: Tom H. <th...@cy...> - 2008-01-04 03:14:33
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2008-01-04 03:00:02 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 359 tests, 30 stderr failures, 1 stdout failure, 0 post failures == memcheck/tests/addressable (stderr) memcheck/tests/badjump (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/supp_unknown (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/blockfault (stderr) none/tests/fdleak_fcntl (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) |
|
From: <sv...@va...> - 2008-01-04 01:22:39
|
Author: sewardj
Date: 2008-01-04 01:22:41 +0000 (Fri, 04 Jan 2008)
New Revision: 1807
Log:
Very kludgey implementation of IRET. May or may not fix #155011.
Modified:
trunk/priv/guest-x86/toIR.c
Modified: trunk/priv/guest-x86/toIR.c
===================================================================
--- trunk/priv/guest-x86/toIR.c 2007-12-11 00:41:57 UTC (rev 1806)
+++ trunk/priv/guest-x86/toIR.c 2008-01-04 01:22:41 UTC (rev 1807)
@@ -7135,7 +7135,96 @@
);
}
+/* Generate IR to set the guest %EFLAGS from the pushfl-format image
+ in the given 32-bit temporary. The flags that are set are: O S Z A
+ C P D ID AC.
+ In all cases, code to set AC is generated. However, VEX actually
+ ignores the AC value and so can optionally emit an emulation
+ warning when it is enabled. In this routine, an emulation warning
+ is only emitted if emit_AC_emwarn is True, in which case
+ next_insn_EIP must be correct (this allows for correct code
+ generation for popfl/popfw). If emit_AC_emwarn is False,
+ next_insn_EIP is unimportant (this allows for easy if kludgey code
+ generation for IRET.) */
+
+static
+void set_EFLAGS_from_value ( IRTemp t1,
+ Bool emit_AC_emwarn,
+ Addr32 next_insn_EIP )
+{
+ vassert(typeOfIRTemp(irsb->tyenv,t1) == Ity_I32);
+
+ /* t1 is the flag word. Mask out everything except OSZACP and set
+ the flags thunk to X86G_CC_OP_COPY. */
+ stmt( IRStmt_Put( OFFB_CC_OP, mkU32(X86G_CC_OP_COPY) ));
+ stmt( IRStmt_Put( OFFB_CC_DEP2, mkU32(0) ));
+ stmt( IRStmt_Put( OFFB_CC_DEP1,
+ binop(Iop_And32,
+ mkexpr(t1),
+ mkU32( X86G_CC_MASK_C | X86G_CC_MASK_P
+ | X86G_CC_MASK_A | X86G_CC_MASK_Z
+ | X86G_CC_MASK_S| X86G_CC_MASK_O )
+ )
+ )
+ );
+ /* Set NDEP even though it isn't used. This makes redundant-PUT
+ elimination of previous stores to this field work better. */
+ stmt( IRStmt_Put( OFFB_CC_NDEP, mkU32(0) ));
+
+ /* Also need to set the D flag, which is held in bit 10 of t1.
+ If zero, put 1 in OFFB_DFLAG, else -1 in OFFB_DFLAG. */
+ stmt( IRStmt_Put(
+ OFFB_DFLAG,
+ IRExpr_Mux0X(
+ unop(Iop_32to8,
+ binop(Iop_And32,
+ binop(Iop_Shr32, mkexpr(t1), mkU8(10)),
+ mkU32(1))),
+ mkU32(1),
+ mkU32(0xFFFFFFFF)))
+ );
+
+ /* Set the ID flag */
+ stmt( IRStmt_Put(
+ OFFB_IDFLAG,
+ IRExpr_Mux0X(
+ unop(Iop_32to8,
+ binop(Iop_And32,
+ binop(Iop_Shr32, mkexpr(t1), mkU8(21)),
+ mkU32(1))),
+ mkU32(0),
+ mkU32(1)))
+ );
+
+ /* And set the AC flag. If setting it 1 to, possibly emit an
+ emulation warning. */
+ stmt( IRStmt_Put(
+ OFFB_ACFLAG,
+ IRExpr_Mux0X(
+ unop(Iop_32to8,
+ binop(Iop_And32,
+ binop(Iop_Shr32, mkexpr(t1), mkU8(18)),
+ mkU32(1))),
+ mkU32(0),
+ mkU32(1)))
+ );
+
+ if (emit_AC_emwarn) {
+ put_emwarn( mkU32(EmWarn_X86_acFlag) );
+ stmt(
+ IRStmt_Exit(
+ binop( Iop_CmpNE32,
+ binop(Iop_And32, mkexpr(t1), mkU32(1<<18)),
+ mkU32(0) ),
+ Ijk_EmWarn,
+ IRConst_U32( next_insn_EIP )
+ )
+ );
+ }
+}
+
+
/* Helper for deciding whether a given insn (starting at the opcode
byte) may validly be used with a LOCK prefix. The following insns
may be used with LOCK when their destination operand is in memory.
@@ -11124,7 +11213,32 @@
dres.whatNext = Dis_StopHere;
DIP("ret\n");
break;
-
+
+ case 0xCF: /* IRET */
+ /* Note, this is an extremely kludgey and limited implementation
+ of iret. All it really does is:
+ popl %EIP; popl %CS; popl %EFLAGS.
+ %CS is set but ignored (as it is in (eg) popw %cs)". */
+ t1 = newTemp(Ity_I32); /* ESP */
+ t2 = newTemp(Ity_I32); /* new EIP */
+ t3 = newTemp(Ity_I32); /* new CS */
+ t4 = newTemp(Ity_I32); /* new EFLAGS */
+ assign(t1, getIReg(4,R_ESP));
+ assign(t2, loadLE(Ity_I32, binop(Iop_Add32,mkexpr(t1),mkU32(0) )));
+ assign(t3, loadLE(Ity_I32, binop(Iop_Add32,mkexpr(t1),mkU32(4) )));
+ assign(t4, loadLE(Ity_I32, binop(Iop_Add32,mkexpr(t1),mkU32(8) )));
+ /* Get stuff off stack */
+ putIReg(4, R_ESP,binop(Iop_Add32, mkexpr(t1), mkU32(12)));
+ /* set %CS (which is ignored anyway) */
+ putSReg( R_CS, unop(Iop_32to16, mkexpr(t3)) );
+ /* set %EFLAGS */
+ set_EFLAGS_from_value( t4, False/*!emit_AC_emwarn*/, 0/*unused*/ );
+ /* goto new EIP value */
+ jmp_treg(Ijk_Ret,t2);
+ dres.whatNext = Dis_StopHere;
+ DIP("iret (very kludgey)\n");
+ break;
+
case 0xE8: /* CALL J4 */
d32 = getUDisp32(delta); delta += 4;
d32 += (guest_EIP_bbstart+delta);
@@ -11864,72 +11978,12 @@
assign(t2, getIReg(4, R_ESP));
assign(t1, widenUto32(loadLE(szToITy(sz),mkexpr(t2))));
putIReg(4, R_ESP, binop(Iop_Add32, mkexpr(t2), mkU32(sz)));
- /* t1 is the flag word. Mask out everything except OSZACP and
- set the flags thunk to X86G_CC_OP_COPY. */
- stmt( IRStmt_Put( OFFB_CC_OP, mkU32(X86G_CC_OP_COPY) ));
- stmt( IRStmt_Put( OFFB_CC_DEP2, mkU32(0) ));
- stmt( IRStmt_Put( OFFB_CC_DEP1,
- binop(Iop_And32,
- mkexpr(t1),
- mkU32( X86G_CC_MASK_C | X86G_CC_MASK_P
- | X86G_CC_MASK_A | X86G_CC_MASK_Z
- | X86G_CC_MASK_S| X86G_CC_MASK_O )
- )
- )
- );
- /* Set NDEP even though it isn't used. This makes redundant-PUT
- elimination of previous stores to this field work better. */
- stmt( IRStmt_Put( OFFB_CC_NDEP, mkU32(0) ));
- /* Also need to set the D flag, which is held in bit 10 of t1.
- If zero, put 1 in OFFB_DFLAG, else -1 in OFFB_DFLAG. */
- stmt( IRStmt_Put(
- OFFB_DFLAG,
- IRExpr_Mux0X(
- unop(Iop_32to8,
- binop(Iop_And32,
- binop(Iop_Shr32, mkexpr(t1), mkU8(10)),
- mkU32(1))),
- mkU32(1),
- mkU32(0xFFFFFFFF)))
- );
+ /* Generate IR to set %EFLAGS{O,S,Z,A,C,P,D,ID,AC} from the
+ value in t1. */
+ set_EFLAGS_from_value( t1, True/*emit_AC_emwarn*/,
+ ((Addr32)guest_EIP_bbstart)+delta );
- /* Set the ID flag */
- stmt( IRStmt_Put(
- OFFB_IDFLAG,
- IRExpr_Mux0X(
- unop(Iop_32to8,
- binop(Iop_And32,
- binop(Iop_Shr32, mkexpr(t1), mkU8(21)),
- mkU32(1))),
- mkU32(0),
- mkU32(1)))
- );
-
- /* And set the AC flag. If setting it 1 to, emit an emulation
- warning. */
- stmt( IRStmt_Put(
- OFFB_ACFLAG,
- IRExpr_Mux0X(
- unop(Iop_32to8,
- binop(Iop_And32,
- binop(Iop_Shr32, mkexpr(t1), mkU8(18)),
- mkU32(1))),
- mkU32(0),
- mkU32(1)))
- );
-
- put_emwarn( mkU32(EmWarn_X86_acFlag) );
- stmt(
- IRStmt_Exit(
- binop( Iop_CmpNE32,
- binop(Iop_And32, mkexpr(t1), mkU32(1<<18)),
- mkU32(0) ),
- Ijk_EmWarn,
- IRConst_U32( ((Addr32)guest_EIP_bbstart)+delta)
- )
- );
-
DIP("popf%c\n", nameISize(sz));
break;
|
|
From: Tom H. <to...@co...> - 2008-01-04 00:19:21
|
On 03/01/2008, Nicholas Nethercote <nj...@cs...> wrote: > If a kernel type isn't present, a vki_* version should be added. > See the comment at the top of include/vki/vki-linux.h. > > But don't trust the man pages, they mostly describe glibc's wrappers for the > syscalls. These mostly are the same as the kernel syscalls, but not always. > Only trust the kernel code. Unfortunately, I can't remember where in the > kernel code the syscall prototypes are defined. There isn't one place - each call will be in a place appropriate to the systems it works on. In this case fs/sync.c is the file, and the prototype is: asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, unsigned int flags) So vki_loff_t is the thing to use. The wrapper should probably also validate the file descriptor like other wrappers which have file descriptor arguments do. Tom -- Tom Hughes (to...@co...) http://www.compton.nu/ |