]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Comment and docs wibbles.
authorNicholas Nethercote <njn@valgrind.org>
Wed, 5 Aug 2009 02:02:31 +0000 (02:02 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 5 Aug 2009 02:02:31 +0000 (02:02 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10710

massif/docs/ms-manual.xml
massif/ms_main.c

index 9e77eb063092e150151a208e752f082b237bae14..50b4584321c1e9e7a890a4ae5ed31a7383e15d7d 100644 (file)
@@ -645,7 +645,20 @@ in a particular column, which makes following the allocation chains easier.
       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:
index ff4ace595387bcc0f1b6b0a1633a29b211d3c2b1..585df2208b39495cd1d476bf0db015a3c5c6269e 100644 (file)
@@ -871,14 +871,11 @@ Int get_IPs( ThreadId tid, Bool is_custom_alloc, Addr ips[])
       // 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)) {