|
From: <sv...@va...> - 2006-09-21 15:59:36
|
Author: njn
Date: 2006-09-21 16:59:30 +0100 (Thu, 21 Sep 2006)
New Revision: 6083
Log:
Add a comment about marking static memory as defined.
Modified:
trunk/memcheck/mc_main.c
Modified: trunk/memcheck/mc_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
--- trunk/memcheck/mc_main.c 2006-09-20 21:29:39 UTC (rev 6082)
+++ trunk/memcheck/mc_main.c 2006-09-21 15:59:30 UTC (rev 6083)
@@ -2161,6 +2161,16 @@
void mc_new_mem_startup( Addr a, SizeT len, Bool rr, Bool ww, Bool xx )
{
/* Ignore the permissions, just make it defined. Seems to work... */
+ // Because code is defined, initialised variables get put in the data
+ // segment and are defined, and uninitialised variables get put in th=
e
+ // bss segment and are auto-zeroed (and so defined). =20
+ //
+ // It's possible that there will be padding between global variables.
+ // This will also be auto-zeroed, and marked as defined by Memcheck. =
If
+ // a program uses it, Memcheck will not complain. This is arguably a
+ // false negative, but it's a grey area -- the behaviour is defined (=
the
+ // padding is zeroed) but it's probably not what the user intended. =
And
+ // we can't avoid it.
DEBUG("mc_new_mem_startup(%p, %llu, rr=3D%u, ww=3D%u, xx=3D%u)\n",
a, (ULong)len, rr, ww, xx);
MC_(make_mem_defined)(a, len);
|