You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
(4) |
2
(17) |
3
(9) |
4
(14) |
5
(10) |
6
(11) |
7
(8) |
|
8
(9) |
9
(11) |
10
(29) |
11
(27) |
12
(29) |
13
(36) |
14
(8) |
|
15
(18) |
16
(30) |
17
(25) |
18
(6) |
19
(16) |
20
(13) |
21
(10) |
|
22
(16) |
23
(7) |
24
(8) |
25
(13) |
26
(14) |
27
(14) |
28
(5) |
|
29
(6) |
30
(21) |
31
(14) |
|
|
|
|
|
From: <sv...@va...> - 2009-03-02 17:25:40
|
Author: sewardj
Date: 2009-03-02 17:25:35 +0000 (Mon, 02 Mar 2009)
New Revision: 9308
Log:
Get rid of VG_HAVE_MACH and use the standard platform-based
conditionalisation mechanism instead.
Modified:
branches/DARWIN/coregrind/m_main.c
branches/DARWIN/coregrind/m_scheduler/scheduler.c
branches/DARWIN/coregrind/pub_core_mach.h
Modified: branches/DARWIN/coregrind/m_main.c
===================================================================
--- branches/DARWIN/coregrind/m_main.c 2009-03-02 10:03:04 UTC (rev 9307)
+++ branches/DARWIN/coregrind/m_main.c 2009-03-02 17:25:35 UTC (rev 9308)
@@ -1203,9 +1203,9 @@
// Start up Mach kernel interface, if any
// p: none
//--------------------------------------------------------------
-#if defined(VG_HAVE_MACH)
+# if defined(VGO_darwin)
VG_(mach_init)();
-#endif
+# endif
//--------------------------------------------------------------
// Start up the logging mechanism
Modified: branches/DARWIN/coregrind/m_scheduler/scheduler.c
===================================================================
--- branches/DARWIN/coregrind/m_scheduler/scheduler.c 2009-03-02 10:03:04 UTC (rev 9307)
+++ branches/DARWIN/coregrind/m_scheduler/scheduler.c 2009-03-02 17:25:35 UTC (rev 9308)
@@ -463,10 +463,10 @@
ThreadId tid;
vg_assert(VG_(running_tid) == me);
-#if defined(VG_HAVE_MACH)
+# if defined(VGO_darwin)
// GrP fixme hack reset Mach ports
VG_(mach_init)();
-#endif
+# endif
VG_(threads)[me].os_state.lwpid = VG_(gettid)();
VG_(threads)[me].os_state.threadgroup = VG_(getpid)();
Modified: branches/DARWIN/coregrind/pub_core_mach.h
===================================================================
--- branches/DARWIN/coregrind/pub_core_mach.h 2009-03-02 10:03:04 UTC (rev 9307)
+++ branches/DARWIN/coregrind/pub_core_mach.h 2009-03-02 17:25:35 UTC (rev 9308)
@@ -36,14 +36,7 @@
// for operating systems like Darwin / Mac OS X that use it.
//--------------------------------------------------------------------
-// Set which platforms have Mach kernel interfaces.
#if defined(VGO_darwin)
-# define VG_HAVE_MACH 1
-#else
-# undef VG_HAVE_MACH
-#endif
-
-#if defined(VG_HAVE_MACH)
// Call this early in Valgrind's main(). It depends on nothing.
extern void VG_(mach_init)(void);
#endif
|
|
From: <sv...@va...> - 2009-03-02 10:03:09
|
Author: sewardj Date: 2009-03-02 10:03:04 +0000 (Mon, 02 Mar 2009) New Revision: 9307 Log: Swizzle external. Modified: tags/VALGRIND_3_4_1/ Property changes on: tags/VALGRIND_3_4_1 ___________________________________________________________________ Name: svn:externals - VEX svn://svn.valgrind.org/vex/branches/VEX_3_4_BRANCH + VEX svn://svn.valgrind.org/vex/tags/VEX_3_4_1 |
|
From: <sv...@va...> - 2009-03-02 10:00:32
|
Author: sewardj Date: 2009-03-02 10:00:27 +0000 (Mon, 02 Mar 2009) New Revision: 9306 Log: Create a copy of branches/VALGRIND_3_4_BRANCH in tags/VALGRIND_3_4_1 for the 3.4.1 release. Notionally this is a copy of the 3.4 branch rev 9293; probably svn thinks it is r9305, because a bunch of later changes happened on the trunk and the darwin branch before this copy was made (this is harmless). Added: tags/VALGRIND_3_4_1/ Copied: tags/VALGRIND_3_4_1 (from rev 9305, branches/VALGRIND_3_4_BRANCH) |
|
From: <sv...@va...> - 2009-03-02 09:57:19
|
Author: sewardj Date: 2009-03-02 09:57:11 +0000 (Mon, 02 Mar 2009) New Revision: 1885 Log: Create a 3.4.1 tag from branches/VEX_3_4_1 r1884. Added: tags/VEX_3_4_1/ Copied: tags/VEX_3_4_1 (from rev 1884, branches/VEX_3_4_BRANCH) |
|
From: <sv...@va...> - 2009-03-02 05:12:32
|
Author: njn
Date: 2009-03-02 05:12:27 +0000 (Mon, 02 Mar 2009)
New Revision: 9305
Log:
Accept wait4_nocancel(); it uses the wait4() wrapper.
Modified:
branches/DARWIN/coregrind/m_syswrap/syswrap-darwin.c
Modified: branches/DARWIN/coregrind/m_syswrap/syswrap-darwin.c
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syswrap-darwin.c 2009-03-02 05:11:06 UTC (rev 9304)
+++ branches/DARWIN/coregrind/m_syswrap/syswrap-darwin.c 2009-03-02 05:12:27 UTC (rev 9305)
@@ -6741,7 +6741,7 @@
GENX_(__NR_write_nocancel, sys_write),
GENXY(__NR_open_nocancel, sys_open),
GENXY(__NR_close_nocancel, sys_close),
-// _____(__NR_wait4_nocancel), // 400
+ GENXY(__NR_wait4_nocancel, sys_wait4), // 400
MACXY(__NR_recvmsg_nocancel, sys_recvmsg),
MACX_(__NR_sendmsg_nocancel, sys_sendmsg),
MACXY(__NR_recvfrom_nocancel, sys_recvfrom),
|
|
From: <sv...@va...> - 2009-03-02 05:11:12
|
Author: njn
Date: 2009-03-02 05:11:06 +0000 (Mon, 02 Mar 2009)
New Revision: 9304
Log:
Merge r9299..r9303 (various leak-check test fixes) from the DARWIN branch.
Added:
trunk/memcheck/tests/leak.h
Removed:
trunk/memcheck/tests/filter_leak_check_size
trunk/memcheck/tests/leak-0.stderr.exp2
trunk/memcheck/tests/leak-cycle.stderr.exp2
trunk/memcheck/tests/leak-cycle.stderr.exp64
trunk/memcheck/tests/leak-regroot.c
trunk/memcheck/tests/leak-regroot.stderr.exp
trunk/memcheck/tests/leak-regroot.stderr.exp2
trunk/memcheck/tests/leak-regroot.vgtest
trunk/memcheck/tests/pointer-trace.stderr.exp2
trunk/memcheck/tests/pointer-trace.stderr.exp3
trunk/memcheck/tests/pointer-trace.stderr.exp64
Modified:
trunk/NEWS
trunk/memcheck/docs/mc-manual.xml
trunk/memcheck/mc_include.h
trunk/memcheck/mc_leakcheck.c
trunk/memcheck/mc_main.c
trunk/memcheck/memcheck.h
trunk/memcheck/tests/Makefile.am
trunk/memcheck/tests/error_counts.c
trunk/memcheck/tests/error_counts.stdout.exp
trunk/memcheck/tests/filter_stderr
trunk/memcheck/tests/leak-0.c
trunk/memcheck/tests/leak-0.stderr.exp
trunk/memcheck/tests/leak-0.vgtest
trunk/memcheck/tests/leak-cycle.c
trunk/memcheck/tests/leak-cycle.stderr.exp
trunk/memcheck/tests/leak-cycle.vgtest
trunk/memcheck/tests/leak-tree.stderr.exp
trunk/memcheck/tests/leak-tree.stderr.exp2
trunk/memcheck/tests/leak-tree.stderr.exp64
trunk/memcheck/tests/leak-tree.vgtest
trunk/memcheck/tests/leakotron.c
trunk/memcheck/tests/mempool.stderr.exp
trunk/memcheck/tests/mempool.stderr.exp64
trunk/memcheck/tests/nanoleak.stderr.exp
trunk/memcheck/tests/nanoleak.vgtest
trunk/memcheck/tests/nanoleak_supp.vgtest
trunk/memcheck/tests/pointer-trace.c
trunk/memcheck/tests/pointer-trace.stderr.exp
trunk/memcheck/tests/pointer-trace.vgtest
trunk/memcheck/tests/trivialleak.stderr.exp
trunk/memcheck/tests/trivialleak.stderr.exp2
trunk/memcheck/tests/trivialleak.vgtest
trunk/memcheck/tests/xml1.stderr.exp
trunk/memcheck/tests/xml1.stderr.exp2
trunk/memcheck/tests/xml1.stderr.exp64
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/NEWS 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,6 +1,11 @@
Release 3.5.0 (???)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* A new Memcheck client request VALGRIND_COUNT_LEAK_BLOCKS has been added.
+ It is similar to VALGRIND_COUNT_LEAKS but counts blocks instead of bytes.
+ [XXX: consider adding VALGRIND_COUNT_LEAK_BYTES as a synonym and
+ deprecating VALGRIND_COUNT_LEAKS, which wasn't a good name to begin with]
+
* The location of some install files has changed. This should not affect
most users. Those who might be affected:
Modified: trunk/memcheck/docs/mc-manual.xml
===================================================================
--- trunk/memcheck/docs/mc-manual.xml 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/docs/mc-manual.xml 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1178,6 +1178,13 @@
</listitem>
<listitem>
+ <para><varname>VALGRIND_COUNT_LEAK_BLOCKS</varname>: identical to
+ <varname>VALGRIND_COUNT_LEAKS</varname> except that it returns the
+ number of blocks rather than the number of bytes in each
+ category.</para>
+ </listitem>
+
+ <listitem>
<para><varname>VALGRIND_GET_VBITS</varname> and
<varname>VALGRIND_SET_VBITS</varname>: allow you to get and set the
V (validity) bits for an address range. You should probably only
Modified: trunk/memcheck/mc_include.h
===================================================================
--- trunk/memcheck/mc_include.h 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/mc_include.h 2009-03-02 05:11:06 UTC (rev 9304)
@@ -249,6 +249,13 @@
extern SizeT MC_(bytes_reachable);
extern SizeT MC_(bytes_suppressed);
+/* For VALGRIND_COUNT_LEAK_BLOCKS client request */
+extern SizeT MC_(blocks_leaked);
+extern SizeT MC_(blocks_indirect);
+extern SizeT MC_(blocks_dubious);
+extern SizeT MC_(blocks_reachable);
+extern SizeT MC_(blocks_suppressed);
+
typedef
enum {
LC_Off,
Modified: trunk/memcheck/mc_leakcheck.c
===================================================================
--- trunk/memcheck/mc_leakcheck.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/mc_leakcheck.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -211,6 +211,12 @@
SizeT MC_(bytes_reachable) = 0;
SizeT MC_(bytes_suppressed) = 0;
+SizeT MC_(blocks_leaked) = 0;
+SizeT MC_(blocks_indirect) = 0;
+SizeT MC_(blocks_dubious) = 0;
+SizeT MC_(blocks_reachable) = 0;
+SizeT MC_(blocks_suppressed) = 0;
+
static Int lc_compar(void* n1, void* n2)
{
MC_Chunk* mc1 = *(MC_Chunk**)n1;
@@ -399,12 +405,6 @@
}
}
-static SizeT blocks_leaked;
-static SizeT blocks_indirect;
-static SizeT blocks_dubious;
-static SizeT blocks_reachable;
-static SizeT blocks_suppressed;
-
static void full_report(ThreadId tid)
{
Int i;
@@ -515,24 +515,24 @@
print_record );
if (is_suppressed) {
- blocks_suppressed += p_min->num_blocks;
- MC_(bytes_suppressed) += p_min->total_bytes;
+ MC_(blocks_suppressed) += p_min->num_blocks;
+ MC_(bytes_suppressed) += p_min->total_bytes;
} else if (Unreached == p_min->loss_mode) {
- blocks_leaked += p_min->num_blocks;
- MC_(bytes_leaked) += p_min->total_bytes;
+ MC_(blocks_leaked) += p_min->num_blocks;
+ MC_(bytes_leaked) += p_min->total_bytes;
} else if (IndirectLeak == p_min->loss_mode) {
- blocks_indirect += p_min->num_blocks;
- MC_(bytes_indirect) += p_min->total_bytes;
+ MC_(blocks_indirect) += p_min->num_blocks;
+ MC_(bytes_indirect) += p_min->total_bytes;
- } else if (Interior == p_min->loss_mode) {
- blocks_dubious += p_min->num_blocks;
- MC_(bytes_dubious) += p_min->total_bytes;
+ } else if (Interior == p_min->loss_mode) {
+ MC_(blocks_dubious) += p_min->num_blocks;
+ MC_(bytes_dubious) += p_min->total_bytes;
- } else if (Proper == p_min->loss_mode) {
- blocks_reachable += p_min->num_blocks;
- MC_(bytes_reachable) += p_min->total_bytes;
+ } else if (Proper == p_min->loss_mode) {
+ MC_(blocks_reachable) += p_min->num_blocks;
+ MC_(bytes_reachable) += p_min->total_bytes;
} else {
VG_(tool_panic)("generic_detect_memory_leaks: unknown loss mode");
@@ -551,22 +551,22 @@
switch(lc_markstack[i].state) {
case Unreached:
- blocks_leaked++;
+ MC_(blocks_leaked)++;
MC_(bytes_leaked) += size;
break;
case Proper:
- blocks_reachable++;
+ MC_(blocks_reachable)++;
MC_(bytes_reachable) += size;
break;
case Interior:
- blocks_dubious++;
+ MC_(blocks_dubious)++;
MC_(bytes_dubious) += size;
break;
case IndirectLeak: /* shouldn't happen */
- blocks_indirect++;
+ MC_(blocks_indirect)++;
MC_(bytes_indirect) += size;
break;
}
@@ -812,11 +812,11 @@
if (VG_(clo_verbosity) > 0 && !VG_(clo_xml))
VG_(message)(Vg_UserMsg, "checked %'lu bytes.", lc_scanned);
- blocks_leaked = MC_(bytes_leaked) = 0;
- blocks_indirect = MC_(bytes_indirect) = 0;
- blocks_dubious = MC_(bytes_dubious) = 0;
- blocks_reachable = MC_(bytes_reachable) = 0;
- blocks_suppressed = MC_(bytes_suppressed) = 0;
+ MC_(blocks_leaked) = MC_(bytes_leaked) = 0;
+ MC_(blocks_indirect) = MC_(bytes_indirect) = 0;
+ MC_(blocks_dubious) = MC_(bytes_dubious) = 0;
+ MC_(blocks_reachable) = MC_(bytes_reachable) = 0;
+ MC_(blocks_suppressed) = MC_(bytes_suppressed) = 0;
if (mode == LC_Full)
full_report(tid);
@@ -827,23 +827,23 @@
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "LEAK SUMMARY:");
VG_(message)(Vg_UserMsg, " definitely lost: %'lu bytes in %'lu blocks.",
- MC_(bytes_leaked), blocks_leaked );
- if (blocks_indirect > 0)
+ MC_(bytes_leaked), MC_(blocks_leaked) );
+ if (MC_(blocks_indirect) > 0)
VG_(message)(Vg_UserMsg, " indirectly lost: %'lu bytes in %'lu blocks.",
- MC_(bytes_indirect), blocks_indirect );
+ MC_(bytes_indirect), MC_(blocks_indirect) );
VG_(message)(Vg_UserMsg, " possibly lost: %'lu bytes in %'lu blocks.",
- MC_(bytes_dubious), blocks_dubious );
+ MC_(bytes_dubious), MC_(blocks_dubious) );
VG_(message)(Vg_UserMsg, " still reachable: %'lu bytes in %'lu blocks.",
- MC_(bytes_reachable), blocks_reachable );
+ MC_(bytes_reachable), MC_(blocks_reachable) );
VG_(message)(Vg_UserMsg, " suppressed: %'lu bytes in %'lu blocks.",
- MC_(bytes_suppressed), blocks_suppressed );
+ MC_(bytes_suppressed), MC_(blocks_suppressed) );
if (mode == LC_Summary
- && (blocks_leaked + blocks_indirect
- + blocks_dubious + blocks_reachable) > 0) {
+ && (MC_(blocks_leaked) + MC_(blocks_indirect)
+ + MC_(blocks_dubious) + MC_(blocks_reachable)) > 0) {
VG_(message)(Vg_UserMsg,
"Rerun with --leak-check=full to see details of leaked memory.");
}
- if (blocks_reachable > 0 && !MC_(clo_show_reachable) && mode == LC_Full) {
+ if (MC_(blocks_reachable) > 0 && !MC_(clo_show_reachable) && mode == LC_Full) {
VG_(message)(Vg_UserMsg,
"Reachable blocks (those to which a pointer was found) are not shown.");
VG_(message)(Vg_UserMsg,
Modified: trunk/memcheck/mc_main.c
===================================================================
--- trunk/memcheck/mc_main.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/mc_main.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1056,9 +1056,9 @@
static Bool isHex ( UChar c )
{
- return ((c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'f')
- || (c >= 'A' && c <= 'F'));
+ return ((c >= '0' && c <= '9') ||
+ (c >= 'a' && c <= 'f') ||
+ (c >= 'A' && c <= 'F'));
}
static UInt fromHex ( UChar c )
@@ -5005,10 +5005,26 @@
*argp[4] = MC_(bytes_suppressed);
// there is no argp[5]
//*argp[5] = MC_(bytes_indirect);
- // XXX need to make *argp[1-4] defined
+ // XXX need to make *argp[1-4] defined; currently done in the
+ // VALGRIND_COUNT_LEAKS_MACRO by initialising them to zero.
*ret = 0;
return True;
}
+ case VG_USERREQ__COUNT_LEAK_BLOCKS: { /* count leaked blocks */
+ UWord** argp = (UWord**)arg;
+ // MC_(blocks_leaked) et al were set by the last leak check (or zero
+ // if no prior leak checks performed).
+ *argp[1] = MC_(blocks_leaked) + MC_(blocks_indirect);
+ *argp[2] = MC_(blocks_dubious);
+ *argp[3] = MC_(blocks_reachable);
+ *argp[4] = MC_(blocks_suppressed);
+ // there is no argp[5]
+ //*argp[5] = MC_(blocks_indirect);
+ // XXX need to make *argp[1-4] defined; currently done in the
+ // VALGRIND_COUNT_LEAK_BLOCKS_MACRO by initialising them to zero.
+ *ret = 0;
+ return True;
+ }
case VG_USERREQ__MALLOCLIKE_BLOCK: {
Addr p = (Addr)arg[1];
SizeT sizeB = arg[2];
Modified: trunk/memcheck/memcheck.h
===================================================================
--- trunk/memcheck/memcheck.h 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/memcheck.h 2009-03-02 05:11:06 UTC (rev 9304)
@@ -93,6 +93,9 @@
VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE,
+ /* Not next to VG_USERREQ__COUNT_LEAKS because it was added later. */
+ VG_USERREQ__COUNT_LEAK_BLOCKS,
+
/* This is just for memcheck's internal use - don't use it */
_VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR
= VG_USERREQ_TOOL_BASE('M','C') + 256
@@ -228,7 +231,7 @@
specified, which works no matter what type 'leaked', 'dubious', etc
are. We also initialise '_qzz_leaked', etc because
VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
- initialised. */ \
+ defined. */ \
{unsigned long _qzz_res; \
unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
@@ -242,7 +245,29 @@
suppressed = _qzz_suppressed; \
}
+/* Return number of leaked, dubious, reachable and suppressed bytes found by
+ all previous leak checks. They must be lvalues. */
+#define VALGRIND_COUNT_LEAK_BLOCKS(leaked, dubious, reachable, suppressed) \
+ /* For safety on 64-bit platforms we assign the results to private
+ unsigned long variables, then assign these to the lvalues the user
+ specified, which works no matter what type 'leaked', 'dubious', etc
+ are. We also initialise '_qzz_leaked', etc because
+ VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
+ defined. */ \
+ {unsigned long _qzz_res; \
+ unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
+ unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__COUNT_LEAK_BLOCKS, \
+ &_qzz_leaked, &_qzz_dubious, \
+ &_qzz_reachable, &_qzz_suppressed, 0); \
+ leaked = _qzz_leaked; \
+ dubious = _qzz_dubious; \
+ reachable = _qzz_reachable; \
+ suppressed = _qzz_suppressed; \
+ }
+
/* Get the validity data for addresses [zza..zza+zznbytes-1] and copy it
into the provided zzvbits array. Return values:
0 if not running on valgrind
Modified: trunk/memcheck/tests/Makefile.am
===================================================================
--- trunk/memcheck/tests/Makefile.am 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/Makefile.am 2009-03-02 05:11:06 UTC (rev 9304)
@@ -23,7 +23,7 @@
DIST_SUBDIRS = x86 amd64 linux x86-linux .
-noinst_SCRIPTS = filter_allocs filter_leak_check_size \
+noinst_SCRIPTS = filter_allocs \
filter_stderr filter_xml \
filter_varinfo3
@@ -59,7 +59,7 @@
inits.stderr.exp inits.vgtest \
inline.stderr.exp inline.stdout.exp inline.vgtest \
leak-0.vgtest leak-0.stderr.exp \
- leak-cycle.vgtest leak-cycle.stderr.exp leak-cycle.stderr.exp64 \
+ leak-cycle.vgtest leak-cycle.stderr.exp \
leak-pool-0.vgtest leak-pool-0.stderr.exp leak-pool-0.stderr.exp64 \
leak-pool-1.vgtest leak-pool-1.stderr.exp leak-pool-1.stderr.exp64 \
leak-pool-2.vgtest leak-pool-2.stderr.exp leak-pool-2.stderr.exp64 \
@@ -68,7 +68,6 @@
leak-pool-5.vgtest leak-pool-5.stderr.exp leak-pool-5.stderr.exp64 \
leak-tree.vgtest leak-tree.stderr.exp \
leak-tree.stderr.exp2 leak-tree.stderr.exp64 \
- leak-regroot.vgtest leak-regroot.stderr.exp \
leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
linux-syslog-syscall linux-syslog-syscall.stderr.exp \
linux-syscalls-2007 linux-syscalls-2007.stderr.exp \
@@ -188,7 +187,7 @@
doublefree error_counts errs1 exitprog execve execve2 erringfds \
file_locking \
fprw fwrite inits inline \
- leak-0 leak-cycle leak-pool leak-tree leak-regroot leakotron \
+ leak-0 leak-cycle leak-pool leak-tree leakotron \
linux-syslog-syscall \
linux-syscalls-2007 \
long_namespace_xml \
Modified: trunk/memcheck/tests/error_counts.c
===================================================================
--- trunk/memcheck/tests/error_counts.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/error_counts.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <assert.h>
#include "../memcheck.h"
+#include "leak.h"
int main(void)
{
@@ -10,16 +11,13 @@
int* reachable;
int* dubious;
int* leaked;
- long n_reachable = 0;
- long n_dubious = 0;
- long n_leaked = 0;
- long n_suppressed = 0;
+ DECLARE_LEAK_COUNTERS;
/* we require these longs to have same size as a machine word */
assert(sizeof(long) == sizeof(void*));
/* Error counting */
- printf("errors: %d\n", VALGRIND_COUNT_ERRORS);
+ printf("errors: %d\n\n", VALGRIND_COUNT_ERRORS);
if (x == 0) {
y++;
@@ -27,14 +25,16 @@
y--;
}
- printf("errors: %d\n", VALGRIND_COUNT_ERRORS);
+ printf("errors: %d\n\n", VALGRIND_COUNT_ERRORS);
+ // Get a baseline, after start-up and also after printf (because Darwin
+ // printf allocates memory the first time it's called!)
+ GET_INITIAL_LEAK_COUNTS;
+
/* Leak checking */
- VALGRIND_DO_LEAK_CHECK;
- VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed);
- if (n_reachable == 24) n_reachable = 0; /* handle glibc differences */
- printf("leaks: %ldB, %ldB, %ldB, %ldB\n",
- n_leaked, n_dubious, n_reachable, n_suppressed);
+ GET_FINAL_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stdout);
+ printf("\n");
leaked = malloc(77);
leaked = 0;
@@ -44,12 +44,9 @@
reachable = malloc(99);
- VALGRIND_DO_LEAK_CHECK;
- VALGRIND_DO_LEAK_CHECK;
- VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed);
- if (n_reachable == 123) n_reachable = 99; /* handle glibc differences */
- printf("leaks: %ldB, %ldB, %ldB, %ldB\n",
- n_leaked, n_dubious, n_reachable, n_suppressed);
+ GET_FINAL_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stdout);
+ printf("\n");
printf("errors: %d\n", VALGRIND_COUNT_ERRORS);
Modified: trunk/memcheck/tests/error_counts.stdout.exp
===================================================================
--- trunk/memcheck/tests/error_counts.stdout.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/error_counts.stdout.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,5 +1,15 @@
errors: 0
+
errors: 1
-leaks: 0B, 0B, 0B, 0B
-leaks: 77B, 88B, 99B, 0B
+
+leaked: 0 bytes in 0 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 0 bytes in 0 blocks
+suppressed: 0 bytes in 0 blocks
+
+leaked: 77 bytes in 1 blocks
+dubious: 88 bytes in 1 blocks
+reachable: 99 bytes in 1 blocks
+suppressed: 0 bytes in 0 blocks
+
errors: 1
Deleted: trunk/memcheck/tests/filter_leak_check_size
===================================================================
--- trunk/memcheck/tests/filter_leak_check_size 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/filter_leak_check_size 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,4 +0,0 @@
-#! /bin/sh
-
-./filter_stderr |
-sed "s/checked [0-9,]* bytes./checked ... bytes./"
Modified: trunk/memcheck/tests/filter_stderr
===================================================================
--- trunk/memcheck/tests/filter_stderr 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/filter_stderr 2009-03-02 05:11:06 UTC (rev 9304)
@@ -31,5 +31,13 @@
# Something similar for XML output. Chops everything within
# <stack>...</stack>.
-perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn)[^\n]*\n)*/$1\n/gs'
+perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn)[^\n]*\n)*/$1\n/gs' |
+# Leak check filtering.
+sed "s/checked [0-9,]* bytes./checked ... bytes./" |
+
+# More leak check filtering. For systems that do extra libc allocations
+# (eg. Darwin) there may be extra (reachable, and thus not shown) loss
+# records. So we filter out the loss record numbers.
+perl -p -e "s/lost in loss record \d+ of \d+/lost in loss record ... of .../"
+
Modified: trunk/memcheck/tests/leak-0.c
===================================================================
--- trunk/memcheck/tests/leak-0.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-0.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,16 +1,24 @@
+#include <stdio.h>
#include <stdlib.h>
+#include "leak.h"
#include "../memcheck.h"
-/*
- Live 0-sized blocks were being reported as leaked.
- */
+// Live 0-sized blocks were being reported as leaked.
+// Also, test that a pointer in a register is handled correctly.
int main()
{
- void *volatile foo = malloc(0);
+ DECLARE_LEAK_COUNTERS;
- //printf("&foo=%p foo=%p\n", &foo, foo);
- VALGRIND_DO_LEAK_CHECK;
+ register char *foo;
+ GET_INITIAL_LEAK_COUNTS;
+
+ foo = malloc(0);
+
+ GET_FINAL_LEAK_COUNTS;
+
+ PRINT_LEAK_COUNTS(stderr);
+
free(foo);
return 0;
}
Modified: trunk/memcheck/tests/leak-0.stderr.exp
===================================================================
--- trunk/memcheck/tests/leak-0.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-0.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,17 +1,4 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 1 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
-
-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, 1 frees, 0 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
+leaked: 0 bytes in 0 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 0 bytes in 1 blocks
+suppressed: 0 bytes in 0 blocks
Deleted: trunk/memcheck/tests/leak-0.stderr.exp2
===================================================================
--- trunk/memcheck/tests/leak-0.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-0.stderr.exp2 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,18 +0,0 @@
-
-searching for pointers to 2 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 24 bytes in 2 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
-
-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, 2 frees, 24 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Modified: trunk/memcheck/tests/leak-0.vgtest
===================================================================
--- trunk/memcheck/tests/leak-0.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-0.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,2 +1,2 @@
prog: leak-0
-stderr_filter: filter_leak_check_size
+vgopts: -q
Modified: trunk/memcheck/tests/leak-cycle.c
===================================================================
--- trunk/memcheck/tests/leak-cycle.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-cycle.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,14 +1,18 @@
+#include <stdio.h>
#include <stdlib.h>
+#include "leak.h"
#include "../memcheck.h"
struct n {
struct n *l;
struct n *r;
+ // This ensures it's the same size on 32-bit and 64-bit platforms.
+ char padding[ 2 * (8 - sizeof(struct n*)) ];
};
struct n *mk(struct n *l, struct n *r)
{
- struct n *n = malloc(sizeof(*n));
+ struct n *n = malloc(sizeof(struct n));
n->l = l;
n->r = r;
@@ -27,19 +31,21 @@
return a;
}
+
int main()
{
+ DECLARE_LEAK_COUNTERS;
struct n *volatile c1, *volatile c2;
+ GET_INITIAL_LEAK_COUNTS;
+
/* two simple cycles */
c1 = mkcycle();
c2 = mkcycle();
c1 = c2 = 0;
- //VALGRIND_DO_LEAK_CHECK;
-
/* one cycle linked to another */
c1 = mkcycle();
c2 = mkcycle();
@@ -53,8 +59,6 @@
c1 = c2 = 0;
- //VALGRIND_DO_LEAK_CHECK;
-
/* two linked cycles */
c1 = mkcycle();
c2 = mkcycle();
@@ -64,7 +68,9 @@
c1 = c2 = 0;
- VALGRIND_DO_LEAK_CHECK;
+ GET_FINAL_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stderr);
+
return 0;
}
Modified: trunk/memcheck/tests/leak-cycle.stderr.exp
===================================================================
--- trunk/memcheck/tests/leak-cycle.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-cycle.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,43 +1,31 @@
+leaked: 288 bytes in 18 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 0 bytes in 0 blocks
+suppressed: 0 bytes in 0 blocks
-searching for pointers to 18 not-freed blocks.
-checked ... bytes.
-
-24 (8 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 18
+48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:36)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
+ by 0x........: main (leak-cycle.c:44)
-24 (8 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 18
+48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:37)
-
-
-48 (8 direct, 40 indirect) bytes in 1 blocks are definitely lost in loss record 17 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
by 0x........: main (leak-cycle.c:45)
-48 (8 direct, 40 indirect) bytes in 1 blocks are definitely lost in loss record 18 of 18
+96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:59)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
+ by 0x........: main (leak-cycle.c:51)
-LEAK SUMMARY:
- definitely lost: 32 bytes in 4 blocks.
- indirectly lost: 112 bytes in 14 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 0 blocks.
- suppressed: 0 bytes in 0 blocks.
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 144 bytes in 18 blocks.
-malloc/free: 18 allocs, 0 frees, 144 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
+96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
+ by 0x........: main (leak-cycle.c:63)
Deleted: trunk/memcheck/tests/leak-cycle.stderr.exp2
===================================================================
--- trunk/memcheck/tests/leak-cycle.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-cycle.stderr.exp2 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,45 +0,0 @@
-
-searching for pointers to 19 not-freed blocks.
-checked ... bytes.
-
-24 (8+16) bytes in 1 blocks are definitely lost in loss record 15 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:36)
-
-
-24 (8+16) bytes in 1 blocks are definitely lost in loss record 16 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:37)
-
-
-48 (8+40) bytes in 1 blocks are definitely lost in loss record 18 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:45)
-
-
-48 (8+40) bytes in 1 blocks are definitely lost in loss record 19 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:59)
-
-LEAK SUMMARY:
- definitely lost: 32 bytes in 4 blocks.
- indirectly lost: 112 bytes in 14 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 24 bytes in 1 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 144 bytes in 18 blocks.
-malloc/free: 19 allocs, 1 frees, 168 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: trunk/memcheck/tests/leak-cycle.stderr.exp64
===================================================================
--- trunk/memcheck/tests/leak-cycle.stderr.exp64 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-cycle.stderr.exp64 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,43 +0,0 @@
-
-searching for pointers to 18 not-freed blocks.
-checked ... bytes.
-
-48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:36)
-
-
-48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:37)
-
-
-96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 17 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:45)
-
-
-96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 18 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:59)
-
-LEAK SUMMARY:
- definitely lost: 64 bytes in 4 blocks.
- indirectly lost: 224 bytes in 14 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 0 blocks.
- suppressed: 0 bytes in 0 blocks.
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 288 bytes in 18 blocks.
-malloc/free: 18 allocs, 0 frees, 288 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Modified: trunk/memcheck/tests/leak-cycle.vgtest
===================================================================
--- trunk/memcheck/tests/leak-cycle.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-cycle.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,3 +1,2 @@
prog: leak-cycle
-vgopts: --leak-resolution=high
-stderr_filter: filter_leak_check_size
+vgopts: -q --leak-check=yes --leak-resolution=high
Deleted: trunk/memcheck/tests/leak-regroot.c
===================================================================
--- trunk/memcheck/tests/leak-regroot.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-regroot.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,15 +0,0 @@
-#include "../memcheck.h"
-#include <stdlib.h>
-
-int main()
-{
- register char *foo /* asm("esi") */;
-
- foo = malloc(10); /* not leaked */
-
- VALGRIND_DO_LEAK_CHECK;
-
- free(foo);
-
- return 0;
-}
Deleted: trunk/memcheck/tests/leak-regroot.stderr.exp
===================================================================
--- trunk/memcheck/tests/leak-regroot.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-regroot.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,17 +0,0 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 10 bytes in 1 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
-
-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, 1 frees, 10 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: trunk/memcheck/tests/leak-regroot.stderr.exp2
===================================================================
--- trunk/memcheck/tests/leak-regroot.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-regroot.stderr.exp2 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,18 +0,0 @@
-
-searching for pointers to 2 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 34 bytes in 2 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
-
-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, 2 frees, 34 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: trunk/memcheck/tests/leak-regroot.vgtest
===================================================================
--- trunk/memcheck/tests/leak-regroot.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-regroot.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,2 +0,0 @@
-prog: leak-regroot
-stderr_filter: filter_leak_check_size
Modified: trunk/memcheck/tests/leak-tree.stderr.exp
===================================================================
--- trunk/memcheck/tests/leak-tree.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-tree.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -2,7 +2,7 @@
searching for pointers to 11 not-freed blocks.
checked ... bytes.
-72 (8 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 11
+72 (8 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
@@ -19,19 +19,19 @@
checked ... bytes.
-8 bytes in 1 blocks are definitely lost in loss record 1 of 14
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:39)
-88 (8 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 13 of 14
+88 (8 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
-16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 14
+16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:38)
Modified: trunk/memcheck/tests/leak-tree.stderr.exp2
===================================================================
--- trunk/memcheck/tests/leak-tree.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-tree.stderr.exp2 2009-03-02 05:11:06 UTC (rev 9304)
@@ -2,7 +2,7 @@
searching for pointers to 11 not-freed blocks.
checked ... bytes.
-8 bytes in 1 blocks are definitely lost in loss record 1 of 11
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
@@ -18,19 +18,19 @@
checked ... bytes.
-8 bytes in 1 blocks are definitely lost in loss record 1 of 14
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:39)
-8 bytes in 1 blocks are definitely lost in loss record 2 of 14
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:38)
-40 (8 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 14
+40 (8 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
Modified: trunk/memcheck/tests/leak-tree.stderr.exp64
===================================================================
--- trunk/memcheck/tests/leak-tree.stderr.exp64 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-tree.stderr.exp64 2009-03-02 05:11:06 UTC (rev 9304)
@@ -2,7 +2,7 @@
searching for pointers to 11 not-freed blocks.
checked ... bytes.
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 11
+80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
@@ -19,19 +19,19 @@
checked ... bytes.
-16 bytes in 1 blocks are definitely lost in loss record 1 of 14
+16 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:39)
-16 bytes in 1 blocks are definitely lost in loss record 2 of 14
+16 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:38)
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 14
+80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
Modified: trunk/memcheck/tests/leak-tree.vgtest
===================================================================
--- trunk/memcheck/tests/leak-tree.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leak-tree.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,3 +1,2 @@
prog: leak-tree
vgopts: --leak-resolution=high
-stderr_filter: filter_leak_check_size
Copied: trunk/memcheck/tests/leak.h (from rev 9303, branches/DARWIN/memcheck/tests/leak.h)
===================================================================
--- trunk/memcheck/tests/leak.h (rev 0)
+++ trunk/memcheck/tests/leak.h 2009-03-02 05:11:06 UTC (rev 9304)
@@ -0,0 +1,43 @@
+// These counters are used to get a delta between leak counts at startup
+// (eg. due to libc) and later on. Necessary to get reliable leak tests
+// across different platforms.
+#define DECLARE_LEAK_COUNTERS \
+ long L0_bytes = 0, L_bytes = 0, L0_blocks = 0, L_blocks = 0; \
+ long D0_bytes = 0, D_bytes = 0, D0_blocks = 0, D_blocks = 0; \
+ long R0_bytes = 0, R_bytes = 0, R0_blocks = 0, R_blocks = 0; \
+ long S0_bytes = 0, S_bytes = 0, S0_blocks = 0, S_blocks = 0
+
+// Set a baseline, in case allocations have already happened.
+#define GET_INITIAL_LEAK_COUNTS \
+ do { \
+ VALGRIND_DO_QUICK_LEAK_CHECK; \
+ VALGRIND_COUNT_LEAKS( L0_bytes, D0_bytes, R0_bytes, S0_bytes );\
+ VALGRIND_COUNT_LEAK_BLOCKS(L0_blocks, D0_blocks, R0_blocks, S0_blocks); \
+ } while (0)
+
+// Set a baseline, in case allocations have already happened.
+#define GET_FINAL_LEAK_COUNTS \
+ do { \
+ VALGRIND_DO_QUICK_LEAK_CHECK; \
+ VALGRIND_COUNT_LEAKS( L_bytes, D_bytes, R_bytes, S_bytes ); \
+ VALGRIND_COUNT_LEAK_BLOCKS(L_blocks, D_blocks, R_blocks, S_blocks); \
+ L_bytes -= L0_bytes; L_blocks -= L0_blocks; \
+ D_bytes -= D0_bytes; D_blocks -= D0_blocks; \
+ R_bytes -= R0_bytes; R_blocks -= R0_blocks; \
+ S_bytes -= S0_bytes; S_blocks -= S0_blocks; \
+ } while (0)
+
+// Print leak counts. When used in conjunction with -q the normal counts
+// aren't shown, which is what we want.
+#define PRINT_LEAK_COUNTS(where) \
+ do { \
+ fprintf(where,"leaked: %3ld bytes in %2ld blocks\n", \
+ L_bytes,L_blocks); \
+ fprintf(where,"dubious: %3ld bytes in %2ld blocks\n", \
+ D_bytes,D_blocks); \
+ fprintf(where,"reachable: %3ld bytes in %2ld blocks\n", \
+ R_bytes,R_blocks); \
+ fprintf(where,"suppressed: %3ld bytes in %2ld blocks\n", \
+ S_bytes,S_blocks); \
+ } while (0)
+
Modified: trunk/memcheck/tests/leakotron.c
===================================================================
--- trunk/memcheck/tests/leakotron.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/leakotron.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <assert.h>
#include "../memcheck.h"
+#include "leak.h"
/*
Incompetent memory management
@@ -10,7 +11,7 @@
structure with refcounting.
*/
-static int bytes, blocks;
+static long bytes, blocks;
struct node {
struct node *l, *r;
@@ -95,63 +96,49 @@
int main()
{
int i;
- long base_definite, base_dubious, base_reachable, base_suppressed;
- long definite, dubious, reachable, suppressed;
- int total;
+ long total;
+ DECLARE_LEAK_COUNTERS;
/* we require these longs to have same size as a machine word */
assert(sizeof(long) == sizeof(void*));
/* get a baseline in case the runtime allocated some memory */
- VALGRIND_DO_LEAK_CHECK;
- base_definite = base_dubious = base_reachable = base_suppressed = 0;
- VALGRIND_COUNT_LEAKS(base_definite, base_dubious,
- base_reachable, base_suppressed);
+ GET_INITIAL_LEAK_COUNTS;
- for(i = 0; i < ITER; i++) {
+ for (i = 0; i < ITER; i++) {
mk();
if ((i % (ITER/10)) == 0) {
if (0)
- printf("%d living blocks, %d bytes\n",
+ printf("%ld living blocks, %ld bytes\n",
blocks, bytes);
- VALGRIND_DO_LEAK_CHECK;
+ //VALGRIND_DO_LEAK_CHECK;
}
}
/* "free all memory" */
- for(i = 0; i < N; i++)
+ for (i = 0; i < N; i++)
assign(&nodes[i], NULL);
if (0)
- printf("FINISHED: %d living blocks, %d bytes\n",
+ printf("FINISHED: %ld living blocks, %ld bytes\n",
blocks, bytes);
- VALGRIND_DO_LEAK_CHECK;
+ GET_FINAL_LEAK_COUNTS;
- /* Shouldn't be necessary, but COUNT_LEAKS doesn't define its
- result values */
- definite = dubious = reachable = suppressed = 0;
- VALGRIND_COUNT_LEAKS(definite, dubious, reachable, suppressed);
+ total = L_bytes + D_bytes + R_bytes + S_bytes;
- definite -= base_definite;
- dubious -= base_dubious;
- reachable -= base_reachable;
- suppressed -= base_suppressed;
+ if (0) {
+ PRINT_LEAK_COUNTS(stderr);
+ }
- total = definite+dubious+reachable+suppressed;
-
- if (0)
- printf("leaks: definite %d, dubious %d, reachable %d, suppressed %d = %d\n",
- (int)definite, (int)dubious, (int)reachable, (int)suppressed, total);
-
- if (reachable != 0)
+ if (R_bytes != 0)
printf("FAILED: I freed everything, "
- "but there's still %d bytes reachable\n",
- (int)reachable);
+ "but there's still %ld bytes (in %ld blocks) reachable\n",
+ R_bytes, R_blocks);
else if (total != bytes)
- printf("FAILED: I count %d bytes, leakcheck says %d\n",
+ printf("FAILED: I count %ld bytes, leakcheck says %ld\n",
bytes, total);
else
printf("PASS\n");
Modified: trunk/memcheck/tests/mempool.stderr.exp
===================================================================
--- trunk/memcheck/tests/mempool.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/mempool.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -35,25 +35,25 @@
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 2 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:135)
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 3 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:115)
by 0x........: main (mempool.c:148)
-20 bytes in 1 blocks are definitely lost in loss record 4 of 5
+20 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:116)
by 0x........: main (mempool.c:148)
-28 (20 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
+28 (20 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: make_pool (mempool.c:37)
by 0x........: test (mempool.c:111)
Modified: trunk/memcheck/tests/mempool.stderr.exp64
===================================================================
--- trunk/memcheck/tests/mempool.stderr.exp64 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/mempool.stderr.exp64 2009-03-02 05:11:06 UTC (rev 9304)
@@ -35,25 +35,25 @@
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 1 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:135)
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 2 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:115)
by 0x........: main (mempool.c:148)
-20 bytes in 1 blocks are definitely lost in loss record 4 of 5
+20 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:116)
by 0x........: main (mempool.c:148)
-48 (32 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
+48 (32 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: make_pool (mempool.c:37)
by 0x........: test (mempool.c:111)
Modified: trunk/memcheck/tests/nanoleak.stderr.exp
===================================================================
--- trunk/memcheck/tests/nanoleak.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/nanoleak.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,4 +1,4 @@
-1,000 bytes in 1 blocks are definitely lost in loss record 1 of 1
+1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (nanoleak.c:6)
Modified: trunk/memcheck/tests/nanoleak.vgtest
===================================================================
--- trunk/memcheck/tests/nanoleak.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/nanoleak.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,3 +1,2 @@
vgopts: --leak-check=yes -q
prog: nanoleak
-stderr_filter: filter_leak_check_size
Modified: trunk/memcheck/tests/nanoleak_supp.vgtest
===================================================================
--- trunk/memcheck/tests/nanoleak_supp.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/nanoleak_supp.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,3 +1,2 @@
vgopts: --leak-check=yes --suppressions=nanoleak.supp -q
prog: nanoleak
-stderr_filter: filter_leak_check_size
Modified: trunk/memcheck/tests/pointer-trace.c
===================================================================
--- trunk/memcheck/tests/pointer-trace.c 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/pointer-trace.c 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,5 +1,6 @@
/*
- Make sure that leak-check's pointer tracing avoids traps
+ Make sure that leak-check's pointer tracing avoids traps, i.e. tricky
+ memory areas where it could crash if not careful.
*/
#include <stdio.h>
@@ -45,14 +46,16 @@
}
ptrs = malloc(nptrs * sizeof(char *));
- for(i = 0; i < nptrs; i++)
+ for (i = 0; i < nptrs; i++)
ptrs[i] = (char *)((long)i << stepbits);
/* lay some traps */
+ /* non-RWX memory, and MAP_NORESERVE if present */
map = mmap(0, stepsize * 2, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
if (map == (char *)-1)
perror("trap 1 failed");
+ /* write-only memory, and MAP_NORESERVE if supported */
map = mmap(0, stepsize * 2, PROT_WRITE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
if (map == (char *)-1)
perror("trap 2 failed");
@@ -60,12 +63,12 @@
/* non-zero mmap of a zero-length file -> SIGBUS */
fd = open("./pointer-trace-test-file", O_RDWR | O_CREAT | O_EXCL, 0600);
unlink("./pointer-trace-test-file");
-
map = mmap(0, stepsize * 2, PROT_WRITE|PROT_READ, MAP_PRIVATE, fd, 0);
if (map == (char *)-1)
perror("trap 3 failed");
//printf("trap 3 = %p-%p\n", map, map+stepsize*2);
+ /* unmapped memory that's marked as defined */
map = mmap(0, 256*1024, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
if (map == (char *)-1)
perror("trap 4 failed");
@@ -76,7 +79,11 @@
VALGRIND_DO_LEAK_CHECK;
- ptrs = 0;
+ free(ptrs);
+ // We deliberately make a leak, it'll be obvious if something went
+ // wrong because the message won't be printed.
+ ptrs = malloc(1000);
+
return 0;
}
Modified: trunk/memcheck/tests/pointer-trace.stderr.exp
===================================================================
--- trunk/memcheck/tests/pointer-trace.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/pointer-trace.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,28 +1,4 @@
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 1,048,576 bytes in 1 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 1,048,576 bytes in 1 blocks.
-malloc/free: 1 allocs, 0 frees, 1,048,576 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-1,048,576 bytes in 1 blocks are definitely lost in loss record 1 of 1
+1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- 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.
+ by 0x........: main (pointer-trace.c:86)
Deleted: trunk/memcheck/tests/pointer-trace.stderr.exp2
===================================================================
--- trunk/memcheck/tests/pointer-trace.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/pointer-trace.stderr.exp2 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,32 +0,0 @@
-
-searching for pointers to 2 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 1,048,600 bytes in 2 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 1,048,576 bytes in 1 blocks.
-malloc/free: 2 allocs, 1 frees, 1,048,600 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-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:24)
-
-LEAK SUMMARY:
- definitely lost: 1,048,576 bytes in 1 blocks.
- indirectly lost: 0 bytes in 0 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
Deleted: trunk/memcheck/tests/pointer-trace.stderr.exp3
===================================================================
--- trunk/memcheck/tests/pointer-trace.stderr.exp3 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/pointer-trace.stderr.exp3 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,30 +0,0 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 1,048,576 bytes in 1 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 1,048,576 bytes in 1 blocks.
-malloc/free: 1 allocs, 0 frees, 1,048,576 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-1,048,576 bytes in 1 blocks are possibly lost in loss record 1 of 1
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (pointer-trace.c:24)
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 1,048,576 bytes in 1 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
Deleted: trunk/memcheck/tests/pointer-trace.stderr.exp64
===================================================================
--- trunk/memcheck/tests/pointer-trace.stderr.exp64 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/pointer-trace.stderr.exp64 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,30 +0,0 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 2,097,152 bytes in 1 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 2,097,152 bytes in 1 blocks.
-malloc/free: 1 allocs, 0 frees, 2,097,152 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-2,097,152 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:24)
-
-LEAK SUMMARY:
- definitely lost: 2,097,152 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
Modified: trunk/memcheck/tests/pointer-trace.vgtest
===================================================================
--- trunk/memcheck/tests/pointer-trace.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/pointer-trace.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,3 +1,2 @@
prog: pointer-trace
-vgopts: --leak-check=yes
-stderr_filter: filter_leak_check_size
+vgopts: -q --leak-check=yes
Modified: trunk/memcheck/tests/trivialleak.stderr.exp
===================================================================
--- trunk/memcheck/tests/trivialleak.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/trivialleak.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,5 +1,5 @@
-1,000 bytes in 1,000 blocks are definitely lost in loss record 1 of 1
+1,000 bytes in 1,000 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: test (trivialleak.c:8)
by 0x........: main (trivialleak.c:12)
Modified: trunk/memcheck/tests/trivialleak.stderr.exp2
===================================================================
--- trunk/memcheck/tests/trivialleak.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/trivialleak.stderr.exp2 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,5 +1,5 @@
-999 bytes in 999 blocks are definitely lost in loss record 2 of 2
+999 bytes in 999 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: test (trivialleak.c:8)
by 0x........: main (trivialleak.c:12)
Modified: trunk/memcheck/tests/trivialleak.vgtest
===================================================================
--- trunk/memcheck/tests/trivialleak.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/trivialleak.vgtest 2009-03-02 05:11:06 UTC (rev 9304)
@@ -1,3 +1,2 @@
vgopts: --leak-check=yes -q
prog: trivialleak
-stderr_filter: filter_leak_check_size
Modified: trunk/memcheck/tests/xml1.stderr.exp
===================================================================
--- trunk/memcheck/tests/xml1.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/xml1.stderr.exp 2009-03-02 05:11:06 UTC (rev 9304)
@@ -382,7 +382,7 @@
<unique>0x........</unique>
<tid>...</tid>
<kind>Leak_DefinitelyLost</kind>
- <what>396 bytes in 1 blocks are definitely lost in loss record 1 of 1</what>
+ <what>396 bytes in 1 blocks are definitely lost in loss record ... of ...</what>
<leakedbytes>396</leakedbytes>
<leakedblocks>1</leakedblocks>
<stack>
Modified: trunk/memcheck/tests/xml1.stderr.exp2
===================================================================
--- trunk/memcheck/tests/xml1.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
+++ trunk/memcheck/tests/xml1.stderr.exp2 2009-03-02 05:11:06 UTC (rev 9304)
@@ -382,7 +382,7 @@
<unique>0x........</unique>
<tid>...</t...
[truncated message content] |
|
From: <sv...@va...> - 2009-03-02 04:34:14
|
Author: njn
Date: 2009-03-02 04:34:08 +0000 (Mon, 02 Mar 2009)
New Revision: 9303
Log:
Make pointer-trace more portable, and add some comments explaining what it
does. Also change it so the output is more consistent, avoiding the need
for multiple .exp files. It doesn't yet pass on Darwin, because it requires
signal handling.
Removed:
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64
Modified:
branches/DARWIN/memcheck/tests/pointer-trace.c
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp
branches/DARWIN/memcheck/tests/pointer-trace.vgtest
Modified: branches/DARWIN/memcheck/tests/pointer-trace.c
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.c 2009-03-02 04:07:35 UTC (rev 9302)
+++ branches/DARWIN/memcheck/tests/pointer-trace.c 2009-03-02 04:34:08 UTC (rev 9303)
@@ -1,5 +1,6 @@
/*
- Make sure that leak-check's pointer tracing avoids traps
+ Make sure that leak-check's pointer tracing avoids traps, i.e. tricky
+ memory areas where it could crash if not careful.
*/
#include <stdio.h>
#include "memcheck/memcheck.h"
@@ -7,8 +8,8 @@
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
-#if !defined(MAP_ANONYMOUS)
-# define MAP_ANONYMOUS 0
+#if defined(__APPLE__)
+# define MAP_ANONYMOUS MAP_ANON
#endif
#if !defined(MAP_NORESERVE)
# define MAP_NORESERVE 0
@@ -45,14 +46,16 @@
}
ptrs = malloc(nptrs * sizeof(char *));
- for(i = 0; i < nptrs; i++)
+ for (i = 0; i < nptrs; i++)
ptrs[i] = (char *)((long)i << stepbits);
/* lay some traps */
+ /* non-RWX memory, and MAP_NORESERVE if present */
map = mmap(0, stepsize * 2, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
if (map == (char *)-1)
perror("trap 1 failed");
+ /* write-only memory, and MAP_NORESERVE if supported */
map = mmap(0, stepsize * 2, PROT_WRITE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
if (map == (char *)-1)
perror("trap 2 failed");
@@ -60,12 +63,12 @@
/* non-zero mmap of a zero-length file -> SIGBUS */
fd = open("./pointer-trace-test-file", O_RDWR | O_CREAT | O_EXCL, 0600);
unlink("./pointer-trace-test-file");
-
map = mmap(0, stepsize * 2, PROT_WRITE|PROT_READ, MAP_PRIVATE, fd, 0);
if (map == (char *)-1)
perror("trap 3 failed");
//printf("trap 3 = %p-%p\n", map, map+stepsize*2);
+ /* unmapped memory that's marked as defined */
map = mmap(0, 256*1024, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
if (map == (char *)-1)
perror("trap 4 failed");
@@ -76,7 +79,11 @@
VALGRIND_DO_LEAK_CHECK;
- ptrs = 0;
+ free(ptrs);
+ // We deliberately make a leak, it'll be obvious if something went
+ // wrong because the message won't be printed.
+ ptrs = malloc(1000);
+
return 0;
}
Modified: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp 2009-03-02 04:07:35 UTC (rev 9302)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp 2009-03-02 04:34:08 UTC (rev 9303)
@@ -1,28 +1,4 @@
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 1,048,576 bytes in 1 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 1,048,576 bytes in 1 blocks.
-malloc/free: 1 allocs, 0 frees, 1,048,576 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-1,048,576 bytes in 1 blocks are definitely lost in loss record ... of ...
+1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- 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.
+ by 0x........: main (pointer-trace.c:86)
Deleted: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2 2009-03-02 04:07:35 UTC (rev 9302)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2 2009-03-02 04:34:08 UTC (rev 9303)
@@ -1,32 +0,0 @@
-
-searching for pointers to 2 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 1,048,600 bytes in 2 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 1,048,576 bytes in 1 blocks.
-malloc/free: 2 allocs, 1 frees, 1,048,600 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-1,048,576 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (pointer-trace.c:24)
-
-LEAK SUMMARY:
- definitely lost: 1,048,576 bytes in 1 blocks.
- indirectly lost: 0 bytes in 0 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
Deleted: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3 2009-03-02 04:07:35 UTC (rev 9302)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3 2009-03-02 04:34:08 UTC (rev 9303)
@@ -1,30 +0,0 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 1,048,576 bytes in 1 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 1,048,576 bytes in 1 blocks.
-malloc/free: 1 allocs, 0 frees, 1,048,576 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-1,048,576 bytes in 1 blocks are possibly lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (pointer-trace.c:24)
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 1,048,576 bytes in 1 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
Deleted: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64 2009-03-02 04:07:35 UTC (rev 9302)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64 2009-03-02 04:34:08 UTC (rev 9303)
@@ -1,30 +0,0 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 2,097,152 bytes in 1 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
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 2,097,152 bytes in 1 blocks.
-malloc/free: 1 allocs, 0 frees, 2,097,152 bytes allocated.
-For counts of detected errors, rerun with: -v
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-2,097,152 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (pointer-trace.c:24)
-
-LEAK SUMMARY:
- definitely lost: 2,097,152 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
Modified: branches/DARWIN/memcheck/tests/pointer-trace.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.vgtest 2009-03-02 04:07:35 UTC (rev 9302)
+++ branches/DARWIN/memcheck/tests/pointer-trace.vgtest 2009-03-02 04:34:08 UTC (rev 9303)
@@ -1,2 +1,2 @@
prog: pointer-trace
-vgopts: --leak-check=yes
+vgopts: -q --leak-check=yes
|
|
From: <sv...@va...> - 2009-03-02 04:07:40
|
Author: njn
Date: 2009-03-02 04:07:35 +0000 (Mon, 02 Mar 2009)
New Revision: 9302
Log:
- Use delta-style leak-checking to make error_counts pass on Darwin.
- Parameterise PRINT_LEAK_COUNTS by the output fd.
Modified:
branches/DARWIN/memcheck/tests/error_counts.c
branches/DARWIN/memcheck/tests/error_counts.stdout.exp
branches/DARWIN/memcheck/tests/leak-0.c
branches/DARWIN/memcheck/tests/leak-cycle.c
branches/DARWIN/memcheck/tests/leak.h
branches/DARWIN/memcheck/tests/leakotron.c
Modified: branches/DARWIN/memcheck/tests/error_counts.c
===================================================================
--- branches/DARWIN/memcheck/tests/error_counts.c 2009-03-02 03:55:36 UTC (rev 9301)
+++ branches/DARWIN/memcheck/tests/error_counts.c 2009-03-02 04:07:35 UTC (rev 9302)
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <assert.h>
#include "../memcheck.h"
+#include "leak.h"
int main(void)
{
@@ -10,16 +11,13 @@
int* reachable;
int* dubious;
int* leaked;
- long n_reachable = 0;
- long n_dubious = 0;
- long n_leaked = 0;
- long n_suppressed = 0;
+ DECLARE_LEAK_COUNTERS;
/* we require these longs to have same size as a machine word */
assert(sizeof(long) == sizeof(void*));
/* Error counting */
- printf("errors: %d\n", VALGRIND_COUNT_ERRORS);
+ printf("errors: %d\n\n", VALGRIND_COUNT_ERRORS);
if (x == 0) {
y++;
@@ -27,14 +25,16 @@
y--;
}
- printf("errors: %d\n", VALGRIND_COUNT_ERRORS);
+ printf("errors: %d\n\n", VALGRIND_COUNT_ERRORS);
+ // Get a baseline, after start-up and also after printf (because Darwin
+ // printf allocates memory the first time it's called!)
+ GET_INITIAL_LEAK_COUNTS;
+
/* Leak checking */
- VALGRIND_DO_LEAK_CHECK;
- VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed);
- if (n_reachable == 24) n_reachable = 0; /* handle glibc differences */
- printf("leaks: %ldB, %ldB, %ldB, %ldB\n",
- n_leaked, n_dubious, n_reachable, n_suppressed);
+ GET_FINAL_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stdout);
+ printf("\n");
leaked = malloc(77);
leaked = 0;
@@ -44,12 +44,9 @@
reachable = malloc(99);
- VALGRIND_DO_LEAK_CHECK;
- VALGRIND_DO_LEAK_CHECK;
- VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed);
- if (n_reachable == 123) n_reachable = 99; /* handle glibc differences */
- printf("leaks: %ldB, %ldB, %ldB, %ldB\n",
- n_leaked, n_dubious, n_reachable, n_suppressed);
+ GET_FINAL_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stdout);
+ printf("\n");
printf("errors: %d\n", VALGRIND_COUNT_ERRORS);
Modified: branches/DARWIN/memcheck/tests/error_counts.stdout.exp
===================================================================
--- branches/DARWIN/memcheck/tests/error_counts.stdout.exp 2009-03-02 03:55:36 UTC (rev 9301)
+++ branches/DARWIN/memcheck/tests/error_counts.stdout.exp 2009-03-02 04:07:35 UTC (rev 9302)
@@ -1,5 +1,15 @@
errors: 0
+
errors: 1
-leaks: 0B, 0B, 0B, 0B
-leaks: 77B, 88B, 99B, 0B
+
+leaked: 0 bytes in 0 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 0 bytes in 0 blocks
+suppressed: 0 bytes in 0 blocks
+
+leaked: 77 bytes in 1 blocks
+dubious: 88 bytes in 1 blocks
+reachable: 99 bytes in 1 blocks
+suppressed: 0 bytes in 0 blocks
+
errors: 1
Modified: branches/DARWIN/memcheck/tests/leak-0.c
===================================================================
--- branches/DARWIN/memcheck/tests/leak-0.c 2009-03-02 03:55:36 UTC (rev 9301)
+++ branches/DARWIN/memcheck/tests/leak-0.c 2009-03-02 04:07:35 UTC (rev 9302)
@@ -17,7 +17,7 @@
GET_FINAL_LEAK_COUNTS;
- PRINT_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stderr);
free(foo);
return 0;
Modified: branches/DARWIN/memcheck/tests/leak-cycle.c
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.c 2009-03-02 03:55:36 UTC (rev 9301)
+++ branches/DARWIN/memcheck/tests/leak-cycle.c 2009-03-02 04:07:35 UTC (rev 9302)
@@ -70,7 +70,7 @@
GET_FINAL_LEAK_COUNTS;
- PRINT_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stderr);
return 0;
}
Modified: branches/DARWIN/memcheck/tests/leak.h
===================================================================
--- branches/DARWIN/memcheck/tests/leak.h 2009-03-02 03:55:36 UTC (rev 9301)
+++ branches/DARWIN/memcheck/tests/leak.h 2009-03-02 04:07:35 UTC (rev 9302)
@@ -29,15 +29,15 @@
// Print leak counts. When used in conjunction with -q the normal counts
// aren't shown, which is what we want.
-#define PRINT_LEAK_COUNTS \
+#define PRINT_LEAK_COUNTS(where) \
do { \
- fprintf(stderr,"leaked: %3ld bytes in %2ld blocks\n", \
+ fprintf(where,"leaked: %3ld bytes in %2ld blocks\n", \
L_bytes,L_blocks); \
- fprintf(stderr,"dubious: %3ld bytes in %2ld blocks\n", \
+ fprintf(where,"dubious: %3ld bytes in %2ld blocks\n", \
D_bytes,D_blocks); \
- fprintf(stderr,"reachable: %3ld bytes in %2ld blocks\n", \
+ fprintf(where,"reachable: %3ld bytes in %2ld blocks\n", \
R_bytes,R_blocks); \
- fprintf(stderr,"suppressed: %3ld bytes in %2ld blocks\n", \
+ fprintf(where,"suppressed: %3ld bytes in %2ld blocks\n", \
S_bytes,S_blocks); \
} while (0)
Modified: branches/DARWIN/memcheck/tests/leakotron.c
===================================================================
--- branches/DARWIN/memcheck/tests/leakotron.c 2009-03-02 03:55:36 UTC (rev 9301)
+++ branches/DARWIN/memcheck/tests/leakotron.c 2009-03-02 04:07:35 UTC (rev 9302)
@@ -130,7 +130,7 @@
total = L_bytes + D_bytes + R_bytes + S_bytes;
if (0) {
- PRINT_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS(stderr);
}
if (R_bytes != 0)
|
|
From: <sv...@va...> - 2009-03-02 03:55:42
|
Author: njn
Date: 2009-03-02 03:55:36 +0000 (Mon, 02 Mar 2009)
New Revision: 9301
Log:
This wasn't supposed to go in with the last commit.
Modified:
branches/DARWIN/memcheck/tests/leakotron.c
Modified: branches/DARWIN/memcheck/tests/leakotron.c
===================================================================
--- branches/DARWIN/memcheck/tests/leakotron.c 2009-03-02 03:53:21 UTC (rev 9300)
+++ branches/DARWIN/memcheck/tests/leakotron.c 2009-03-02 03:55:36 UTC (rev 9301)
@@ -142,7 +142,5 @@
bytes, total);
else
printf("PASS\n");
-
- printf("stack addr: %p\n", &i);
return 0;
}
|
|
From: <sv...@va...> - 2009-03-02 03:53:43
|
Author: njn
Date: 2009-03-02 03:53:21 +0000 (Mon, 02 Mar 2009)
New Revision: 9300
Log:
- Merged leak-regroot and leak-0, they were doing very similar things.
- Used leak.h to do delta-style checking for leak-0 so it works on Darwin.
- Likewise for leakotron, although it still doesn't work. This seems to be
because the stack segment being scanned is much larger than it should be.
- Some improvements to leak.h macros.
- In m_main.c, don't print the "Listening for debugger" message if -q is
given.
Removed:
branches/DARWIN/memcheck/tests/leak-0.stderr.exp2
branches/DARWIN/memcheck/tests/leak-regroot.c
branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp
branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp2
branches/DARWIN/memcheck/tests/leak-regroot.vgtest
Modified:
branches/DARWIN/coregrind/m_main.c
branches/DARWIN/memcheck/memcheck.h
branches/DARWIN/memcheck/tests/Makefile.am
branches/DARWIN/memcheck/tests/leak-0.c
branches/DARWIN/memcheck/tests/leak-0.stderr.exp
branches/DARWIN/memcheck/tests/leak-0.vgtest
branches/DARWIN/memcheck/tests/leak-cycle.c
branches/DARWIN/memcheck/tests/leak.h
branches/DARWIN/memcheck/tests/leakotron.c
Modified: branches/DARWIN/coregrind/m_main.c
===================================================================
--- branches/DARWIN/coregrind/m_main.c 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/coregrind/m_main.c 2009-03-02 03:53:21 UTC (rev 9300)
@@ -2035,7 +2035,7 @@
// p: scheduler, process_cmd_line_options()
//--------------------------------------------------------------
#if defined(VGO_darwin)
- if (VG_(clo_db_listen)) {
+ if (VG_(clo_db_listen) && VG_(clo_verbosity) > 0) {
VG_(debugLog)(1, "main", "Listening for debugger on port %d\n",
VG_(clo_db_listen_port));
VG_(debugstub_init)();
Modified: branches/DARWIN/memcheck/memcheck.h
===================================================================
--- branches/DARWIN/memcheck/memcheck.h 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/memcheck.h 2009-03-02 03:53:21 UTC (rev 9300)
@@ -231,7 +231,7 @@
specified, which works no matter what type 'leaked', 'dubious', etc
are. We also initialise '_qzz_leaked', etc because
VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
- initialised. */ \
+ defined. */ \
{unsigned long _qzz_res; \
unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
@@ -253,7 +253,7 @@
specified, which works no matter what type 'leaked', 'dubious', etc
are. We also initialise '_qzz_leaked', etc because
VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
- initialised. */ \
+ defined. */ \
{unsigned long _qzz_res; \
unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
Modified: branches/DARWIN/memcheck/tests/Makefile.am
===================================================================
--- branches/DARWIN/memcheck/tests/Makefile.am 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/Makefile.am 2009-03-02 03:53:21 UTC (rev 9300)
@@ -68,7 +68,6 @@
leak-pool-5.vgtest leak-pool-5.stderr.exp leak-pool-5.stderr.exp64 \
leak-tree.vgtest leak-tree.stderr.exp \
leak-tree.stderr.exp2 leak-tree.stderr.exp64 \
- leak-regroot.vgtest leak-regroot.stderr.exp \
leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
linux-syslog-syscall linux-syslog-syscall.stderr.exp \
linux-syscalls-2007 linux-syscalls-2007.stderr.exp \
@@ -188,7 +187,7 @@
doublefree error_counts errs1 exitprog execve execve2 erringfds \
file_locking \
fprw fwrite inits inline \
- leak-0 leak-cycle leak-pool leak-tree leak-regroot leakotron \
+ leak-0 leak-cycle leak-pool leak-tree leakotron \
linux-syslog-syscall \
linux-syscalls-2007 \
long_namespace_xml \
Modified: branches/DARWIN/memcheck/tests/leak-0.c
===================================================================
--- branches/DARWIN/memcheck/tests/leak-0.c 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-0.c 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1,16 +1,24 @@
+#include <stdio.h>
#include <stdlib.h>
+#include "leak.h"
#include "../memcheck.h"
-/*
- Live 0-sized blocks were being reported as leaked.
- */
+// Live 0-sized blocks were being reported as leaked.
+// Also, test that a pointer in a register is handled correctly.
int main()
{
- void *volatile foo = malloc(0);
+ DECLARE_LEAK_COUNTERS;
- //printf("&foo=%p foo=%p\n", &foo, foo);
- VALGRIND_DO_LEAK_CHECK;
+ register char *foo;
+ GET_INITIAL_LEAK_COUNTS;
+
+ foo = malloc(0);
+
+ GET_FINAL_LEAK_COUNTS;
+
+ PRINT_LEAK_COUNTS;
+
free(foo);
return 0;
}
Modified: branches/DARWIN/memcheck/tests/leak-0.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leak-0.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-0.stderr.exp 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1,17 +1,4 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 1 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
-
-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, 1 frees, 0 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
+leaked: 0 bytes in 0 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 0 bytes in 1 blocks
+suppressed: 0 bytes in 0 blocks
Deleted: branches/DARWIN/memcheck/tests/leak-0.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/leak-0.stderr.exp2 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-0.stderr.exp2 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1,18 +0,0 @@
-
-searching for pointers to 2 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 24 bytes in 2 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
-
-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, 2 frees, 24 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Modified: branches/DARWIN/memcheck/tests/leak-0.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leak-0.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-0.vgtest 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1 +1,2 @@
prog: leak-0
+vgopts: -q
Modified: branches/DARWIN/memcheck/tests/leak-cycle.c
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.c 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-cycle.c 2009-03-02 03:53:21 UTC (rev 9300)
@@ -38,7 +38,7 @@
struct n *volatile c1, *volatile c2;
- GET_INIITAL_LEAK_COUNTS;
+ GET_INITIAL_LEAK_COUNTS;
/* two simple cycles */
c1 = mkcycle();
Deleted: branches/DARWIN/memcheck/tests/leak-regroot.c
===================================================================
--- branches/DARWIN/memcheck/tests/leak-regroot.c 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-regroot.c 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1,15 +0,0 @@
-#include "../memcheck.h"
-#include <stdlib.h>
-
-int main()
-{
- register char *foo /* asm("esi") */;
-
- foo = malloc(10); /* not leaked */
-
- VALGRIND_DO_LEAK_CHECK;
-
- free(foo);
-
- return 0;
-}
Deleted: branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1,17 +0,0 @@
-
-searching for pointers to 1 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 10 bytes in 1 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
-
-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, 1 frees, 10 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp2 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-regroot.stderr.exp2 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1,18 +0,0 @@
-
-searching for pointers to 2 not-freed blocks.
-checked ... bytes.
-
-LEAK SUMMARY:
- definitely lost: 0 bytes in 0 blocks.
- indirectly lost: 0 bytes in 0 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 34 bytes in 2 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
-
-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, 2 frees, 34 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: branches/DARWIN/memcheck/tests/leak-regroot.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leak-regroot.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak-regroot.vgtest 2009-03-02 03:53:21 UTC (rev 9300)
@@ -1 +0,0 @@
-prog: leak-regroot
Modified: branches/DARWIN/memcheck/tests/leak.h
===================================================================
--- branches/DARWIN/memcheck/tests/leak.h 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leak.h 2009-03-02 03:53:21 UTC (rev 9300)
@@ -8,26 +8,36 @@
long S0_bytes = 0, S_bytes = 0, S0_blocks = 0, S_blocks = 0
// Set a baseline, in case allocations have already happened.
-#define GET_INIITAL_LEAK_COUNTS \
- VALGRIND_DO_QUICK_LEAK_CHECK; \
- VALGRIND_COUNT_LEAKS( L0_bytes, D0_bytes, R0_bytes, S0_bytes );\
- VALGRIND_COUNT_LEAK_BLOCKS(L0_blocks, D0_blocks, R0_blocks, S0_blocks)
+#define GET_INITIAL_LEAK_COUNTS \
+ do { \
+ VALGRIND_DO_QUICK_LEAK_CHECK; \
+ VALGRIND_COUNT_LEAKS( L0_bytes, D0_bytes, R0_bytes, S0_bytes );\
+ VALGRIND_COUNT_LEAK_BLOCKS(L0_blocks, D0_blocks, R0_blocks, S0_blocks); \
+ } while (0)
// Set a baseline, in case allocations have already happened.
#define GET_FINAL_LEAK_COUNTS \
- VALGRIND_DO_QUICK_LEAK_CHECK; \
- VALGRIND_COUNT_LEAKS( L_bytes, D_bytes, R_bytes, S_bytes ); \
- VALGRIND_COUNT_LEAK_BLOCKS(L_blocks, D_blocks, R_blocks, S_blocks); \
- L_bytes -= L0_bytes; L_blocks -= L0_blocks; \
- D_bytes -= D0_bytes; D_blocks -= D0_blocks; \
- R_bytes -= R0_bytes; R_blocks -= R0_blocks; \
- S_bytes -= S0_bytes; S_blocks -= S0_blocks
+ do { \
+ VALGRIND_DO_QUICK_LEAK_CHECK; \
+ VALGRIND_COUNT_LEAKS( L_bytes, D_bytes, R_bytes, S_bytes ); \
+ VALGRIND_COUNT_LEAK_BLOCKS(L_blocks, D_blocks, R_blocks, S_blocks); \
+ L_bytes -= L0_bytes; L_blocks -= L0_blocks; \
+ D_bytes -= D0_bytes; D_blocks -= D0_blocks; \
+ R_bytes -= R0_bytes; R_blocks -= R0_blocks; \
+ S_bytes -= S0_bytes; S_blocks -= S0_blocks; \
+ } while (0)
// Print leak counts. When used in conjunction with -q the normal counts
// aren't shown, which is what we want.
#define PRINT_LEAK_COUNTS \
- fprintf(stderr,"leaked: %3ld bytes in %2ld blocks\n", L_bytes,L_blocks);\
- fprintf(stderr,"dubious: %3ld bytes in %2ld blocks\n", D_bytes,D_blocks);\
- fprintf(stderr,"reachable: %3ld bytes in %2ld blocks\n", R_bytes,R_blocks);\
- fprintf(stderr,"suppressed: %3ld bytes in %2ld blocks\n", S_bytes,S_blocks)
+ do { \
+ fprintf(stderr,"leaked: %3ld bytes in %2ld blocks\n", \
+ L_bytes,L_blocks); \
+ fprintf(stderr,"dubious: %3ld bytes in %2ld blocks\n", \
+ D_bytes,D_blocks); \
+ fprintf(stderr,"reachable: %3ld bytes in %2ld blocks\n", \
+ R_bytes,R_blocks); \
+ fprintf(stderr,"suppressed: %3ld bytes in %2ld blocks\n", \
+ S_bytes,S_blocks); \
+ } while (0)
Modified: branches/DARWIN/memcheck/tests/leakotron.c
===================================================================
--- branches/DARWIN/memcheck/tests/leakotron.c 2009-03-02 00:21:00 UTC (rev 9299)
+++ branches/DARWIN/memcheck/tests/leakotron.c 2009-03-02 03:53:21 UTC (rev 9300)
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <assert.h>
#include "../memcheck.h"
+#include "leak.h"
/*
Incompetent memory management
@@ -10,7 +11,7 @@
structure with refcounting.
*/
-static int bytes, blocks;
+static long bytes, blocks;
struct node {
struct node *l, *r;
@@ -95,65 +96,53 @@
int main()
{
int i;
- long base_definite, base_dubious, base_reachable, base_suppressed;
- long definite, dubious, reachable, suppressed;
- int total;
+ long total;
+ DECLARE_LEAK_COUNTERS;
/* we require these longs to have same size as a machine word */
assert(sizeof(long) == sizeof(void*));
/* get a baseline in case the runtime allocated some memory */
- VALGRIND_DO_LEAK_CHECK;
- base_definite = base_dubious = base_reachable = base_suppressed = 0;
- VALGRIND_COUNT_LEAKS(base_definite, base_dubious,
- base_reachable, base_suppressed);
+ GET_INITIAL_LEAK_COUNTS;
- for(i = 0; i < ITER; i++) {
+ for (i = 0; i < ITER; i++) {
mk();
if ((i % (ITER/10)) == 0) {
if (0)
- printf("%d living blocks, %d bytes\n",
+ printf("%ld living blocks, %ld bytes\n",
blocks, bytes);
- VALGRIND_DO_LEAK_CHECK;
+ //VALGRIND_DO_LEAK_CHECK;
}
}
/* "free all memory" */
- for(i = 0; i < N; i++)
+ for (i = 0; i < N; i++)
assign(&nodes[i], NULL);
if (0)
- printf("FINISHED: %d living blocks, %d bytes\n",
+ printf("FINISHED: %ld living blocks, %ld bytes\n",
blocks, bytes);
- VALGRIND_DO_LEAK_CHECK;
+ GET_FINAL_LEAK_COUNTS;
- /* Shouldn't be necessary, but COUNT_LEAKS doesn't define its
- result values */
- definite = dubious = reachable = suppressed = 0;
- VALGRIND_COUNT_LEAKS(definite, dubious, reachable, suppressed);
+ total = L_bytes + D_bytes + R_bytes + S_bytes;
- definite -= base_definite;
- dubious -= base_dubious;
- reachable -= base_reachable;
- suppressed -= base_suppressed;
+ if (0) {
+ PRINT_LEAK_COUNTS;
+ }
- total = definite+dubious+reachable+suppressed;
-
- if (0)
- printf("leaks: definite %d, dubious %d, reachable %d, suppressed %d = %d\n",
- (int)definite, (int)dubious, (int)reachable, (int)suppressed, total);
-
- if (reachable != 0)
+ if (R_bytes != 0)
printf("FAILED: I freed everything, "
- "but there's still %d bytes reachable\n",
- (int)reachable);
+ "but there's still %ld bytes (in %ld blocks) reachable\n",
+ R_bytes, R_blocks);
else if (total != bytes)
- printf("FAILED: I count %d bytes, leakcheck says %d\n",
+ printf("FAILED: I count %ld bytes, leakcheck says %ld\n",
bytes, total);
else
printf("PASS\n");
+
+ printf("stack addr: %p\n", &i);
return 0;
}
|
|
From: Tom H. <th...@cy...> - 2009-03-02 03:48:33
|
Nightly build on vauxhall ( x86_64, Fedora 10 ) started at 2009-03-02 03:20:04 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 486 tests, 0 stderr failures, 0 stdout failures, 0 post failures == |
|
From: Tom H. <th...@cy...> - 2009-03-02 03:44:56
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2009-03-02 03:05:04 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 == 477 tests, 5 stderr failures, 0 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc20_verifywrap (stderr) |
|
From: Tom H. <th...@cy...> - 2009-03-02 03:31:49
|
Nightly build on mg ( x86_64, Fedora 9 ) started at 2009-03-02 03:10:03 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 == 483 tests, 4 stderr failures, 2 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) memcheck/tests/linux/timerfd-syscall (stdout) none/tests/linux/mremap2 (stdout) |
|
From: Julian S. <js...@ac...> - 2009-03-02 01:46:55
|
We are pleased to announce a new release of Valgrind, version 3.4.1, available from http://www.valgrind.org. See the attached release notes for details. Happy (and productive) debugging and profiling, -- The Valgrind Developers Release 3.4.1 (28 February 2009) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3.4.1 is a bug-fix release that fixes some regressions and assertion failures in debug info reading in 3.4.0, most notably incorrect stack traces on amd64-linux on older (glibc-2.3 based) systems. Various other debug info problems are also fixed. A number of bugs in the exp-ptrcheck tool introduced in 3.4.0 have been fixed. In view of the fact that 3.4.0 contains user-visible regressions relative to 3.3.x, upgrading to 3.4.1 is recommended. Packagers are encouraged to ship 3.4.1 in preference to 3.4.0. The fixed bugs are as follows. Note that "n-i-bz" stands for "not in bugzilla" -- that is, a bug that was reported to us but never got a bugzilla entry. We encourage you to file bugs in bugzilla (http://bugs.kde.org/enter_valgrind_bug.cgi) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. n-i-bz Fix various bugs reading icc-11 generated debug info n-i-bz Fix various bugs reading gcc-4.4 generated debug info n-i-bz Preliminary support for glibc-2.10 / Fedora 11 n-i-bz Cachegrind and Callgrind: handle non-power-of-two cache sizes, so as to support (eg) 24k Atom D1 and Core2 with 3/6/12MB L2. 179618 exp-ptrcheck crashed / exit prematurely 179624 helgrind: false positive races with pthread_create and recv/open/close/read 134207 pkg-config output contains @VG_PLATFORM@ 176926 floating point exception at valgrind startup with PPC 440EPX 181594 Bogus warning for empty text segment 173751 amd64->IR: 0x48 0xF 0x6F 0x45 (even more redundant rex prefixes) 181707 Dwarf3 doesn't require enumerations to have name 185038 exp-ptrcheck: "unhandled syscall: 285" (fallocate) on x86_64 185050 exp-ptrcheck: sg_main.c:727 (add_block_to_GlobalTree): Assertion '!already_present' failed. 185359 exp-ptrcheck unhandled syscall getresuid() (3.4.1.RC1: 24 Feb 2008, vex r1884, valgrind r9253). (3.4.1: 28 Feb 2008, vex r1884, valgrind r9293). |
|
From: <sv...@va...> - 2009-03-02 01:03:19
|
Author: sewardj Date: 2009-03-02 01:03:17 +0000 (Mon, 02 Mar 2009) New Revision: 379 Log: More 3.4.1 updates. Modified: trunk/php/.htconfx Modified: trunk/php/.htconfx =================================================================== --- trunk/php/.htconfx 2009-03-02 00:57:28 UTC (rev 378) +++ trunk/php/.htconfx 2009-03-02 01:03:17 UTC (rev 379) @@ -27,8 +27,8 @@ 'dt_copyright' => '2000-2009', /* current release info */ - 'release-date' => '2 January 2009', - 'release-version' => 'valgrind-3.4.0', + 'release-date' => '28 February 2009', + 'release-version' => 'valgrind-3.4.1', /* mailing lists, bug reports, etc. */ 'vgannounce' => array( |
|
From: <sv...@va...> - 2009-03-02 00:57:31
|
Author: sewardj Date: 2009-03-02 00:57:28 +0000 (Mon, 02 Mar 2009) New Revision: 378 Log: Update for 3.4.1. Modified: trunk/docs/manual/dist.news.html trunk/downloads/current.html Modified: trunk/docs/manual/dist.news.html =================================================================== --- trunk/docs/manual/dist.news.html 2009-02-21 11:21:39 UTC (rev 377) +++ trunk/docs/manual/dist.news.html 2009-03-02 00:57:28 UTC (rev 378) @@ -22,6 +22,48 @@ <a name="dist.news"></a>4.NEWS</h2></div></div></div> <div class="literallayout"><p><br> <br> +Release3.4.1(28February2009)<br> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br> +3.4.1isabug-fixreleasethatfixessomeregressionsandassertion<br> +failuresindebuginforeadingin3.4.0,mostnotablyincorrectstack<br> +tracesonamd64-linuxonolder(glibc-2.3based)systems.Various<br> +otherdebuginfoproblemsarealsofixed.Anumberofbugsinthe<br> +exp-ptrchecktoolintroducedin3.4.0havebeenfixed.<br> +<br> +Inviewofthefactthat3.4.0containsuser-visibleregressions<br> +relativeto3.3.x,upgradingto3.4.1isrecommended.Packagersare<br> +encouragedtoship3.4.1inpreferenceto3.4.0.<br> +<br> +Thefixedbugsareasfollows.Notethat"n-i-bz"standsfor"notin<br> +bugzilla"--thatis,abugthatwasreportedtousbutnevergota<br> +bugzillaentry.Weencourageyoutofilebugsinbugzilla<br> +(http://bugs.kde.org/enter_valgrind_bug.cgi)ratherthanmailingthe<br> +developers(ormailinglists)directly--bugsthatarenotentered<br> +intobugzillatendtogetforgottenaboutorignored.<br> +<br> +n-i-bzFixvariousbugsreadingicc-11generateddebuginfo<br> +n-i-bzFixvariousbugsreadinggcc-4.4generateddebuginfo<br> +n-i-bzPreliminarysupportforglibc-2.10/Fedora11<br> +n-i-bzCachegrindandCallgrind:handlenon-power-of-twocachesizes,<br> +soastosupport(eg)24kAtomD1andCore2with3/6/12MBL2.<br> +179618exp-ptrcheckcrashed/exitprematurely<br> +179624helgrind:falsepositiveraceswithpthread_createand<br> +recv/open/close/read<br> +134207pkg-configoutputcontains@VG_PLATFORM@<br> +176926floatingpointexceptionatvalgrindstartupwithPPC440EPX<br> +181594Boguswarningforemptytextsegment<br> +173751amd64->IR:0x480xF0x6F0x45(evenmoreredundantrexprefixes)<br> +181707Dwarf3doesn'trequireenumerationstohavename<br> +185038exp-ptrcheck:"unhandledsyscall:285"(fallocate)onx86_64<br> +185050exp-ptrcheck:sg_main.c:727(add_block_to_GlobalTree):<br> +Assertion'!already_present'failed.<br> +185359exp-ptrcheckunhandledsyscallgetresuid()<br> +<br> +(3.4.1.RC1:24Feb2008,vexr1884,valgrindr9253).<br> +(3.4.1:28Feb2008,vexr1884,valgrindr9293).<br> +<br> +<br> +<br> Release3.4.0(2January2009)<br> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br> 3.4.0isafeaturereleasewithmanysignificantimprovementsandthe<br> Modified: trunk/downloads/current.html =================================================================== --- trunk/downloads/current.html 2009-02-21 11:21:39 UTC (rev 377) +++ trunk/downloads/current.html 2009-03-02 00:57:28 UTC (rev 378) @@ -18,43 +18,30 @@ <div id="release"> -<a name="current"><h3>Release 3.4.0</h3></a> +<a name="current"><h3>Release 3.4.1</h3></a> -<p><a href="/downloads/valgrind-3.4.0.tar.bz2">valgrind 3.4.0 (tar.bz2)</a> -[5175Kb] - 2 Jan 2009.<br /> +<p><a href="/downloads/valgrind-3.4.1.tar.bz2">valgrind 3.4.1 (tar.bz2)</a> +[5183Kb] - 28 Feb 2009.<br /> For {x86,amd64,ppc32,ppc64}-linux.<br /> -<span class="md5sum">md5: 1b0fe1219e1a583ff8c2db54ed2265e6</span></p> +<span class="md5sum">md5: b5f039dd2271aaf9ae570ab4116f87c7</span></p> <p>You may want to look at the -<a href="/docs/manual/dist.news.html">3.4.0 release notes</a>. +<a href="/docs/manual/dist.news.html">3.4.1 release notes</a>. </p> <p> - 3.4.0 is a feature release with many improvements and the usual - collection of bug fixes. This release supports X86/Linux, - AMD64/Linux, PPC32/Linux and PPC64/Linux. Support for recent distros - (using gcc 4.4, glibc 2.8 and 2.9) has been added.</p> +3.4.1 is a bug-fix release that fixes some regressions and assertion +failures in debug info reading in 3.4.0, most notably incorrect stack +traces on amd64-linux on older (glibc-2.3 based) systems. Various +other debug info problems are also fixed. A number of bugs in the +exp-ptrcheck tool introduced in 3.4.0 have been fixed.</p> + <p> - 3.4.0 brings some significant tool improvements. Memcheck can now - report the origin of uninitialised values, the thread checkers - Helgrind and DRD are much improved, and we have a new experimental - tool, exp-Ptrcheck, which is able to detect overruns of stack and - global arrays. There are many other smaller refinements and - improvements.</p> +In view of the fact that 3.4.0 contains user-visible regressions +relative to 3.3.x, upgrading to 3.4.1 is recommended. Packagers are +encouraged to ship 3.4.1 in preference to 3.4.0.</p> -<div class="hr_brown"><hr/></div> -<p>5 Feb 09: a pre-release snapshot of 3.4.1, -<a href="/downloads/valgrind-3.4.1.SVN-9098-1883.tar.bz2">valgrind-3.4.1.SVN-9098-1883.tar.bz2</a>, -is now available. This fixes some regressions and assertion failures -in debug info reading in 3.4.0, most notably incorrect stack traces -on amd64-linux on older (glibc-2.3 based) systems. Various -other debug info problems are also fixed. Unless further significant -bugs are reported, the final 3.4.1 release will be very similar to -this tarball. Please note that this snapshot is provided for testing -purposes and is not the final 3.4.1 release.</p> - - <div class="hr_brown"><hr/></div> <h3>Valkyrie 1.4.0</h3> |
|
From: <sv...@va...> - 2009-03-02 00:21:08
|
Author: njn
Date: 2009-03-02 00:21:00 +0000 (Mon, 02 Mar 2009)
New Revision: 9299
Log:
Start fixing up the memory leak tests:
- Inline filter_leak_check_size into filter_stderr; there's little point in
having it separate.
- Filter out loss record numbers, because they can vary if libc allocates at
start-up. This makes mempool, nanoleak, trivialleak pass on Darwin.
- Added a new client request VALGRIND_COUNT_LEAK_BLOCKS which is useful for
testing.
- Created leak.h which contains macros for doing delta-based leak checks,
ie. to allow for libc allocating at start-up by doing a leak check at the
start, then one later and getting the numbers as deltas. It uses
VALGRIND_COUNT_LEAK_BLOCKS.
- Updated leak-cycle.c to use leak.h. Also made it give the same results on
32-bit and 64-bit machines. This allows it to have a single .exp file
now, and it now passes on Darwin. (Similar steps will be doable for the
other Darwin-failing leak tests.)
Added:
branches/DARWIN/memcheck/tests/leak.h
Removed:
branches/DARWIN/memcheck/tests/filter_leak_check_size
branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp2
branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp64
Modified:
branches/DARWIN/memcheck/docs/mc-manual.xml
branches/DARWIN/memcheck/mc_include.h
branches/DARWIN/memcheck/mc_leakcheck.c
branches/DARWIN/memcheck/mc_main.c
branches/DARWIN/memcheck/memcheck.h
branches/DARWIN/memcheck/tests/Makefile.am
branches/DARWIN/memcheck/tests/filter_stderr
branches/DARWIN/memcheck/tests/leak-0.vgtest
branches/DARWIN/memcheck/tests/leak-cycle.c
branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp
branches/DARWIN/memcheck/tests/leak-cycle.vgtest
branches/DARWIN/memcheck/tests/leak-regroot.vgtest
branches/DARWIN/memcheck/tests/leak-tree.stderr.exp
branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2
branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64
branches/DARWIN/memcheck/tests/leak-tree.vgtest
branches/DARWIN/memcheck/tests/mempool.stderr.exp
branches/DARWIN/memcheck/tests/mempool.stderr.exp64
branches/DARWIN/memcheck/tests/nanoleak.stderr.exp
branches/DARWIN/memcheck/tests/nanoleak.vgtest
branches/DARWIN/memcheck/tests/nanoleak_supp.vgtest
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3
branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64
branches/DARWIN/memcheck/tests/pointer-trace.vgtest
branches/DARWIN/memcheck/tests/trivialleak.stderr.exp
branches/DARWIN/memcheck/tests/trivialleak.stderr.exp2
branches/DARWIN/memcheck/tests/trivialleak.vgtest
branches/DARWIN/memcheck/tests/xml1.stderr.exp
branches/DARWIN/memcheck/tests/xml1.stderr.exp2
branches/DARWIN/memcheck/tests/xml1.stderr.exp64
Modified: branches/DARWIN/memcheck/docs/mc-manual.xml
===================================================================
--- branches/DARWIN/memcheck/docs/mc-manual.xml 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/docs/mc-manual.xml 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1178,6 +1178,13 @@
</listitem>
<listitem>
+ <para><varname>VALGRIND_COUNT_LEAK_BLOCKS</varname>: identical to
+ <varname>VALGRIND_COUNT_LEAKS</varname> except that it returns the
+ number of blocks rather than the number of bytes in each
+ category.</para>
+ </listitem>
+
+ <listitem>
<para><varname>VALGRIND_GET_VBITS</varname> and
<varname>VALGRIND_SET_VBITS</varname>: allow you to get and set the
V (validity) bits for an address range. You should probably only
Modified: branches/DARWIN/memcheck/mc_include.h
===================================================================
--- branches/DARWIN/memcheck/mc_include.h 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/mc_include.h 2009-03-02 00:21:00 UTC (rev 9299)
@@ -249,6 +249,13 @@
extern SizeT MC_(bytes_reachable);
extern SizeT MC_(bytes_suppressed);
+/* For VALGRIND_COUNT_LEAK_BLOCKS client request */
+extern SizeT MC_(blocks_leaked);
+extern SizeT MC_(blocks_indirect);
+extern SizeT MC_(blocks_dubious);
+extern SizeT MC_(blocks_reachable);
+extern SizeT MC_(blocks_suppressed);
+
typedef
enum {
LC_Off,
Modified: branches/DARWIN/memcheck/mc_leakcheck.c
===================================================================
--- branches/DARWIN/memcheck/mc_leakcheck.c 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/mc_leakcheck.c 2009-03-02 00:21:00 UTC (rev 9299)
@@ -197,6 +197,12 @@
SizeT MC_(bytes_reachable) = 0;
SizeT MC_(bytes_suppressed) = 0;
+SizeT MC_(blocks_leaked) = 0;
+SizeT MC_(blocks_indirect) = 0;
+SizeT MC_(blocks_dubious) = 0;
+SizeT MC_(blocks_reachable) = 0;
+SizeT MC_(blocks_suppressed) = 0;
+
static Int lc_compar(void* n1, void* n2)
{
MC_Chunk* mc1 = *(MC_Chunk**)n1;
@@ -434,12 +440,6 @@
}
}
-static SizeT blocks_leaked;
-static SizeT blocks_indirect;
-static SizeT blocks_dubious;
-static SizeT blocks_reachable;
-static SizeT blocks_suppressed;
-
static void full_report(ThreadId tid)
{
Int i;
@@ -550,24 +550,24 @@
print_record );
if (is_suppressed) {
- blocks_suppressed += p_min->num_blocks;
- MC_(bytes_suppressed) += p_min->total_bytes;
+ MC_(blocks_suppressed) += p_min->num_blocks;
+ MC_(bytes_suppressed) += p_min->total_bytes;
} else if (Unreached == p_min->loss_mode) {
- blocks_leaked += p_min->num_blocks;
- MC_(bytes_leaked) += p_min->total_bytes;
+ MC_(blocks_leaked) += p_min->num_blocks;
+ MC_(bytes_leaked) += p_min->total_bytes;
} else if (IndirectLeak == p_min->loss_mode) {
- blocks_indirect += p_min->num_blocks;
- MC_(bytes_indirect) += p_min->total_bytes;
+ MC_(blocks_indirect) += p_min->num_blocks;
+ MC_(bytes_indirect) += p_min->total_bytes;
- } else if (Interior == p_min->loss_mode) {
- blocks_dubious += p_min->num_blocks;
- MC_(bytes_dubious) += p_min->total_bytes;
+ } else if (Interior == p_min->loss_mode) {
+ MC_(blocks_dubious) += p_min->num_blocks;
+ MC_(bytes_dubious) += p_min->total_bytes;
- } else if (Proper == p_min->loss_mode) {
- blocks_reachable += p_min->num_blocks;
- MC_(bytes_reachable) += p_min->total_bytes;
+ } else if (Proper == p_min->loss_mode) {
+ MC_(blocks_reachable) += p_min->num_blocks;
+ MC_(bytes_reachable) += p_min->total_bytes;
} else {
VG_(tool_panic)("generic_detect_memory_leaks: unknown loss mode");
@@ -586,22 +586,22 @@
switch(lc_markstack[i].state) {
case Unreached:
- blocks_leaked++;
+ MC_(blocks_leaked)++;
MC_(bytes_leaked) += size;
break;
case Proper:
- blocks_reachable++;
+ MC_(blocks_reachable)++;
MC_(bytes_reachable) += size;
break;
case Interior:
- blocks_dubious++;
+ MC_(blocks_dubious)++;
MC_(bytes_dubious) += size;
break;
case IndirectLeak: /* shouldn't happen */
- blocks_indirect++;
+ MC_(blocks_indirect)++;
MC_(bytes_indirect) += size;
break;
}
@@ -847,11 +847,11 @@
if (VG_(clo_verbosity) > 0 && !VG_(clo_xml))
VG_(message)(Vg_UserMsg, "checked %'lu bytes.", lc_scanned);
- blocks_leaked = MC_(bytes_leaked) = 0;
- blocks_indirect = MC_(bytes_indirect) = 0;
- blocks_dubious = MC_(bytes_dubious) = 0;
- blocks_reachable = MC_(bytes_reachable) = 0;
- blocks_suppressed = MC_(bytes_suppressed) = 0;
+ MC_(blocks_leaked) = MC_(bytes_leaked) = 0;
+ MC_(blocks_indirect) = MC_(bytes_indirect) = 0;
+ MC_(blocks_dubious) = MC_(bytes_dubious) = 0;
+ MC_(blocks_reachable) = MC_(bytes_reachable) = 0;
+ MC_(blocks_suppressed) = MC_(bytes_suppressed) = 0;
if (mode == LC_Full)
full_report(tid);
@@ -862,23 +862,23 @@
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "LEAK SUMMARY:");
VG_(message)(Vg_UserMsg, " definitely lost: %'lu bytes in %'lu blocks.",
- MC_(bytes_leaked), blocks_leaked );
- if (blocks_indirect > 0)
+ MC_(bytes_leaked), MC_(blocks_leaked) );
+ if (MC_(blocks_indirect) > 0)
VG_(message)(Vg_UserMsg, " indirectly lost: %'lu bytes in %'lu blocks.",
- MC_(bytes_indirect), blocks_indirect );
+ MC_(bytes_indirect), MC_(blocks_indirect) );
VG_(message)(Vg_UserMsg, " possibly lost: %'lu bytes in %'lu blocks.",
- MC_(bytes_dubious), blocks_dubious );
+ MC_(bytes_dubious), MC_(blocks_dubious) );
VG_(message)(Vg_UserMsg, " still reachable: %'lu bytes in %'lu blocks.",
- MC_(bytes_reachable), blocks_reachable );
+ MC_(bytes_reachable), MC_(blocks_reachable) );
VG_(message)(Vg_UserMsg, " suppressed: %'lu bytes in %'lu blocks.",
- MC_(bytes_suppressed), blocks_suppressed );
+ MC_(bytes_suppressed), MC_(blocks_suppressed) );
if (mode == LC_Summary
- && (blocks_leaked + blocks_indirect
- + blocks_dubious + blocks_reachable) > 0) {
+ && (MC_(blocks_leaked) + MC_(blocks_indirect)
+ + MC_(blocks_dubious) + MC_(blocks_reachable)) > 0) {
VG_(message)(Vg_UserMsg,
"Rerun with --leak-check=full to see details of leaked memory.");
}
- if (blocks_reachable > 0 && !MC_(clo_show_reachable) && mode == LC_Full) {
+ if (MC_(blocks_reachable) > 0 && !MC_(clo_show_reachable) && mode == LC_Full) {
VG_(message)(Vg_UserMsg,
"Reachable blocks (those to which a pointer was found) are not shown.");
VG_(message)(Vg_UserMsg,
Modified: branches/DARWIN/memcheck/mc_main.c
===================================================================
--- branches/DARWIN/memcheck/mc_main.c 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/mc_main.c 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1057,9 +1057,9 @@
static Bool isHex ( UChar c )
{
- return ((c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'f')
- || (c >= 'A' && c <= 'F'));
+ return ((c >= '0' && c <= '9') ||
+ (c >= 'a' && c <= 'f') ||
+ (c >= 'A' && c <= 'F'));
}
static UInt fromHex ( UChar c )
@@ -5012,10 +5012,26 @@
*argp[4] = MC_(bytes_suppressed);
// there is no argp[5]
//*argp[5] = MC_(bytes_indirect);
- // XXX need to make *argp[1-4] defined
+ // XXX need to make *argp[1-4] defined; currently done in the
+ // VALGRIND_COUNT_LEAKS_MACRO by initialising them to zero.
*ret = 0;
return True;
}
+ case VG_USERREQ__COUNT_LEAK_BLOCKS: { /* count leaked blocks */
+ UWord** argp = (UWord**)arg;
+ // MC_(blocks_leaked) et al were set by the last leak check (or zero
+ // if no prior leak checks performed).
+ *argp[1] = MC_(blocks_leaked) + MC_(blocks_indirect);
+ *argp[2] = MC_(blocks_dubious);
+ *argp[3] = MC_(blocks_reachable);
+ *argp[4] = MC_(blocks_suppressed);
+ // there is no argp[5]
+ //*argp[5] = MC_(blocks_indirect);
+ // XXX need to make *argp[1-4] defined; currently done in the
+ // VALGRIND_COUNT_LEAK_BLOCKS_MACRO by initialising them to zero.
+ *ret = 0;
+ return True;
+ }
case VG_USERREQ__MALLOCLIKE_BLOCK: {
Addr p = (Addr)arg[1];
SizeT sizeB = arg[2];
Modified: branches/DARWIN/memcheck/memcheck.h
===================================================================
--- branches/DARWIN/memcheck/memcheck.h 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/memcheck.h 2009-03-02 00:21:00 UTC (rev 9299)
@@ -93,6 +93,9 @@
VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE,
+ /* Not next to VG_USERREQ__COUNT_LEAKS because it was added later. */
+ VG_USERREQ__COUNT_LEAK_BLOCKS,
+
/* This is just for memcheck's internal use - don't use it */
_VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR
= VG_USERREQ_TOOL_BASE('M','C') + 256
@@ -242,7 +245,29 @@
suppressed = _qzz_suppressed; \
}
+/* Return number of leaked, dubious, reachable and suppressed bytes found by
+ all previous leak checks. They must be lvalues. */
+#define VALGRIND_COUNT_LEAK_BLOCKS(leaked, dubious, reachable, suppressed) \
+ /* For safety on 64-bit platforms we assign the results to private
+ unsigned long variables, then assign these to the lvalues the user
+ specified, which works no matter what type 'leaked', 'dubious', etc
+ are. We also initialise '_qzz_leaked', etc because
+ VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
+ initialised. */ \
+ {unsigned long _qzz_res; \
+ unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
+ unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__COUNT_LEAK_BLOCKS, \
+ &_qzz_leaked, &_qzz_dubious, \
+ &_qzz_reachable, &_qzz_suppressed, 0); \
+ leaked = _qzz_leaked; \
+ dubious = _qzz_dubious; \
+ reachable = _qzz_reachable; \
+ suppressed = _qzz_suppressed; \
+ }
+
/* Get the validity data for addresses [zza..zza+zznbytes-1] and copy it
into the provided zzvbits array. Return values:
0 if not running on valgrind
Modified: branches/DARWIN/memcheck/tests/Makefile.am
===================================================================
--- branches/DARWIN/memcheck/tests/Makefile.am 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/Makefile.am 2009-03-02 00:21:00 UTC (rev 9299)
@@ -23,7 +23,7 @@
DIST_SUBDIRS = x86 amd64 linux x86-linux .
-noinst_SCRIPTS = filter_allocs filter_leak_check_size \
+noinst_SCRIPTS = filter_allocs \
filter_stderr filter_xml \
filter_varinfo3
@@ -59,7 +59,7 @@
inits.stderr.exp inits.vgtest \
inline.stderr.exp inline.stdout.exp inline.vgtest \
leak-0.vgtest leak-0.stderr.exp \
- leak-cycle.vgtest leak-cycle.stderr.exp leak-cycle.stderr.exp64 \
+ leak-cycle.vgtest leak-cycle.stderr.exp \
leak-pool-0.vgtest leak-pool-0.stderr.exp leak-pool-0.stderr.exp64 \
leak-pool-1.vgtest leak-pool-1.stderr.exp leak-pool-1.stderr.exp64 \
leak-pool-2.vgtest leak-pool-2.stderr.exp leak-pool-2.stderr.exp64 \
Deleted: branches/DARWIN/memcheck/tests/filter_leak_check_size
===================================================================
--- branches/DARWIN/memcheck/tests/filter_leak_check_size 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/filter_leak_check_size 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,4 +0,0 @@
-#! /bin/sh
-
-./filter_stderr |
-sed "s/checked [0-9,]* bytes./checked ... bytes./"
Modified: branches/DARWIN/memcheck/tests/filter_stderr
===================================================================
--- branches/DARWIN/memcheck/tests/filter_stderr 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/filter_stderr 2009-03-02 00:21:00 UTC (rev 9299)
@@ -31,5 +31,13 @@
# Something similar for XML output. Chops everything within
# <stack>...</stack>.
-perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn)[^\n]*\n)*/$1\n/gs'
+perl -p -0 -e 's/(<what>Syscall param[^\n]*)\n([^\n]*(stack|frame|ip|obj|fn)[^\n]*\n)*/$1\n/gs' |
+# Leak check filtering.
+sed "s/checked [0-9,]* bytes./checked ... bytes./" |
+
+# More leak check filtering. For systems that do extra libc allocations
+# (eg. Darwin) there may be extra (reachable, and thus not shown) loss
+# records. So we filter out the loss record numbers.
+perl -p -e "s/lost in loss record \d+ of \d+/lost in loss record ... of .../"
+
Modified: branches/DARWIN/memcheck/tests/leak-0.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leak-0.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-0.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,2 +1 @@
prog: leak-0
-stderr_filter: filter_leak_check_size
Modified: branches/DARWIN/memcheck/tests/leak-cycle.c
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.c 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-cycle.c 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,14 +1,18 @@
+#include <stdio.h>
#include <stdlib.h>
+#include "leak.h"
#include "../memcheck.h"
struct n {
struct n *l;
struct n *r;
+ // This ensures it's the same size on 32-bit and 64-bit platforms.
+ char padding[ 2 * (8 - sizeof(struct n*)) ];
};
struct n *mk(struct n *l, struct n *r)
{
- struct n *n = malloc(sizeof(*n));
+ struct n *n = malloc(sizeof(struct n));
n->l = l;
n->r = r;
@@ -27,19 +31,21 @@
return a;
}
+
int main()
{
+ DECLARE_LEAK_COUNTERS;
struct n *volatile c1, *volatile c2;
+ GET_INIITAL_LEAK_COUNTS;
+
/* two simple cycles */
c1 = mkcycle();
c2 = mkcycle();
c1 = c2 = 0;
- //VALGRIND_DO_LEAK_CHECK;
-
/* one cycle linked to another */
c1 = mkcycle();
c2 = mkcycle();
@@ -53,8 +59,6 @@
c1 = c2 = 0;
- //VALGRIND_DO_LEAK_CHECK;
-
/* two linked cycles */
c1 = mkcycle();
c2 = mkcycle();
@@ -64,7 +68,9 @@
c1 = c2 = 0;
- VALGRIND_DO_LEAK_CHECK;
+ GET_FINAL_LEAK_COUNTS;
+ PRINT_LEAK_COUNTS;
+
return 0;
}
Modified: branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,43 +1,31 @@
+leaked: 288 bytes in 18 blocks
+dubious: 0 bytes in 0 blocks
+reachable: 0 bytes in 0 blocks
+suppressed: 0 bytes in 0 blocks
-searching for pointers to 18 not-freed blocks.
-checked ... bytes.
-
-24 (8 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 18
+48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:36)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
+ by 0x........: main (leak-cycle.c:44)
-24 (8 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 18
+48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:37)
-
-
-48 (8 direct, 40 indirect) bytes in 1 blocks are definitely lost in loss record 17 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
by 0x........: main (leak-cycle.c:45)
-48 (8 direct, 40 indirect) bytes in 1 blocks are definitely lost in loss record 18 of 18
+96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:59)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
+ by 0x........: main (leak-cycle.c:51)
-LEAK SUMMARY:
- definitely lost: 32 bytes in 4 blocks.
- indirectly lost: 112 bytes in 14 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 0 blocks.
- suppressed: 0 bytes in 0 blocks.
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 144 bytes in 18 blocks.
-malloc/free: 18 allocs, 0 frees, 144 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
+96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: mk (leak-cycle.c:15)
+ by 0x........: mkcycle (leak-cycle.c:26)
+ by 0x........: main (leak-cycle.c:63)
Deleted: branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp2 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp2 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,45 +0,0 @@
-
-searching for pointers to 19 not-freed blocks.
-checked ... bytes.
-
-24 (8+16) bytes in 1 blocks are definitely lost in loss record 15 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:36)
-
-
-24 (8+16) bytes in 1 blocks are definitely lost in loss record 16 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:37)
-
-
-48 (8+40) bytes in 1 blocks are definitely lost in loss record 18 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:45)
-
-
-48 (8+40) bytes in 1 blocks are definitely lost in loss record 19 of 19
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:59)
-
-LEAK SUMMARY:
- definitely lost: 32 bytes in 4 blocks.
- indirectly lost: 112 bytes in 14 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 24 bytes in 1 blocks.
- suppressed: 0 bytes in 0 blocks.
-Reachable blocks (those to which a pointer was found) are not shown.
-To see them, rerun with: --show-reachable=yes
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 144 bytes in 18 blocks.
-malloc/free: 19 allocs, 1 frees, 168 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Deleted: branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp64 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp64 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,43 +0,0 @@
-
-searching for pointers to 18 not-freed blocks.
-checked ... bytes.
-
-48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:36)
-
-
-48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:37)
-
-
-96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 17 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:45)
-
-
-96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 18 of 18
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: mk (leak-cycle.c:11)
- by 0x........: mkcycle (leak-cycle.c:22)
- by 0x........: main (leak-cycle.c:59)
-
-LEAK SUMMARY:
- definitely lost: 64 bytes in 4 blocks.
- indirectly lost: 224 bytes in 14 blocks.
- possibly lost: 0 bytes in 0 blocks.
- still reachable: 0 bytes in 0 blocks.
- suppressed: 0 bytes in 0 blocks.
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
-malloc/free: in use at exit: 288 bytes in 18 blocks.
-malloc/free: 18 allocs, 0 frees, 288 bytes allocated.
-For a detailed leak analysis, rerun with: --leak-check=yes
-For counts of detected errors, rerun with: -v
Modified: branches/DARWIN/memcheck/tests/leak-cycle.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-cycle.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,3 +1,2 @@
prog: leak-cycle
-vgopts: --leak-resolution=high
-stderr_filter: filter_leak_check_size
+vgopts: -q --leak-check=yes --leak-resolution=high
Modified: branches/DARWIN/memcheck/tests/leak-regroot.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leak-regroot.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-regroot.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,2 +1 @@
prog: leak-regroot
-stderr_filter: filter_leak_check_size
Modified: branches/DARWIN/memcheck/tests/leak-tree.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.stderr.exp 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-tree.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
@@ -2,7 +2,7 @@
searching for pointers to 11 not-freed blocks.
checked ... bytes.
-72 (8 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 11
+72 (8 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
@@ -19,19 +19,19 @@
checked ... bytes.
-8 bytes in 1 blocks are definitely lost in loss record 1 of 14
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:39)
-88 (8 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 13 of 14
+88 (8 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
-16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 14
+16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:38)
Modified: branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-tree.stderr.exp2 2009-03-02 00:21:00 UTC (rev 9299)
@@ -2,7 +2,7 @@
searching for pointers to 11 not-freed blocks.
checked ... bytes.
-8 bytes in 1 blocks are definitely lost in loss record 1 of 11
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
@@ -18,19 +18,19 @@
checked ... bytes.
-8 bytes in 1 blocks are definitely lost in loss record 1 of 14
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:39)
-8 bytes in 1 blocks are definitely lost in loss record 2 of 14
+8 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:38)
-40 (8 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 14
+40 (8 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
Modified: branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-tree.stderr.exp64 2009-03-02 00:21:00 UTC (rev 9299)
@@ -2,7 +2,7 @@
searching for pointers to 11 not-freed blocks.
checked ... bytes.
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 11
+80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
@@ -19,19 +19,19 @@
checked ... bytes.
-16 bytes in 1 blocks are definitely lost in loss record 1 of 14
+16 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:39)
-16 bytes in 1 blocks are definitely lost in loss record 2 of 14
+16 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:38)
-80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 14
+80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-tree.c:11)
by 0x........: main (leak-tree.c:25)
Modified: branches/DARWIN/memcheck/tests/leak-tree.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/leak-tree.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/leak-tree.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,3 +1,2 @@
prog: leak-tree
vgopts: --leak-resolution=high
-stderr_filter: filter_leak_check_size
Added: branches/DARWIN/memcheck/tests/leak.h
===================================================================
--- branches/DARWIN/memcheck/tests/leak.h (rev 0)
+++ branches/DARWIN/memcheck/tests/leak.h 2009-03-02 00:21:00 UTC (rev 9299)
@@ -0,0 +1,33 @@
+// These counters are used to get a delta between leak counts at startup
+// (eg. due to libc) and later on. Necessary to get reliable leak tests
+// across different platforms.
+#define DECLARE_LEAK_COUNTERS \
+ long L0_bytes = 0, L_bytes = 0, L0_blocks = 0, L_blocks = 0; \
+ long D0_bytes = 0, D_bytes = 0, D0_blocks = 0, D_blocks = 0; \
+ long R0_bytes = 0, R_bytes = 0, R0_blocks = 0, R_blocks = 0; \
+ long S0_bytes = 0, S_bytes = 0, S0_blocks = 0, S_blocks = 0
+
+// Set a baseline, in case allocations have already happened.
+#define GET_INIITAL_LEAK_COUNTS \
+ VALGRIND_DO_QUICK_LEAK_CHECK; \
+ VALGRIND_COUNT_LEAKS( L0_bytes, D0_bytes, R0_bytes, S0_bytes );\
+ VALGRIND_COUNT_LEAK_BLOCKS(L0_blocks, D0_blocks, R0_blocks, S0_blocks)
+
+// Set a baseline, in case allocations have already happened.
+#define GET_FINAL_LEAK_COUNTS \
+ VALGRIND_DO_QUICK_LEAK_CHECK; \
+ VALGRIND_COUNT_LEAKS( L_bytes, D_bytes, R_bytes, S_bytes ); \
+ VALGRIND_COUNT_LEAK_BLOCKS(L_blocks, D_blocks, R_blocks, S_blocks); \
+ L_bytes -= L0_bytes; L_blocks -= L0_blocks; \
+ D_bytes -= D0_bytes; D_blocks -= D0_blocks; \
+ R_bytes -= R0_bytes; R_blocks -= R0_blocks; \
+ S_bytes -= S0_bytes; S_blocks -= S0_blocks
+
+// Print leak counts. When used in conjunction with -q the normal counts
+// aren't shown, which is what we want.
+#define PRINT_LEAK_COUNTS \
+ fprintf(stderr,"leaked: %3ld bytes in %2ld blocks\n", L_bytes,L_blocks);\
+ fprintf(stderr,"dubious: %3ld bytes in %2ld blocks\n", D_bytes,D_blocks);\
+ fprintf(stderr,"reachable: %3ld bytes in %2ld blocks\n", R_bytes,R_blocks);\
+ fprintf(stderr,"suppressed: %3ld bytes in %2ld blocks\n", S_bytes,S_blocks)
+
Modified: branches/DARWIN/memcheck/tests/mempool.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/mempool.stderr.exp 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/mempool.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
@@ -35,25 +35,25 @@
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 2 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:135)
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 3 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:115)
by 0x........: main (mempool.c:148)
-20 bytes in 1 blocks are definitely lost in loss record 4 of 5
+20 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:116)
by 0x........: main (mempool.c:148)
-28 (20 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
+28 (20 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: make_pool (mempool.c:37)
by 0x........: test (mempool.c:111)
Modified: branches/DARWIN/memcheck/tests/mempool.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/mempool.stderr.exp64 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/mempool.stderr.exp64 2009-03-02 00:21:00 UTC (rev 9299)
@@ -35,25 +35,25 @@
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 1 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:135)
by 0x........: main (mempool.c:148)
-10 bytes in 1 blocks are definitely lost in loss record 2 of 5
+10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:115)
by 0x........: main (mempool.c:148)
-20 bytes in 1 blocks are definitely lost in loss record 4 of 5
+20 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: allocate (mempool.c:99)
by 0x........: test (mempool.c:116)
by 0x........: main (mempool.c:148)
-48 (32 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
+48 (32 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: make_pool (mempool.c:37)
by 0x........: test (mempool.c:111)
Modified: branches/DARWIN/memcheck/tests/nanoleak.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/nanoleak.stderr.exp 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/nanoleak.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,4 +1,4 @@
-1,000 bytes in 1 blocks are definitely lost in loss record 1 of 1
+1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (nanoleak.c:6)
Modified: branches/DARWIN/memcheck/tests/nanoleak.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/nanoleak.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/nanoleak.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,3 +1,2 @@
vgopts: --leak-check=yes -q
prog: nanoleak
-stderr_filter: filter_leak_check_size
Modified: branches/DARWIN/memcheck/tests/nanoleak_supp.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/nanoleak_supp.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/nanoleak_supp.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,3 +1,2 @@
vgopts: --leak-check=yes --suppressions=nanoleak.supp -q
prog: nanoleak
-stderr_filter: filter_leak_check_size
Modified: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
@@ -17,7 +17,7 @@
searching for pointers to 1 not-freed blocks.
checked ... bytes.
-1,048,576 bytes in 1 blocks are definitely lost in loss record 1 of 1
+1,048,576 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (pointer-trace.c:47)
Modified: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp2 2009-03-02 00:21:00 UTC (rev 9299)
@@ -18,7 +18,7 @@
searching for pointers to 1 not-freed blocks.
checked ... bytes.
-1,048,576 bytes in 1 blocks are definitely lost in loss record 1 of 1
+1,048,576 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (pointer-trace.c:24)
Modified: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp3 2009-03-02 00:21:00 UTC (rev 9299)
@@ -17,7 +17,7 @@
searching for pointers to 1 not-freed blocks.
checked ... bytes.
-1,048,576 bytes in 1 blocks are possibly lost in loss record 1 of 1
+1,048,576 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (pointer-trace.c:24)
Modified: branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/pointer-trace.stderr.exp64 2009-03-02 00:21:00 UTC (rev 9299)
@@ -17,7 +17,7 @@
searching for pointers to 1 not-freed blocks.
checked ... bytes.
-2,097,152 bytes in 1 blocks are definitely lost in loss record 1 of 1
+2,097,152 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (pointer-trace.c:24)
Modified: branches/DARWIN/memcheck/tests/pointer-trace.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/pointer-trace.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/pointer-trace.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,3 +1,2 @@
prog: pointer-trace
vgopts: --leak-check=yes
-stderr_filter: filter_leak_check_size
Modified: branches/DARWIN/memcheck/tests/trivialleak.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/trivialleak.stderr.exp 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/trivialleak.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,5 +1,5 @@
-1,000 bytes in 1,000 blocks are definitely lost in loss record 1 of 1
+1,000 bytes in 1,000 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: test (trivialleak.c:8)
by 0x........: main (trivialleak.c:12)
Modified: branches/DARWIN/memcheck/tests/trivialleak.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/trivialleak.stderr.exp2 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/trivialleak.stderr.exp2 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,5 +1,5 @@
-999 bytes in 999 blocks are definitely lost in loss record 2 of 2
+999 bytes in 999 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: test (trivialleak.c:8)
by 0x........: main (trivialleak.c:12)
Modified: branches/DARWIN/memcheck/tests/trivialleak.vgtest
===================================================================
--- branches/DARWIN/memcheck/tests/trivialleak.vgtest 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/trivialleak.vgtest 2009-03-02 00:21:00 UTC (rev 9299)
@@ -1,3 +1,2 @@
vgopts: --leak-check=yes -q
prog: trivialleak
-stderr_filter: filter_leak_check_size
Modified: branches/DARWIN/memcheck/tests/xml1.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/xml1.stderr.exp 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/xml1.stderr.exp 2009-03-02 00:21:00 UTC (rev 9299)
@@ -382,7 +382,7 @@
<unique>0x........</unique>
<tid>...</tid>
<kind>Leak_DefinitelyLost</kind>
- <what>396 bytes in 1 blocks are definitely lost in loss record 1 of 1</what>
+ <what>396 bytes in 1 blocks are definitely lost in loss record ... of ...</what>
<leakedbytes>396</leakedbytes>
<leakedblocks>1</leakedblocks>
<stack>
Modified: branches/DARWIN/memcheck/tests/xml1.stderr.exp2
===================================================================
--- branches/DARWIN/memcheck/tests/xml1.stderr.exp2 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/xml1.stderr.exp2 2009-03-02 00:21:00 UTC (rev 9299)
@@ -382,7 +382,7 @@
<unique>0x........</unique>
<tid>...</tid>
<kind>Leak_DefinitelyLost</kind>
- <what>396 bytes in 1 blocks are definitely lost in loss record 1 of 1</what>
+ <what>396 bytes in 1 blocks are definitely lost in loss record ... of ...</what>
<leakedbytes>396</leakedbytes>
<leakedblocks>1</leakedblocks>
<stack>
Modified: branches/DARWIN/memcheck/tests/xml1.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/xml1.stderr.exp64 2009-03-01 16:17:24 UTC (rev 9298)
+++ branches/DARWIN/memcheck/tests/xml1.stderr.exp64 2009-03-02 00:21:00 UTC (rev 9299)
@@ -382,7 +382,7 @@
<unique>0x........</unique>
<tid>...</tid>
<kind>Leak_DefinitelyLost</kind>
- <what>396 bytes in 1 blocks are definitely lost in loss record 1 of 1</what>
+ <what>396 bytes in 1 blocks are definitely lost in loss record ... of ...</what>
<leakedbytes>396</leakedbytes>
<leakedblocks>1</leakedblocks>
<stack>
|