|
From: <sv...@va...> - 2008-09-06 18:36:03
|
Author: sewardj
Date: 2008-09-06 19:36:13 +0100 (Sat, 06 Sep 2008)
New Revision: 8563
Log:
Add cost-center annotations to all allocation points in Memcheck.
Modified:
branches/YARD/memcheck/mc_errors.c
branches/YARD/memcheck/mc_leakcheck.c
branches/YARD/memcheck/mc_main.c
branches/YARD/memcheck/mc_malloc_wrappers.c
branches/YARD/memcheck/mc_translate.c
branches/YARD/memcheck/tests/malloc_free_fill.stderr.exp
branches/YARD/memcheck/tests/oset_test.c
Modified: branches/YARD/memcheck/mc_errors.c
===================================================================
--- branches/YARD/memcheck/mc_errors.c 2008-09-06 18:34:50 UTC (rev 8562)
+++ branches/YARD/memcheck/mc_errors.c 2008-09-06 18:36:13 UTC (rev 8563)
@@ -1240,7 +1240,7 @@
if (VG_(get_supp_kind)(su) == ParamSupp) {
eof = VG_(get_line) ( fd, buf, nBuf );
if (eof) return False;
- VG_(set_supp_string)(su, VG_(strdup)(buf));
+ VG_(set_supp_string)(su, VG_(strdup)("mc.resi.1", buf));
}
return True;
}
Modified: branches/YARD/memcheck/mc_leakcheck.c
===================================================================
--- branches/YARD/memcheck/mc_leakcheck.c 2008-09-06 18:34:50 UTC (rev 8562)
+++ branches/YARD/memcheck/mc_leakcheck.c 2008-09-06 18:36:13 UTC (rev 8563)
@@ -85,7 +85,7 @@
n_starts = 1;
while (True) {
- starts = VG_(malloc)( n_starts * sizeof(Addr) );
+ starts = VG_(malloc)( "mc.gss.1", n_starts * sizeof(Addr) );
if (starts == NULL)
break;
r = VG_(am_get_segment_starts)( starts, n_starts );
@@ -469,7 +469,7 @@
p->indirect_bytes += lc_markstack[i].indirect;
} else {
n_lossrecords ++;
- p = VG_(malloc)(sizeof(LossRecord));
+ p = VG_(malloc)( "mc.fr.1", sizeof(LossRecord));
p->loss_mode = lc_markstack[i].state;
p->allocated_at = where;
p->total_bytes = lc_shadows[i]->szB;
@@ -608,7 +608,8 @@
VG_(ssort)((void*)mallocs, n_mallocs,
sizeof(VgHashNode*), lc_compar);
- malloc_chunk_holds_a_pool_chunk = VG_(calloc)( n_mallocs, sizeof(Bool) );
+ malloc_chunk_holds_a_pool_chunk = VG_(calloc)( "mc.fas.1",
+ n_mallocs, sizeof(Bool) );
*n_shadows = n_mallocs;
@@ -641,7 +642,7 @@
}
tl_assert(*n_shadows > 0);
- shadows = VG_(malloc)(sizeof(VgHashNode*) * (*n_shadows));
+ shadows = VG_(malloc)("mc.fas.2", sizeof(VgHashNode*) * (*n_shadows));
s = 0;
/* Copy the mempool chunks into the final array. */
@@ -738,7 +739,8 @@
lc_max_mallocd_addr = lc_shadows[lc_n_shadows-1]->data
+ lc_shadows[lc_n_shadows-1]->szB;
- lc_markstack = VG_(malloc)( lc_n_shadows * sizeof(*lc_markstack) );
+ lc_markstack = VG_(malloc)( "mc.ddml.1",
+ lc_n_shadows * sizeof(*lc_markstack) );
for (i = 0; i < lc_n_shadows; i++) {
lc_markstack[i].next = -1;
lc_markstack[i].state = Unreached;
Modified: branches/YARD/memcheck/mc_main.c
===================================================================
--- branches/YARD/memcheck/mc_main.c 2008-09-06 18:34:50 UTC (rev 8562)
+++ branches/YARD/memcheck/mc_main.c 2008-09-06 18:36:13 UTC (rev 8563)
@@ -399,7 +399,7 @@
tl_assert(sizeof(Addr) == sizeof(void*));
auxmap_L2 = VG_(OSetGen_Create)( /*keyOff*/ offsetof(AuxMapEnt,base),
/*fastCmp*/ NULL,
- VG_(malloc), VG_(free) );
+ VG_(malloc), "mc.iaLL.1", VG_(free) );
}
/* Check representation invariants; if OK return NULL; else a
@@ -891,7 +891,8 @@
{
return VG_(OSetGen_Create)( offsetof(SecVBitNode, a),
NULL, // use fast comparisons
- VG_(malloc), VG_(free) );
+ VG_(malloc), "mc.cSVT.1 (sec VBit table)",
+ VG_(free) );
}
static void gcSecVBitTable(void)
@@ -2151,8 +2152,8 @@
static OSet* ocacheL2 = NULL;
-static void* ocacheL2_malloc ( SizeT szB ) {
- return VG_(malloc)(szB);
+static void* ocacheL2_malloc ( HChar* cc, SizeT szB ) {
+ return VG_(malloc)(cc, szB);
}
static void ocacheL2_free ( void* v ) {
VG_(free)( v );
@@ -2169,7 +2170,7 @@
ocacheL2
= VG_(OSetGen_Create)( offsetof(OCacheLine,tag),
NULL, /* fast cmp */
- ocacheL2_malloc, ocacheL2_free );
+ ocacheL2_malloc, "mc.ioL2", ocacheL2_free );
tl_assert(ocacheL2);
stats__ocacheL2_n_nodes = 0;
}
@@ -4801,7 +4802,7 @@
tl_assert(cgb_used == cgb_size);
sz_new = (cgbs == NULL) ? 10 : (2 * cgb_size);
- cgbs_new = VG_(malloc)( sz_new * sizeof(CGenBlock) );
+ cgbs_new = VG_(malloc)( "mc.acb.1", sz_new * sizeof(CGenBlock) );
for (i = 0; i < cgb_used; i++)
cgbs_new[i] = cgbs[i];
@@ -4901,7 +4902,7 @@
/* VG_(printf)("allocated %d %p\n", i, cgbs); */
cgbs[i].start = arg[1];
cgbs[i].size = arg[2];
- cgbs[i].desc = VG_(strdup)((Char *)arg[3]);
+ cgbs[i].desc = VG_(strdup)("mc.mhcr.1", (Char *)arg[3]);
cgbs[i].where = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ );
*ret = i;
Modified: branches/YARD/memcheck/mc_malloc_wrappers.c
===================================================================
--- branches/YARD/memcheck/mc_malloc_wrappers.c 2008-09-06 18:34:50 UTC (rev 8562)
+++ branches/YARD/memcheck/mc_malloc_wrappers.c 2008-09-06 18:36:13 UTC (rev 8563)
@@ -135,7 +135,7 @@
MC_Chunk* create_MC_Chunk ( ExeContext* ec, Addr p, SizeT szB,
MC_AllocKind kind)
{
- MC_Chunk* mc = VG_(malloc)(sizeof(MC_Chunk));
+ MC_Chunk* mc = VG_(malloc)("mc.cMC.1 (a MC_Chunk)", sizeof(MC_Chunk));
mc->data = p;
mc->szB = szB;
mc->allockind = kind;
@@ -501,7 +501,7 @@
VG_(tool_panic)("MC_(create_mempool): duplicate pool creation");
}
- mp = VG_(malloc)(sizeof(MC_Mempool));
+ mp = VG_(malloc)("mc.cm.1", sizeof(MC_Mempool));
mp->pool = pool;
mp->rzB = rzB;
mp->is_zeroed = is_zeroed;
Modified: branches/YARD/memcheck/mc_translate.c
===================================================================
--- branches/YARD/memcheck/mc_translate.c 2008-09-06 18:34:50 UTC (rev 8562)
+++ branches/YARD/memcheck/mc_translate.c 2008-09-06 18:36:13 UTC (rev 8563)
@@ -3787,7 +3787,8 @@
IRExpr* guard;
IRCallee* cee;
Bool alreadyPresent;
- XArray* pairs = VG_(newXA)( VG_(malloc), VG_(free), sizeof(Pair) );
+ XArray* pairs = VG_(newXA)( VG_(malloc), "mc.ft.1",
+ VG_(free), sizeof(Pair) );
/* Scan forwards through the statements. Each time a call to one
of the relevant helpers is seen, check if we have made a
previous call to the same helper using the same guard
Property changes on: branches/YARD/memcheck/tests/malloc_free_fill.stderr.exp
___________________________________________________________________
Name: svn:mergeinfo
-
Modified: branches/YARD/memcheck/tests/oset_test.c
===================================================================
--- branches/YARD/memcheck/tests/oset_test.c 2008-09-06 18:34:50 UTC (rev 8562)
+++ branches/YARD/memcheck/tests/oset_test.c 2008-09-06 18:36:13 UTC (rev 8563)
@@ -45,7 +45,7 @@
return seed;
}
-static void* allocate_node(SizeT szB)
+static void* allocate_node(HChar* cc, SizeT szB)
{ return malloc(szB); }
static void free_node(void* p)
@@ -84,7 +84,7 @@
// comparisons.
OSet* oset = VG_(OSetGen_Create)(0,
NULL,
- allocate_node, free_node);
+ allocate_node, "oset_test.1", free_node);
// Try some operations on an empty OSet to ensure they don't screw up.
vg_assert( ! VG_(OSetGen_Contains)(oset, &v) );
@@ -217,7 +217,7 @@
// Create a static OSet of Ints. This one uses fast (built-in)
// comparisons.
- OSet* oset = VG_(OSetWord_Create)(allocate_node, free_node);
+ OSet* oset = VG_(OSetWord_Create)(allocate_node, "oset_test.2", free_node);
// Try some operations on an empty OSet to ensure they don't screw up.
vg_assert( ! VG_(OSetWord_Contains)(oset, v) );
@@ -375,7 +375,7 @@
// comparisons.
OSet* oset = VG_(OSetGen_Create)(offsetof(Block, first),
blockCmp,
- allocate_node, free_node);
+ allocate_node, "oset_test.3", free_node);
// Try some operations on an empty OSet to ensure they don't screw up.
vg_assert( ! VG_(OSetGen_Contains)(oset, &v) );
|