|
From: <sv...@va...> - 2005-06-30 02:35:24
|
Author: njn
Date: 2005-06-30 03:34:32 +0100 (Thu, 30 Jun 2005)
New Revision: 4061
Log:
Try to make toobig-allocs work on 64-bit platforms.
Removed:
trunk/memcheck/tests/toobig-allocs.stderr.exp2
Modified:
trunk/memcheck/mac_malloc_wrappers.c
trunk/memcheck/tests/toobig-allocs.stderr.exp
trunk/memcheck/tests/toobig-allocs.vgtest
trunk/tests/toobig-allocs.c
Modified: trunk/memcheck/mac_malloc_wrappers.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/mac_malloc_wrappers.c 2005-06-30 02:15:59 UTC (rev 406=
0)
+++ trunk/memcheck/mac_malloc_wrappers.c 2005-06-30 02:34:32 UTC (rev 406=
1)
@@ -198,7 +198,6 @@
{
VGP_PUSHCC(VgpCliMalloc);
cmalloc_n_mallocs ++;
- cmalloc_bs_mallocd +=3D size;
=20
// Allocate and zero if necessary
if (p) {
@@ -213,6 +212,9 @@
if (is_zeroed) VG_(memset)((void*)p, 0, size);
}
=20
+ // Only update this stat if allocation succeeded.
+ cmalloc_bs_mallocd +=3D size;
+
add_MAC_Chunk( tid, p, size, kind, table );
=20
MAC_(ban_mem_heap)( p-rzB, rzB );
Modified: trunk/memcheck/tests/toobig-allocs.stderr.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/toobig-allocs.stderr.exp 2005-06-30 02:15:59 UTC=
(rev 4060)
+++ trunk/memcheck/tests/toobig-allocs.stderr.exp 2005-06-30 02:34:32 UTC=
(rev 4061)
@@ -1,9 +1,2 @@
-
Attempting too-big malloc()...
Attempting too-big mmap()...
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 0 bytes in 0 blocks.
-malloc/free: 1 allocs, 0 frees, 2145386496 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=3Dyes
-For counts of detected errors, rerun with: -v
Deleted: trunk/memcheck/tests/toobig-allocs.stderr.exp2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/toobig-allocs.stderr.exp2 2005-06-30 02:15:59 UT=
C (rev 4060)
+++ trunk/memcheck/tests/toobig-allocs.stderr.exp2 2005-06-30 02:34:32 UT=
C (rev 4061)
@@ -1,9 +0,0 @@
-
-Attempting too-big malloc()...
-Attempting too-big mmap()...
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 0 bytes in 0 blocks.
-malloc/free: 2 allocs, 1 frees, 2145386520 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=3Dyes
-For counts of detected errors, rerun with: -v
Modified: trunk/memcheck/tests/toobig-allocs.vgtest
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/toobig-allocs.vgtest 2005-06-30 02:15:59 UTC (re=
v 4060)
+++ trunk/memcheck/tests/toobig-allocs.vgtest 2005-06-30 02:34:32 UTC (re=
v 4061)
@@ -1 +1,2 @@
prog: ../../tests/toobig-allocs
+vgopts: -q
Modified: trunk/tests/toobig-allocs.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/tests/toobig-allocs.c 2005-06-30 02:15:59 UTC (rev 4060)
+++ trunk/tests/toobig-allocs.c 2005-06-30 02:34:32 UTC (rev 4061)
@@ -6,7 +6,11 @@
{
void *p;
=20
- unsigned long size =3D 2ul * 1023ul * 1024ul * 1024ul; // just un=
der 2^31 (4GB)
+ // This is the biggest word-sized signed number. We use a signed num=
ber,
+ // even though malloc takes an unsigned SizeT, because the "silly mal=
loc
+ // arg" checking done by memcheck treats the arg like a signed int in
+ // order to detect the passing of a silly size arg like -1.
+ unsigned long size =3D (~(0UL)) >> 1;
=20
fprintf(stderr, "Attempting too-big malloc()...\n");
p =3D malloc(size); // way too big!
|