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
(12) |
2
(11) |
3
(8) |
|
4
(9) |
5
(10) |
6
(18) |
7
(8) |
8
(12) |
9
(23) |
10
(14) |
|
11
(15) |
12
(31) |
13
(45) |
14
(28) |
15
(20) |
16
(16) |
17
(9) |
|
18
(18) |
19
(26) |
20
(49) |
21
(14) |
22
(18) |
23
(24) |
24
(28) |
|
25
(39) |
26
(17) |
27
(27) |
28
(27) |
29
(14) |
30
(44) |
|
|
From: <sv...@va...> - 2005-09-26 14:50:48
|
Author: njn Date: 2005-09-26 15:50:39 +0100 (Mon, 26 Sep 2005) New Revision: 4784 Log: add note Modified: trunk/docs/internals/roadmap.txt Modified: trunk/docs/internals/roadmap.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/docs/internals/roadmap.txt 2005-09-26 13:42:16 UTC (rev 4783) +++ trunk/docs/internals/roadmap.txt 2005-09-26 14:50:39 UTC (rev 4784) @@ -30,7 +30,8 @@ lot since. Get Cachegrind working with it (Nick). =20 * Rewrite address space manager; statically link the core with - each tool; remove all glibc dependencies (Julian). + each tool; remove all glibc dependencies (Julian). [What about + --time-stamp=3Dyes?] =20 * Make it work with GCC 2.95 (bug #111781) -- don't put declarations aft= er statements in blocks. Do it after merging ASPACEM with the trunk. |
|
From: <sv...@va...> - 2005-09-26 13:42:33
|
Author: sewardj
Date: 2005-09-26 14:42:16 +0100 (Mon, 26 Sep 2005)
New Revision: 4783
Log:
Add a simulation for /proc/self/cmdline using the scheme suggested by
Tom Hughes. As a side effect, we now have VG_(mkstemp), and
VG_(random) is generalised to allow multiple simultaneous generators.
OOo finally runs successfully on this branch now.
Modified:
branches/ASPACEM/coregrind/m_clientstate.c
branches/ASPACEM/coregrind/m_debugger.c
branches/ASPACEM/coregrind/m_libcbase.c
branches/ASPACEM/coregrind/m_libcfile.c
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/coregrind/m_skiplist.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c
branches/ASPACEM/coregrind/pub_core_clientstate.h
branches/ASPACEM/coregrind/pub_core_libcfile.h
branches/ASPACEM/include/pub_tool_libcbase.h
branches/ASPACEM/include/pub_tool_libcfile.h
Modified: branches/ASPACEM/coregrind/m_clientstate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_clientstate.c 2005-09-26 10:05:38 UTC (r=
ev 4782)
+++ branches/ASPACEM/coregrind/m_clientstate.c 2005-09-26 13:42:16 UTC (r=
ev 4783)
@@ -53,8 +53,10 @@
Addr VG_(brk_limit) =3D 0; /* current brk */
=20
/* A fd which refers to the client executable. */
-Int VG_(clexecfd) =3D -1;
+Int VG_(cl_exec_fd) =3D -1;
=20
+/* A fd which refers to the fake /proc/<pid>/cmdline in /tmp. */
+Int VG_(cl_cmdline_fd) =3D -1;
=20
// Command line pieces, after they have been extracted from argv in
// m_main.main(). The payload vectors are allocated in VG_AR_TOOL
Modified: branches/ASPACEM/coregrind/m_debugger.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_debugger.c 2005-09-26 10:05:38 UTC (rev =
4782)
+++ branches/ASPACEM/coregrind/m_debugger.c 2005-09-26 13:42:16 UTC (rev =
4783)
@@ -122,7 +122,7 @@
Char *cmdptr;
=20
VG_(sprintf)(pidbuf, "%d", pid);
- VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(clexecfd));
+ VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(cl_exec_fd));
=20
bufptr =3D buf;
cmdptr =3D VG_(clo_db_command);
Modified: branches/ASPACEM/coregrind/m_libcbase.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_libcbase.c 2005-09-26 10:05:38 UTC (rev =
4782)
+++ branches/ASPACEM/coregrind/m_libcbase.c 2005-09-26 13:42:16 UTC (rev =
4783)
@@ -497,19 +497,22 @@
#undef SORT
}
=20
+// This random number generator is based on the one suggested in Kernigh=
an
+// and Ritchie's "The C Programming Language".
+
+// A pseudo-random number generator returning a random UInt. If pSeed
+// is NULL, it uses its own seed, which starts at zero. If pSeed is
+// non-NULL, it uses and updates whatever pSeed points at.
+
static UInt seed =3D 0;
=20
-void VG_(srandom)(UInt s)
+UInt VG_(random)( /*MOD*/UInt* pSeed )
{
- seed =3D s;
-}
+ if (pSeed =3D=3D NULL)=20
+ pSeed =3D &seed;
=20
-// This random number generator is based on the one suggested in Kernigh=
an
-// and Ritchie's "The C Programming Language".
-UInt VG_(random)(void)
-{
- seed =3D (1103515245*seed + 12345);
- return seed;
+ *pSeed =3D (1103515245 * *pSeed + 12345);
+ return *pSeed;
}
=20
/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/coregrind/m_libcfile.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_libcfile.c 2005-09-26 10:05:38 UTC (rev =
4782)
+++ branches/ASPACEM/coregrind/m_libcfile.c 2005-09-26 13:42:16 UTC (rev =
4783)
@@ -33,6 +33,7 @@
#include "pub_core_libcassert.h"
#include "pub_core_libcfile.h"
#include "pub_core_libcprint.h" // For VG_(sprintf)()
+#include "pub_core_libcproc.h" // VG_(getpid), VG_(getppid)
#include "pub_core_syscall.h"
#include "vki_unistd.h"
=20
@@ -140,10 +141,9 @@
return res.isError ? (-1) : buf.st_size;
}
=20
-Int VG_(dup2) ( Int oldfd, Int newfd )
+SysRes VG_(dup) ( Int oldfd )
{
- SysRes res =3D VG_(do_syscall2)(__NR_dup2, oldfd, newfd);
- return res.isError ? (-1) : res.val;
+ return VG_(do_syscall1)(__NR_dup, oldfd);
}
=20
/* Returns -1 on error. */
@@ -219,6 +219,48 @@
return res;
}
=20
+/* Create and open (-rw------) a tmp file name incorporating said arg.
+ Returns -1 on failure, else the fd of the file. If fullname is
+ non-NULL, the file's name is written into it. The number of bytes
+ written is guaranteed not to exceed 64+strlen(part_of_name). */
+
+Int VG_(mkstemp) ( HChar* part_of_name, /*OUT*/HChar* fullname )
+{
+ HChar buf[200];
+ Int n, tries, fd;
+ UInt seed;
+ SysRes sres;
+
+ vg_assert(part_of_name);
+ n =3D VG_(strlen)(part_of_name);
+ vg_assert(n > 0 && n < 100);
+
+ seed =3D (VG_(getpid)() << 9) ^ VG_(getppid)();
+
+ tries =3D 0;
+ while (True) {
+ if (tries > 10)=20
+ return -1;
+ VG_(sprintf)( buf, "/tmp/valgrind_%s_%08x",=20
+ part_of_name, VG_(random)( &seed ));
+ if (0)
+ VG_(printf)("VG_(mkstemp): trying: %s\n", buf);
+
+ sres =3D VG_(open)(buf,
+ VKI_O_CREAT|VKI_O_RDWR|VKI_O_EXCL|VKI_O_TRUNC,
+ VKI_S_IRUSR|VKI_S_IWUSR);
+ if (sres.isError)
+ continue;
+ /* VG_(safe_fd) doesn't return if it fails. */
+ fd =3D VG_(safe_fd)( sres.val );
+ if (fullname)
+ VG_(strcpy)( fullname, buf );
+ return fd;
+ }
+ /* NOTREACHED */
+}
+
+
/* ---------------------------------------------------------------------
Socket-related stuff. This is very Linux-kernel specific.
------------------------------------------------------------------ */
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-26 10:05:38 UTC (rev 4782=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-26 13:42:16 UTC (rev 4783=
)
@@ -853,7 +853,7 @@
executable. This is needed for attaching to GDB. */
res =3D VG_(open)(exec, VKI_O_RDONLY, VKI_S_IRUSR);
if (!res.isError)
- VG_(clexecfd) =3D res.val;
+ VG_(cl_exec_fd) =3D res.val;
=20
/* Copy necessary bits of 'info' that were filled in */
*client_eip =3D info->init_eip;
@@ -1681,8 +1681,8 @@
/* Update the soft limit. */
VG_(setrlimit)(VKI_RLIMIT_NOFILE, &rl);
=20
- if (VG_(clexecfd) !=3D -1)
- VG_(clexecfd) =3D VG_(safe_fd)( VG_(clexecfd) );
+ if (VG_(cl_exec_fd) !=3D -1)
+ VG_(cl_exec_fd) =3D VG_(safe_fd)( VG_(cl_exec_fd) );
}
=20
=20
@@ -2125,15 +2125,15 @@
// p: load_client() [for 'info' and hence VG_(brk_base)]
//--------------------------------------------------------------
if (!need_help) {=20
- SizeT m1 =3D 1024 * 1024;
- SizeT m8 =3D 8 * m1;
- SizeT dseg_max_size =3D (SizeT)VG_(client_rlimit_data).rlim_cur;
- VG_(debugLog)(1, "main", "Setup client data (brk) segment\n");
- if (dseg_max_size < m1) dseg_max_size =3D m1;
- if (dseg_max_size > m8) dseg_max_size =3D m8;
- dseg_max_size =3D VG_PGROUNDUP(dseg_max_size);
+ SizeT m1 =3D 1024 * 1024;
+ SizeT m8 =3D 8 * m1;
+ SizeT dseg_max_size =3D (SizeT)VG_(client_rlimit_data).rlim_cur;
+ VG_(debugLog)(1, "main", "Setup client data (brk) segment\n");
+ if (dseg_max_size < m1) dseg_max_size =3D m1;
+ if (dseg_max_size > m8) dseg_max_size =3D m8;
+ dseg_max_size =3D VG_PGROUNDUP(dseg_max_size);
=20
- setup_client_dataseg( dseg_max_size );
+ setup_client_dataseg( dseg_max_size );
}
=20
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -2150,6 +2150,51 @@
setup_file_descriptors();
=20
//--------------------------------------------------------------
+ // create the fake /proc/<pid>/cmdline file and then unlink it,
+ // but hold onto the fd, so we can hand it out to the client
+ // when it tries to open /proc/<pid>/cmdline for itself.
+ // p: setup file descriptors
+ //--------------------------------------------------------------
+ if (!need_help) {
+ HChar buf[50], buf2[50+64];
+ HChar nul[1];
+ Int fd, r;
+ HChar* exename;
+
+ VG_(debugLog)(1, "main", "Create fake /proc/<pid>/cmdline\n");
+
+ VG_(sprintf)(buf, "proc_%d_cmdline", VG_(getpid)());
+ fd =3D VG_(mkstemp)( buf, buf2 );
+ if (fd =3D=3D -1)
+ config_error("Can't create client cmdline file in /tmp.");
+
+ nul[0] =3D 0;
+ exename =3D VG_(args_the_exename) ? VG_(args_the_exename)
+ : "unknown_exename";
+
+ VG_(write)(fd, VG_(args_the_exename),=20
+ VG_(strlen)( VG_(args_the_exename) ));
+ VG_(write)(fd, nul, 1);
+
+ for (i =3D 0; i < VG_(args_for_client).used; i++) {
+ VG_(write)(fd, VG_(args_for_client).strs[i],
+ VG_(strlen)( VG_(args_for_client).strs[i] ));
+ VG_(write)(fd, nul, 1);
+ }
+
+ /* Don't bother to seek the file back to the start; instead do
+ it every time a copy of it is given out (by PRE(sys_open)).=20
+ That is probably more robust across fork() etc. */
+
+ /* Now delete it, but hang on to the fd. */
+ r =3D VG_(unlink)( buf2 );
+ if (r)
+ config_error("Can't delete client cmdline file in /tmp.");
+
+ VG_(cl_cmdline_fd) =3D fd;
+ }
+
+ //--------------------------------------------------------------
// Init tool part 1: pre_clo_init
// p: setup_client_stack() [for 'VG_(client_arg[cv]']
// p: setup_file_descriptors() [for 'VG_(fd_xxx_limit)']
Modified: branches/ASPACEM/coregrind/m_skiplist.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_skiplist.c 2005-09-26 10:05:38 UTC (rev =
4782)
+++ branches/ASPACEM/coregrind/m_skiplist.c 2005-09-26 13:42:16 UTC (rev =
4783)
@@ -119,7 +119,7 @@
{
UInt ret =3D 0;
=20
- while((ret < SK_MAXHEIGHT - 1) && (VG_(random)() & 1))
+ while((ret < SK_MAXHEIGHT - 1) && (VG_(random)(NULL) & 1))
ret++;
=20
return ret;
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-26 10:=
05:38 UTC (rev 4782)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-26 13:=
42:16 UTC (rev 4783)
@@ -4937,7 +4937,9 @@
=20
PRE(sys_open)
{
- *flags |=3D SfMayBlock;
+ HChar name[30];
+ SysRes sres;
+
if (ARG2 & VKI_O_CREAT) {
// 3-arg version
PRINT("sys_open ( %p(%s), %d, %d )",ARG1,ARG1,ARG2,ARG3);
@@ -4950,6 +4952,28 @@
const char *, filename, int, flags);
}
PRE_MEM_RASCIIZ( "open(filename)", ARG1 );
+
+ /* Handle the case where the open is of /proc/self/cmdline or
+ /proc/<pid>/cmdline, and just give it a copy of the fd for the
+ fake file we cooked up at startup (in m_main). Also, seek the
+ cloned fd back to the start. */
+
+ VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)());
+ if (ML_(safe_to_deref)( (void*)ARG1, 1 )
+ && (VG_(strcmp)((Char *)ARG1, name) =3D=3D 0=20
+ || VG_(strcmp)((Char *)ARG1, "/proc/self/cmdline") =3D=3D 0))=
{
+ sres =3D VG_(dup)( VG_(cl_cmdline_fd) );
+ SET_STATUS_from_SysRes( sres );
+ if (!sres.isError) {
+ OffT off =3D VG_(lseek)( sres.val, 0, VKI_SEEK_SET );
+ if (off)
+ SET_STATUS_Failure( VKI_EMFILE );
+ }
+ return;
+ }
+
+ /* Otherwise handle normally */
+ *flags |=3D SfMayBlock;
}
=20
POST(sys_open)
@@ -5110,7 +5134,7 @@
VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
if (VG_(strcmp)((Char *)ARG1, name) =3D=3D 0 ||
VG_(strcmp)((Char *)ARG1, "/proc/self/exe") =3D=3D 0) {
- VG_(sprintf)(name, "/proc/self/fd/%d", VG_(clexecfd));
+ VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd));
SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name, AR=
G2, ARG3));
}
}
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c 2005-09-26 10:05:=
38 UTC (rev 4782)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c 2005-09-26 13:42:=
16 UTC (rev 4783)
@@ -673,7 +673,7 @@
success. */
PRINT(" --> [pre-success] Success(0x%llx)\n", (Long)sci->status.va=
l );
=20
- /* In this case thes allowable flag are to ask for a signal-poll
+ /* In this case the allowable flags are to ask for a signal-poll
and/or a yield after the call. Changing the args isn't
allowed. */
vg_assert(0 =3D=3D (sci->flags & ~(SfPollAfter | SfYieldAfter)));
Modified: branches/ASPACEM/coregrind/pub_core_clientstate.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-26 10:05:38=
UTC (rev 4782)
+++ branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-26 13:42:16=
UTC (rev 4783)
@@ -52,8 +52,19 @@
extern Addr VG_(brk_limit); // current brk
=20
/* A fd which refers to the client executable. */
-extern Int VG_(clexecfd);
+extern Int VG_(cl_exec_fd);
=20
+/* A fd which refers to the fake /proc/<pid>/cmdline in /tmp. The
+ idea is: make up the /proc/<pid>/cmdline file the client would
+ expect to see if it was running natively. Copy into a file in
+ /tmp. When the client then does an open of /proc/<pid>/cmdline or
+ /proc/self/cmdline, instead give it a file handle to the file in
+ /tmp. The problem of deleting said file when Valgrind exits is
+ neatly sidestepped by unlinking it as soon as it has been created,
+ but holding on to the file handle. That causes the kernel to keep
+ the file contents alive exactly until the process exits. */
+extern Int VG_(cl_cmdline_fd);
+
// Client's original rlimit data and rlimit stack
extern struct vki_rlimit VG_(client_rlimit_data);
extern struct vki_rlimit VG_(client_rlimit_stack);
Modified: branches/ASPACEM/coregrind/pub_core_libcfile.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_libcfile.h 2005-09-26 10:05:38 UT=
C (rev 4782)
+++ branches/ASPACEM/coregrind/pub_core_libcfile.h 2005-09-26 13:42:16 UT=
C (rev 4783)
@@ -67,6 +67,12 @@
=20
extern SysRes VG_(pread) ( Int fd, void* buf, Int count, Int offset );
=20
+/* Create and open (-rw------) a tmp file name incorporating said arg.
+ Returns -1 on failure, else the fd of the file. If fullname is
+ non-NULL, the file's name is written into it. The number of bytes
+ written is guaranteed not to exceed 64+strlen(part_of_name). */
+extern Int VG_(mkstemp) ( HChar* part_of_name, /*OUT*/HChar* fullname );
+
#endif // __PUB_CORE_LIBCFILE_H
=20
/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/include/pub_tool_libcbase.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/include/pub_tool_libcbase.h 2005-09-26 10:05:38 UTC =
(rev 4782)
+++ branches/ASPACEM/include/pub_tool_libcbase.h 2005-09-26 13:42:16 UTC =
(rev 4783)
@@ -114,10 +114,10 @@
/* Returns the base-2 logarithm of x. */
extern Int VG_(log2) ( Int x );
=20
-// A pseudo-random number generator returning a random UInt, and its
-// seed function.
-extern void VG_(srandom) ( UInt seed );
-extern UInt VG_(random) ( void );
+// A pseudo-random number generator returning a random UInt. If pSeed
+// is NULL, it uses its own seed, which starts at zero. If pSeed is
+// non-NULL, it uses and updates whatever pSeed points at.
+extern UInt VG_(random) ( /*MOD*/UInt* pSeed );
=20
#endif // __PUB_TOOL_LIBCBASE_H
=20
Modified: branches/ASPACEM/include/pub_tool_libcfile.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/include/pub_tool_libcfile.h 2005-09-26 10:05:38 UTC =
(rev 4782)
+++ branches/ASPACEM/include/pub_tool_libcfile.h 2005-09-26 13:42:16 UTC =
(rev 4783)
@@ -44,7 +44,7 @@
=20
extern SysRes VG_(stat) ( Char* file_name, struct vki_stat* buf );
extern Int VG_(fstat) ( Int fd, struct vki_stat* buf );
-extern Int VG_(dup2) ( Int oldfd, Int newfd );
+extern SysRes VG_(dup) ( Int oldfd );
extern Int VG_(rename) ( Char* old_name, Char* new_name );
extern Int VG_(unlink) ( Char* file_name );
=20
|
|
From: <sv...@va...> - 2005-09-26 10:05:45
|
Author: sewardj
Date: 2005-09-26 11:05:38 +0100 (Mon, 26 Sep 2005)
New Revision: 4782
Log:
Make the leak checker work properly again: don't use client heap
sections as sources of roots. This requires aspacem to keep track of
which anonymous client mappings 'belong' to m_mallocfree.
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
branches/ASPACEM/coregrind/m_mallocfree.c
branches/ASPACEM/include/pub_tool_aspacemgr.h
branches/ASPACEM/memcheck/mac_leakcheck.c
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-26 01:55:1=
4 UTC (rev 4781)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-26 10:05:3=
8 UTC (rev 4782)
@@ -512,47 +512,50 @@
case SkAnonC: case SkAnonV:
VG_(debugLog)(
logLevel, "aspacem",
- "%3d: %s %010llx-%010llx %s %c%c%c%c\n",
+ "%3d: %s %010llx-%010llx %s %c%c%c%c%c\n",
segNo, show_SegKind(seg->kind),
(ULong)seg->start, (ULong)seg->end, len_buf,
seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',=20
- seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-'=20
+ seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',
+ seg->isCH ? 'H' : '-'
);
break;
=20
case SkFileC: case SkFileV:
VG_(debugLog)(
logLevel, "aspacem",
- "%3d: %s %010llx-%010llx %s %c%c%c%c d=3D0x%03llx "
+ "%3d: %s %010llx-%010llx %s %c%c%c%c%c d=3D0x%03llx "
"i=3D%-7lld o=3D%-7lld (%d)\n",
segNo, show_SegKind(seg->kind),
(ULong)seg->start, (ULong)seg->end, len_buf,
seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',=20
seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',=20
+ seg->isCH ? 'H' : '-',
(ULong)seg->dev, (ULong)seg->ino, (Long)seg->offset, seg->fn=
Idx
);
break;
=20
- case SkResvn:
- VG_(debugLog)(
- logLevel, "aspacem",
- "%3d: %s %010llx-%010llx %s %c%c%c%c %s\n",
- segNo, show_SegKind(seg->kind),
- (ULong)seg->start, (ULong)seg->end, len_buf,
- seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',=20
- seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',=20
- show_ShrinkMode(seg->smode)
- );
- break;
+ case SkResvn:
+ VG_(debugLog)(
+ logLevel, "aspacem",
+ "%3d: %s %010llx-%010llx %s %c%c%c%c%c %s\n",
+ segNo, show_SegKind(seg->kind),
+ (ULong)seg->start, (ULong)seg->end, len_buf,
+ seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',=20
+ seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',=20
+ seg->isCH ? 'H' : '-',
+ show_ShrinkMode(seg->smode)
+ );
+ break;
=20
- default:
- VG_(debugLog)(
- logLevel, "aspacem",
- "%3d: ???? UNKNOWN SEGMENT KIND\n",=20
- segNo=20
- );
- break;
- }
+ default:
+ VG_(debugLog)(
+ logLevel, "aspacem",
+ "%3d: ???? UNKNOWN SEGMENT KIND\n",=20
+ segNo=20
+ );
+ break;
+ }
}
=20
/* Print out the segment array (debugging only!). */
@@ -668,21 +671,25 @@
return=20
s->smode =3D=3D SmFixed
&& s->dev =3D=3D 0 && s->ino =3D=3D 0 && s->offset =3D=3D 0 =
&& s->fnIdx =3D=3D -1=20
- && !s->hasR && !s->hasW && !s->hasX && !s->hasT;
+ && !s->hasR && !s->hasW && !s->hasX && !s->hasT
+ && !s->isCH;
=20
case SkAnonC: case SkAnonV:
return=20
s->smode =3D=3D SmFixed=20
- && s->dev =3D=3D 0 && s->ino =3D=3D 0 && s->offset =3D=3D 0 =
&& s->fnIdx =3D=3D -1;
+ && s->dev =3D=3D 0 && s->ino =3D=3D 0 && s->offset =3D=3D 0 =
&& s->fnIdx =3D=3D -1
+ && (s->kind=3D=3DSkAnonC ? True : !s->isCH);
=20
case SkFileC: case SkFileV:
return=20
- s->smode =3D=3D SmFixed;
+ s->smode =3D=3D SmFixed
+ && !s->isCH;
=20
case SkResvn:=20
return=20
s->dev =3D=3D 0 && s->ino =3D=3D 0 && s->offset =3D=3D 0 && =
s->fnIdx =3D=3D -1=20
- && !s->hasR && !s->hasW && !s->hasX && !s->hasT;
+ && !s->hasR && !s->hasW && !s->hasX && !s->hasT
+ && !s->isCH;
=20
default:
return False;
@@ -713,8 +720,8 @@
return True;
=20
case SkAnonC: case SkAnonV:
- if (s1->hasR =3D=3D s2->hasR=20
- && s1->hasW =3D=3D s2->hasW && s1->hasX =3D=3D s2->hasX) {
+ if (s1->hasR =3D=3D s2->hasR && s1->hasW =3D=3D s2->hasW=20
+ && s1->hasX =3D=3D s2->hasX && s1->isCH =3D=3D s2->isCH) {
s1->end =3D s2->end;
s1->hasT |=3D s2->hasT;
return True;
@@ -1345,7 +1352,7 @@
seg->ino =3D 0;
seg->offset =3D 0;
seg->fnIdx =3D -1;
- seg->hasR =3D seg->hasW =3D seg->hasX =3D seg->hasT =3D False;
+ seg->hasR =3D seg->hasW =3D seg->hasX =3D seg->hasT =3D seg->isCH =3D=
False;
seg->mark =3D False;
}
=20
Modified: branches/ASPACEM/coregrind/m_mallocfree.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_mallocfree.c 2005-09-26 01:55:14 UTC (re=
v 4781)
+++ branches/ASPACEM/coregrind/m_mallocfree.c 2005-09-26 10:05:38 UTC (re=
v 4782)
@@ -537,6 +537,7 @@
{
Superblock* sb;
SysRes sres;
+ NSegment* seg;
=20
// Take into account admin bytes in the Superblock.
cszB +=3D sizeof(Superblock);
@@ -551,6 +552,12 @@
if (sres.isError)
return 0;
sb =3D (Superblock*)sres.val;
+ // Mark this segment as containing client heap. The leak
+ // checker needs to be able to identify such segments so as not
+ // to use them as sources of roots during leak checks.
+ seg =3D VG_(am_find_nsegment)( (Addr)sb );
+ vg_assert(seg && seg->kind =3D=3D SkAnonC);
+ seg->isCH =3D True;
} else {
// non-client allocation -- abort if it fails
sres =3D VG_(am_mmap_anon_float_valgrind)( cszB );
Modified: branches/ASPACEM/include/pub_tool_aspacemgr.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/include/pub_tool_aspacemgr.h 2005-09-26 01:55:14 UTC=
(rev 4781)
+++ branches/ASPACEM/include/pub_tool_aspacemgr.h 2005-09-26 10:05:38 UTC=
(rev 4782)
@@ -101,7 +101,9 @@
Bool hasW;
Bool hasX;
Bool hasT; // True --> translations have (or MAY have)
- /* Admin */ // been taken from this segment
+ // been taken from this segment
+ Bool isCH; // True --> is client heap (SkAnonC ONLY)
+ /* Admin */
Bool mark;
}
NSegment;
Modified: branches/ASPACEM/memcheck/mac_leakcheck.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/memcheck/mac_leakcheck.c 2005-09-26 01:55:14 UTC (re=
v 4781)
+++ branches/ASPACEM/memcheck/mac_leakcheck.c 2005-09-26 10:05:38 UTC (re=
v 4782)
@@ -117,19 +117,23 @@
-- Unreached; so far, no pointers to any part of it have been found.=20
-- IndirectLeak; leaked, but referred to by another leaked block
*/
-typedef enum {=20
- Unreached,=20
- IndirectLeak,
- Interior,=20
- Proper
- } Reachedness;
+typedef=20
+ enum {=20
+ Unreached,=20
+ IndirectLeak,
+ Interior,=20
+ Proper
+ }
+ Reachedness;
=20
/* An entry in the mark stack */
-typedef struct {
- Int next:30; /* Index of next in mark stack */
- UInt state:2; /* Reachedness */
- SizeT indirect; /* if Unreached, how much is unreachable from here *=
/
-} MarkStack;
+typedef=20
+ struct {
+ Int next:30; /* Index of next in mark stack */
+ UInt state:2; /* Reachedness */
+ SizeT indirect; /* if Unreached, how much is unreachable from here=
*/
+ }=20
+ MarkStack;
=20
/* A block record, used for generating err msgs. */
typedef
@@ -147,11 +151,13 @@
LossRecord;
=20
/* The 'extra' struct for leak errors. */
-typedef struct {
- UInt n_this_record;
- UInt n_total_records;
- LossRecord* lossRecord;
-} LeakExtra;
+typedef=20
+ struct {
+ UInt n_this_record;
+ UInt n_total_records;
+ LossRecord* lossRecord;
+ }
+ LeakExtra;
=20
/* Find the i such that ptr points at or inside the block described by
shadows[i]. Return -1 if none found. This assumes that shadows[]
@@ -324,7 +330,7 @@
/* If ptr is pointing to a heap-allocated block which hasn't been seen
before, push it onto the mark stack. Clique is the index of the
clique leader; -1 if none. */
-static void _lc_markstack_push(Addr ptr, Int clique)
+static void lc_markstack_push_WRK(Addr ptr, Int clique)
{
Int sh_no;
=20
@@ -353,6 +359,8 @@
lc_markstack_top =3D sh_no;
}
=20
+ tl_assert(clique >=3D -1 && clique < lc_n_shadows);
+
if (clique !=3D -1) {
if (0)
VG_(printf)("mopup: %d: %p is %d\n",=20
@@ -394,7 +402,7 @@
=20
static void lc_markstack_push(Addr ptr)
{
- _lc_markstack_push(ptr, -1);
+ lc_markstack_push_WRK(ptr, -1);
}
=20
/* Return the top of the mark stack, if any. */
@@ -416,7 +424,7 @@
=20
If clique !=3D -1, it means we're gathering leaked memory into
cliques, and clique is the index of the current clique leader. */
-static void _lc_scan_memory(Addr start, SizeT len, Int clique)
+static void lc_scan_memory_WRK(Addr start, SizeT len, Int clique)
{
Addr ptr =3D VG_ROUNDUP(start, sizeof(Addr));
Addr end =3D VG_ROUNDDN(start+len, sizeof(Addr));
@@ -427,7 +435,7 @@
VG_(sigprocmask)(VKI_SIG_SETMASK, NULL, &sigmask);
VG_(set_fault_catcher)(scan_all_valid_memory_catcher);
=20
- lc_scanned +=3D end-ptr;
+ // lc_scanned +=3D end-ptr;
=20
if (!VG_(am_is_valid_for_client)(ptr, sizeof(Addr), VKI_PROT_READ))
ptr =3D VG_PGROUNDUP(ptr+1); /* first page bad */
@@ -449,8 +457,9 @@
=20
if (__builtin_setjmp(memscan_jmpbuf) =3D=3D 0) {
if ((*lc_is_valid_aligned_word)(ptr)) {
+ lc_scanned +=3D sizeof(Addr);
addr =3D *(Addr *)ptr;
- _lc_markstack_push(addr, clique);
+ lc_markstack_push_WRK(addr, clique);
} else if (0 && VG_DEBUG_LEAKCHECK)
VG_(printf)("%p not valid\n", ptr);
ptr +=3D sizeof(Addr);
@@ -470,7 +479,7 @@
=20
static void lc_scan_memory(Addr start, SizeT len)
{
- _lc_scan_memory(start, len, -1);
+ lc_scan_memory_WRK(start, len, -1);
}
=20
/* Process the mark stack until empty. If mopup is true, then we're
@@ -484,7 +493,7 @@
tl_assert(top >=3D 0 && top < lc_n_shadows); =20
tl_assert(lc_markstack[top].state !=3D Unreached);
=20
- _lc_scan_memory(lc_shadows[top]->data, lc_shadows[top]->size, cliq=
ue);
+ lc_scan_memory_WRK(lc_shadows[top]->data, lc_shadows[top]->size, c=
lique);
}
}
=20
@@ -521,7 +530,7 @@
if (VG_DEBUG_CLIQUE)
VG_(printf)("%d: gathering clique %p\n", i, lc_shadows[i]->data);
=20
- _lc_markstack_push(lc_shadows[i]->data, i);
+ lc_markstack_push_WRK(lc_shadows[i]->data, i);
=20
lc_do_leakcheck(i);
=20
@@ -726,14 +735,22 @@
=20
lc_scanned =3D 0;
=20
- /* Do the scan of memory, pushing any pointers onto the mark stack.
- Here, we iterate over the segment array, handing any RW client
- sections to lc_scan_memory. */
+ /* Push roots onto the mark stack. Roots are:
+ - the integer registers of all threads
+ - all mappings belonging to the client, including stacks
+ - .. but excluding any client heap segments.
+ Client heap segments are excluded because we wish to differentiate
+ client heap blocks which are referenced only from inside the heap
+ from those outside. This facilitates the indirect vs direct loss
+ categorisation, which [if the users ever manage to understand it]
+ is really useful for detecting lost cycles.
+ */
{ NSegment* seg;
Addr* seg_starts;
Int n_seg_starts;
seg_starts =3D get_seg_starts( &n_seg_starts );
tl_assert(seg_starts && n_seg_starts > 0);
+ /* VG_(am_show_nsegments)( 0,"leakcheck"); */
for (i =3D 0; i < n_seg_starts; i++) {
seg =3D VG_(am_find_nsegment)( seg_starts[i] );
tl_assert(seg);
@@ -741,6 +758,10 @@
continue;
if (!(seg->hasR && seg->hasW))
continue;
+ if (seg->isCH)
+ continue;
+ if (0)
+ VG_(printf)("ACCEPT %2d %p %p\n", i, seg->start, seg->end);
lc_scan_memory(seg->start, seg->end+1 - seg->start);
}
}
|
|
From: <js...@ac...> - 2005-09-26 02:58:02
|
Nightly build on phoenix ( SuSE 9.1 ) started at 2005-09-26 03:30:00 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 186 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <to...@co...> - 2005-09-26 02:42:03
|
Nightly build on dunsmere ( athlon, Fedora Core 4 ) started at 2005-09-26 03:30:04 BST 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 == 188 tests, 5 stderr failures, 0 stdout failures ================= memcheck/tests/leak-tree (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <th...@cy...> - 2005-09-26 02:27:55
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2005-09-26 03:15:04 BST 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 == 187 tests, 14 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) none/tests/x86/yield (stdout) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 187 tests, 14 stderr failures, 0 stdout failures ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Mon Sep 26 03:21:22 2005 --- new.short Mon Sep 26 03:27:46 2005 *************** *** 8,10 **** ! == 187 tests, 14 stderr failures, 0 stdout failures ================= memcheck/tests/addressable (stderr) --- 8,10 ---- ! == 187 tests, 14 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) *************** *** 23,24 **** --- 23,25 ---- none/tests/x86/int (stderr) + none/tests/x86/yield (stdout) |
|
From: Tom H. <th...@cy...> - 2005-09-26 02:25:23
|
Nightly build on ginetta ( i686, Red Hat 8.0 ) started at 2005-09-26 03:10:07 BST 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 == 187 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 187 tests, 2 stderr failures, 1 stdout failure ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) none/tests/x86/yield (stdout) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Mon Sep 26 03:19:23 2005 --- new.short Mon Sep 26 03:25:17 2005 *************** *** 8,13 **** ! == 187 tests, 2 stderr failures, 1 stdout failure ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) - none/tests/x86/yield (stdout) --- 8,12 ---- ! == 187 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <th...@cy...> - 2005-09-26 02:21:07
|
Nightly build on dellow ( x86_64, Fedora Core 4 ) started at 2005-09-26 03:10:07 BST 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 == 165 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) |
|
From: Tom H. <th...@cy...> - 2005-09-26 02:18:21
|
Nightly build on aston ( x86_64, Fedora Core 3 ) started at 2005-09-26 03:05:05 BST 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 == 165 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) |
|
From: Tom H. <th...@cy...> - 2005-09-26 02:14:33
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2005-09-26 03:00:03 BST 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 == 165 tests, 7 stderr failures, 0 stdout failures ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_fcntl (stderr) |
|
From: <sv...@va...> - 2005-09-26 01:55:16
|
Author: njn Date: 2005-09-26 02:55:14 +0100 (Mon, 26 Sep 2005) New Revision: 4781 Log: record an email Modified: trunk/docs/internals/segments-seginfos.txt Modified: trunk/docs/internals/segments-seginfos.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/docs/internals/segments-seginfos.txt 2005-09-26 01:49:39 UTC (r= ev 4780) +++ trunk/docs/internals/segments-seginfos.txt 2005-09-26 01:55:14 UTC (r= ev 4781) @@ -57,3 +57,74 @@ That would be unusual, but possible. You could imagine ld generating an ELF file via a mapping this way (which would probably upset Valgrind no end). + +------------------------------------------------------------------------= ----- +More from John Reiser +------------------------------------------------------------------------= ----- +> Can a Segment get split (eg. by mprotect)? + +This happens when a debugger inserts a breakpoint, or when ld-linux +relocates a module that has DT_TEXTREL, or when a co-resident monitor +rewrites some instructions. On x86, a shared lib with relocations to +.text "works" just fine. The modified pages are no longer sharable, +but the instruction stream is functional. It's even rather common, +when a builder forgets to use -fpic for one or more files. It +can be done on purpose when the modularity is more important than +the page sharing. Non-pic code is faster, too: register %ebx is +not dedicated to _GLOBAL_OFFSET_TABLE_ addressing, and global variables +can be accessed by [relocated] inline 32-bit offset rather than by +address fetched from the GOT. + +> Can a new mmap appear in the address range of an existing SegInfo? + +On x86_64 the static linker ld inserts a 1MB "hole" between .text +and .data. This is on advice from the hardware performance mavens, +because various caching+prefetching hardware can look ahead that far. +Currently ld-linux leaves this as PROT_NONE, but anybody else is +free to override that assignment. + +> From peering at various /proc/*/maps files, the following scheme +> sounds plausible: +> +> Load symbols following an mmap if: +> +> map is to a file +> map has r-x permissions +> file has a valid ELF header +> possibly: mapping is > 1 page (catches the case of mapping first +> page just to examine the header) +> +> If the client wants to subsequently chop up the mapping, or change its +> permissions, we ignore that. I have never seen any evidence in +> proc/*/maps that ld.so does such things. + +glibc-2.3.5 ld-linux does. It finds the minimum interval of pages which +covers the p_memsz of all PT_LOAD, mmap()s that much from the file [even= if +this maps beyond EOF of the file], then munmap()s [or mprotect(,,PROT_NO= NE)] +everything that is not covered by the first PT_LOAD, then +mmap(,,,MAP_FIXED,,) each remaining PT_LOAD. This is done to overcome t= he +possibility that a kernel which randomizes the placement of mmap(0, ...) +might place the first PT_LOAD so that subsequent PT_LOAD [must maintain +relative addressing to other PT_LOAD from the same file] would evict +something else. Needless to say, ld-linux assumes that it is the only a= ctor +(well, dlopen() does try for mutual exclusion) and that any "holes" betw= een +PT_LOAD from the same module are ignorable as far as allocation is +concerned. Also, there is nothing to stop a file from having PT_LOAD th= at +overlap, or appear in non-ascending order, etc. The results might depen= d on +order of processing, but always it has been by order of appearance in th= e +file. [Probably this is a good way to trigger "bugs" in ld-linux and/or= the +kernel.] + +Some algorithms and data structures internal to glibc-2.3.5 assume that +modules do not overlap. In particular, ld-linux sometimes searches +for __builtin_return_address_(0) in a set of intervals in order to deter= mine +which shared lib called ld-linux. This matters for dlsym(), dlmopen(), +etc., and assumes that the intervals are a disjoint cover of any +"legal" callers. ld-linux tries to hide all of this from the prying +eyes of anyone else [the internal version of struct link_map contains +much more than specified in <link.h>]. Some of this is good because +it changes very frequently, but some parts are bad because in the past +ld-linux has been slow to provide needed services [such as +dl_iterate_phdr()] and even antagonistic towards anybody else +trying for peaceful co-existence without the blessing of ld-linux. + |
|
From: <sv...@va...> - 2005-09-26 01:49:45
|
Author: njn
Date: 2005-09-26 02:49:39 +0100 (Mon, 26 Sep 2005)
New Revision: 4780
Log:
update
Modified:
trunk/docs/internals/3_0_BUGSTATUS.txt
Modified: trunk/docs/internals/3_0_BUGSTATUS.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/docs/internals/3_0_BUGSTATUS.txt 2005-09-26 01:12:57 UTC (rev 4=
779)
+++ trunk/docs/internals/3_0_BUGSTATUS.txt 2005-09-26 01:49:39 UTC (rev 4=
780)
@@ -150,12 +150,24 @@
FIXED-30BRANCH: TODO
=20
----------------------------------------------------------------
+112199 naked ar tool is used in vex makefile
+
+FIXED-TRUNK: vex:1397
+FIXED-30BRANCH: TODO
+
+----------------------------------------------------------------
112501 vex x86->IR: movq (0xF 0x7F 0xC1 0xF)
=20
FIXED-TRUNK: TODO
FIXED-30BRANCH: TODO
=20
----------------------------------------------------------------
+113190 Broken links in docs/html/
+
+FIXED-TRUNK: vg:4778
+FIXED-30BRANCH: TODO
+
+----------------------------------------------------------------
113230 Valgrind sys_pipe on x86-64 wrongly thinks file descriptors
should be 64bit
=20
@@ -169,13 +181,7 @@
FIXED-TRUNK: vg:4769
FIXED-30BRANCH: TODO
=20
-----------------------------------------------------------------
-113190 Broken links in docs/html/
=20
-FIXED-TRUNK: vg:4778
-FIXED-30BRANCH: TODO
-
-
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D Bugs targeted for 3.1.0 and 3.0.1 (all done, 3.0.1 released) =
=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
|
|
From: <sv...@va...> - 2005-09-26 01:12:58
|
Author: njn Date: 2005-09-26 02:12:57 +0100 (Mon, 26 Sep 2005) New Revision: 4779 Log: update Modified: trunk/docs/internals/3_0_BUGSTATUS.txt Modified: trunk/docs/internals/3_0_BUGSTATUS.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/docs/internals/3_0_BUGSTATUS.txt 2005-09-26 01:11:40 UTC (rev 4= 778) +++ trunk/docs/internals/3_0_BUGSTATUS.txt 2005-09-26 01:12:57 UTC (rev 4= 779) @@ -169,7 +169,13 @@ FIXED-TRUNK: vg:4769 FIXED-30BRANCH: TODO =20 +---------------------------------------------------------------- +113190 Broken links in docs/html/ =20 +FIXED-TRUNK: vg:4778 +FIXED-30BRANCH: TODO + + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D Bugs targeted for 3.1.0 and 3.0.1 (all done, 3.0.1 released) = =3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D |
|
From: <sv...@va...> - 2005-09-26 01:11:44
|
Author: njn
Date: 2005-09-26 02:11:40 +0100 (Mon, 26 Sep 2005)
New Revision: 4778
Log:
Fix broken links in the manual. Bug #113190.
Modified:
trunk/docs/xml/FAQ.xml
trunk/docs/xml/manual-core.xml
Modified: trunk/docs/xml/FAQ.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/docs/xml/FAQ.xml 2005-09-26 00:39:17 UTC (rev 4777)
+++ trunk/docs/xml/FAQ.xml 2005-09-26 01:11:40 UTC (rev 4778)
@@ -10,7 +10,7 @@
<releaseinfo>August 2005</releaseinfo>
<author>
<surname>
- <ulink url=3D"http://www.valgrind.org/www/developers.html">Valgrin=
d Developers</ulink>
+ <ulink url=3D"http://www.valgrind.org/info/developers.html">Valgri=
nd Developers</ulink>
</surname>
<affiliation><orgname>
<ulink url=3D"mailto:&vg-vemail;">&vg-vemail;</ulink>
@@ -404,7 +404,7 @@
</programlisting>
=20
<para>Obviously you have to start the listener process first.
- See the Manual: <ulink url=3D"http://www.valgrind.org/docs/bookset/man=
ual-core.out2file.html">Directing output to file</ulink> for more details=
.</para>
+ See the manual for more details.</para>
=20
<para>Second, if your program is statically linked, most Valgrind tool=
s
won't work as well, because they won't be able to replace certain
@@ -481,8 +481,7 @@
"still reachable", and "suppressed"?</para>
</question>
<answer>
- <para>The details are in the Manual:=20
- <ulink url=3D"http://www.valgrind.org/docs/bookset/mc-manual.leaks.ht=
ml">Memory leak detection</ulink>.</para>
+ <para>The details are in the Memcheck section of the user manual.</par=
a>
=20
<para>In short:</para>
<itemizedlist>
Modified: trunk/docs/xml/manual-core.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/docs/xml/manual-core.xml 2005-09-26 00:39:17 UTC (rev 4777)
+++ trunk/docs/xml/manual-core.xml 2005-09-26 01:11:40 UTC (rev 4778)
@@ -1597,7 +1597,7 @@
we should fix.</para>
=20
<para>Read the=20
-<ulink url=3D"http://www.valgrind.org/docs/faq/index.html">FAQ</ulink> f=
or
+<ulink url=3D"http://www.valgrind.org/docs/FAQ/">FAQ</ulink> for
more advice about common problems, crashes, etc.</para>
=20
</sect1>
|
|
From: <sv...@va...> - 2005-09-26 00:39:19
|
Author: njn
Date: 2005-09-26 01:39:17 +0100 (Mon, 26 Sep 2005)
New Revision: 4777
Log:
This was meant to go in with the last commit.
Modified:
branches/ASPACEM/coregrind/pub_core_replacemalloc.h
Modified: branches/ASPACEM/coregrind/pub_core_replacemalloc.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_replacemalloc.h 2005-09-26 00:38:=
36 UTC (rev 4776)
+++ branches/ASPACEM/coregrind/pub_core_replacemalloc.h 2005-09-26 00:39:=
17 UTC (rev 4777)
@@ -50,7 +50,7 @@
void (*tl___builtin_vec_delete)(ThreadId tid, void* p);
void* (*tl_realloc) (ThreadId tid, void* p, SizeT size);
=20
- SizeT (*arena_payload_szB) (ArenaId aid, void* payload);
+ SizeT (*arena_payload_szB) (ThreadId tid, ArenaId aid, void* pay=
load);
Bool clo_trace_malloc;
};
=20
|
|
From: <sv...@va...> - 2005-09-26 00:38:42
|
Author: njn
Date: 2005-09-26 01:38:36 +0100 (Mon, 26 Sep 2005)
New Revision: 4776
Log:
Backport some changes from the trunk, to make things easier later.
Modified:
branches/ASPACEM/coregrind/m_mallocfree.c
branches/ASPACEM/coregrind/pub_core_mallocfree.h
Modified: branches/ASPACEM/coregrind/m_mallocfree.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_mallocfree.c 2005-09-26 00:00:29 UTC (re=
v 4775)
+++ branches/ASPACEM/coregrind/m_mallocfree.c 2005-09-26 00:38:36 UTC (re=
v 4776)
@@ -60,9 +60,9 @@
/* Layout of an in-use block:
=20
this block total szB (sizeof(SizeT) bytes)
- red zone bytes (depends on Arena.rz_szB, but > sizeof(vo=
id*))
+ red zone bytes (depends on Arena.rz_szB, but >=3D sizeof=
(void*))
(payload bytes)
- red zone bytes (depends on Arena.rz_szB, but > sizeof(vo=
id*))
+ red zone bytes (depends on Arena.rz_szB, but >=3D sizeof=
(void*))
this block total szB (sizeof(SizeT) bytes)
=20
Layout of a block on the free list:
@@ -171,48 +171,50 @@
return bszB & (~SIZE_T_0x1);
}
=20
-// Set get the lower size field of a block.
+//----------------------------------------------------------------------=
-----
+
+// Get a block's size as stored, ie with the in-use/free attribute.
static __inline__
-SizeT get_bszB_lo ( Block* b )
+SizeT get_bszB_as_is ( Block* b )
{
- return *(SizeT*)&b[0];
+ UByte* b2 =3D (UByte*)b;
+ SizeT bszB_lo =3D *(SizeT*)&b2[0];
+ SizeT bszB_hi =3D *(SizeT*)&b2[mk_plain_bszB(bszB_lo) - sizeof(SizeT)=
];
+ vg_assert2(bszB_lo =3D=3D bszB_hi,=20
+ "Heap block lo/hi size mismatch: lo =3D %llu, hi =3D %llu.\n"
+ "Probably caused by overrunning/underrunning a heap block's bounds=
\n");
+ return bszB_lo;
}
=20
-// Does this block have the in-use attribute?
+// Get a block's plain size, ie. remove the in-use/free attribute.
static __inline__
-Bool is_inuse_block ( Block* b )
+SizeT get_bszB ( Block* b )
{
- SizeT bszB =3D get_bszB_lo(b);
- vg_assert(bszB !=3D 0);
- return (0 !=3D (bszB & SIZE_T_0x1)) ? False : True;
+ return mk_plain_bszB(get_bszB_as_is(b));
}
=20
-// Get the address of the last byte in a block
+// Set the size fields of a block. bszB may have the in-use/free attrib=
ute.
static __inline__
-UByte* last_byte ( Block* b )
+void set_bszB ( Block* b, SizeT bszB )
{
UByte* b2 =3D (UByte*)b;
- return &b2[mk_plain_bszB(get_bszB_lo(b)) - 1];
+ *(SizeT*)&b2[0] =3D bszB;
+ *(SizeT*)&b2[mk_plain_bszB(bszB) - sizeof(SizeT)] =3D bszB;
}
=20
-// Get the upper size field of a block.
-static __inline__
-SizeT get_bszB_hi ( Block* b )
-{
- UByte* lb =3D last_byte(b);
- return *(SizeT*)&lb[-sizeof(SizeT) + 1];
-}
+//----------------------------------------------------------------------=
-----
=20
-// Set the size fields of a block.
+// Does this block have the in-use attribute?
static __inline__
-void set_bszB ( Block* b, SizeT bszB )
+Bool is_inuse_block ( Block* b )
{
- UByte* lb;
- *(SizeT*)&b[0] =3D bszB; // Set lo bszB; must precede last_byte(=
) call
- lb =3D last_byte(b);
- *(SizeT*)&lb[-sizeof(SizeT) + 1] =3D bszB; // Set hi bszB
+ SizeT bszB =3D get_bszB_as_is(b);
+ vg_assert(bszB !=3D 0);
+ return (0 !=3D (bszB & SIZE_T_0x1)) ? False : True;
}
=20
+//----------------------------------------------------------------------=
-----
+
// Return the lower, upper and total overhead in bytes for a block.
// These are determined purely by which arena the block lives in.
static __inline__
@@ -231,6 +233,8 @@
return overhead_szB_lo(a) + overhead_szB_hi(a);
}
=20
+//----------------------------------------------------------------------=
-----
+
// Return the minimum bszB for a block in this arena. Can have zero-len=
gth
// payloads, so it's the size of the admin bytes.
static __inline__
@@ -239,6 +243,8 @@
return overhead_szB(a);
}
=20
+//----------------------------------------------------------------------=
-----
+
// Convert payload size <--> block size (both in bytes).
static __inline__
SizeT pszB_to_bszB ( Arena* a, SizeT pszB )
@@ -252,23 +258,8 @@
return bszB - overhead_szB(a);
}
=20
-// Get a block's size as stored, ie with the in-use/free attribute.
-static __inline__
-SizeT get_bszB_as_is ( Block* b )
-{
- SizeT bszB_lo =3D get_bszB_lo(b);
- SizeT bszB_hi =3D get_bszB_hi(b);
- vg_assert(bszB_lo =3D=3D bszB_hi);
- return bszB_lo;
-}
+//----------------------------------------------------------------------=
-----
=20
-// Get a block's plain size, ie. remove the in-use/free attribute.
-static __inline__
-SizeT get_bszB ( Block* b )
-{
- return mk_plain_bszB(get_bszB_as_is(b));
-}
-
// Get a block's payload size.
static __inline__
SizeT get_pszB ( Arena* a, Block* b )
@@ -276,7 +267,9 @@
return bszB_to_pszB(a, get_bszB(b));
}
=20
-// Given the addr of a block, return the addr of its payload.
+//----------------------------------------------------------------------=
-----
+
+// Given the addr of a block, return the addr of its payload, and vice v=
ersa.
static __inline__
UByte* get_block_payload ( Arena* a, Block* b )
{
@@ -290,6 +283,7 @@
return (Block*)&payload[ -overhead_szB_lo(a) ];
}
=20
+//----------------------------------------------------------------------=
-----
=20
// Set and get the next and previous link fields of a block.
static __inline__
@@ -301,8 +295,8 @@
static __inline__
void set_next_b ( Block* b, Block* next_p )
{
- UByte* lb =3D last_byte(b);
- *(Block**)&lb[-sizeof(SizeT) - sizeof(void*) + 1] =3D next_p;
+ UByte* b2 =3D (UByte*)b;
+ *(Block**)&b2[get_bszB(b) - sizeof(SizeT) - sizeof(void*)] =3D next_p=
;
}
static __inline__
Block* get_prev_b ( Block* b )
@@ -313,10 +307,11 @@
static __inline__
Block* get_next_b ( Block* b )
{=20
- UByte* lb =3D last_byte(b);
- return *(Block**)&lb[-sizeof(SizeT) - sizeof(void*) + 1];
+ UByte* b2 =3D (UByte*)b;
+ return *(Block**)&b2[get_bszB(b) - sizeof(SizeT) - sizeof(void*)];
}
=20
+//----------------------------------------------------------------------=
-----
=20
// Get the block immediately preceding this one in the Superblock.
static __inline__
@@ -327,6 +322,8 @@
return (Block*)&b2[-bszB];
}
=20
+//----------------------------------------------------------------------=
-----
+
// Read and write the lower and upper red-zone bytes of a block.
static __inline__
void set_rz_lo_byte ( Arena* a, Block* b, UInt rz_byteno, UByte v )
@@ -337,8 +334,8 @@
static __inline__
void set_rz_hi_byte ( Arena* a, Block* b, UInt rz_byteno, UByte v )
{
- UByte* lb =3D last_byte(b);
- lb[-sizeof(SizeT) - rz_byteno] =3D v;
+ UByte* b2 =3D (UByte*)b;
+ b2[get_bszB(b) - sizeof(SizeT) - rz_byteno - 1] =3D v;
}
static __inline__
UByte get_rz_lo_byte ( Arena* a, Block* b, UInt rz_byteno )
@@ -349,8 +346,8 @@
static __inline__
UByte get_rz_hi_byte ( Arena* a, Block* b, UInt rz_byteno )
{
- UByte* lb =3D last_byte(b);
- return lb[-sizeof(SizeT) - rz_byteno];
+ UByte* b2 =3D (UByte*)b;
+ return b2[get_bszB(b) - sizeof(SizeT) - rz_byteno - 1];
}
=20
=20
@@ -379,7 +376,12 @@
SizeT i;
Arena* a =3D arenaId_to_ArenaP(aid);
=20
- vg_assert(rz_szB < 128); // ensure reasonable size
+ // Ensure redzones are a reasonable size. They must always be at lea=
st
+ // the size of a pointer, for holding the prev/next pointer (see the =
layout
+ // details at the top of this file).
+ vg_assert(rz_szB < 128);
+ if (rz_szB < sizeof(void*)) rz_szB =3D sizeof(void*);
+ =20
vg_assert((min_sblock_szB % VKI_PAGE_SIZE) =3D=3D 0);
a->name =3D name;
a->clientmem =3D ( VG_AR_CLIENT =3D=3D aid ? True : False );
@@ -550,7 +552,7 @@
return 0;
sb =3D (Superblock*)sres.val;
} else {
- // non-client allocation -- aborts if it fails
+ // non-client allocation -- abort if it fails
sres =3D VG_(am_mmap_anon_float_valgrind)( cszB );
if (sres.isError) {
VG_(out_of_memory_NORETURN)("newSuperblock", cszB);
@@ -678,8 +680,8 @@
{
# define BLEAT(str) VG_(printf)("blockSane: fail -- %s\n",str)
UInt i;
- if (get_bszB_lo(b) !=3D get_bszB_hi(b))
- {BLEAT("sizes");return False;}
+ // The lo and hi size fields will be checked (indirectly) by the call
+ // to get_rz_hi_byte().
if (!a->clientmem && is_inuse_block(b)) {
for (i =3D 0; i < a->rz_szB; i++) {
if (get_rz_lo_byte(a, b, i) !=3D=20
@@ -1242,14 +1244,13 @@
}
=20
=20
-SizeT VG_(arena_payload_szB) ( ArenaId aid, void* ptr )
+SizeT VG_(arena_payload_szB) ( ThreadId tid, ArenaId aid, void* ptr )
{
Arena* a =3D arenaId_to_ArenaP(aid);
Block* b =3D get_payload_block(a, ptr);
return get_pszB(a, b);
}
=20
-
/*------------------------------------------------------------*/
/*--- Services layered on top of malloc/free. ---*/
/*------------------------------------------------------------*/
Modified: branches/ASPACEM/coregrind/pub_core_mallocfree.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_mallocfree.h 2005-09-26 00:00:29 =
UTC (rev 4775)
+++ branches/ASPACEM/coregrind/pub_core_mallocfree.h 2005-09-26 00:38:36 =
UTC (rev 4776)
@@ -77,7 +77,7 @@
SizeT req_pszB );
extern Char* VG_(arena_strdup) ( ArenaId aid, const Char* s);
=20
-extern SizeT VG_(arena_payload_szB) ( ArenaId aid, void* payload );
+extern SizeT VG_(arena_payload_szB) ( ThreadId tid, ArenaId aid, void* p=
ayload );
=20
extern void VG_(sanity_check_malloc_all) ( void );
=20
|
|
From: <sv...@va...> - 2005-09-26 00:00:33
|
Author: sewardj
Date: 2005-09-26 01:00:29 +0100 (Mon, 26 Sep 2005)
New Revision: 4775
Log:
Drop the amount of work in this by a factor of 20 so it runs in
reasonable time.
Modified:
branches/ASPACEM/none/tests/map_unmap.c
Modified: branches/ASPACEM/none/tests/map_unmap.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/none/tests/map_unmap.c 2005-09-25 21:40:22 UTC (rev =
4774)
+++ branches/ASPACEM/none/tests/map_unmap.c 2005-09-26 00:00:29 UTC (rev =
4775)
@@ -56,7 +56,7 @@
munmap(expect1, LEN);
munmap(expect2, LEN);
=20
- for(i =3D 0; i < 100; i++) {
+ for(i =3D 0; i < 5; i++) {
void *m1, *m2;
=20
m1 =3D domap();
|