|
From: <sv...@va...> - 2009-08-05 02:03:02
|
Author: njn
Date: 2009-08-05 03:02:31 +0100 (Wed, 05 Aug 2009)
New Revision: 10710
Log:
Comment and docs wibbles.
Modified:
trunk/massif/docs/ms-manual.xml
trunk/massif/ms_main.c
Modified: trunk/massif/docs/ms-manual.xml
===================================================================
--- trunk/massif/docs/ms-manual.xml 2009-08-04 07:02:54 UTC (rev 10709)
+++ trunk/massif/docs/ms-manual.xml 2009-08-05 02:02:31 UTC (rev 10710)
@@ -645,7 +645,20 @@
which can fill up the allocation trees with uninteresting information.
This option can be specified multiple times on the command line, to
name multiple functions.</para>
-
+
+ <para>Note that the named function will only be treated this way if it is
+ the top entry in a stack trace, or just below another function treated
+ this way. For example, if you have a function
+ <function>malloc1</function> that wraps <function>malloc</function>,
+ and <function>malloc2</function> that wraps
+ <function>malloc1</function>, just specifying
+ <option>--alloc-fn=malloc2</option> will have no effect. You need to
+ specify <option>--alloc-fn=malloc1</option> as well. This is a little
+ inconvenient, but the reason is that checking for allocation functions
+ is slow, and it saves a lot of time if Massif can stop looking through
+ the stack trace entries as soon as it finds one that doesn't match
+ rather than having to continue through all the entries.</para>
+
<para>Note that C++ names are demangled. Note also that overloaded
C++ names must be written in full. Single quotes may be necessary to
prevent the shell from breaking them up. For example:
Modified: trunk/massif/ms_main.c
===================================================================
--- trunk/massif/ms_main.c 2009-08-04 07:02:54 UTC (rev 10709)
+++ trunk/massif/ms_main.c 2009-08-05 02:02:31 UTC (rev 10710)
@@ -871,14 +871,11 @@
// If the original stack trace is smaller than asked-for, redo=False.
if (n_ips < clo_depth + overestimate) { redo = False; }
- // If it's a non-custom block, we will always remove the first stack
- // trace entry (which will be one of malloc, __builtin_new, etc).
- n_alloc_fns_removed = ( is_custom_alloc ? 0 : 1 );
-
// Filter out alloc fns. If it's a non-custom block, we remove the
// first entry (which will be one of malloc, __builtin_new, etc)
// without looking at it, because VG_(get_fnname) is expensive (it
// involves calls to VG_(malloc)/VG_(free)).
+ n_alloc_fns_removed = ( is_custom_alloc ? 0 : 1 );
for (i = n_alloc_fns_removed; i < n_ips; i++) {
if (VG_(get_fnname)(ips[i], buf, BUF_LEN)) {
if (is_member_fn(alloc_fns, buf)) {
|