]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Do not capture the free stacktrace in memcheck, unless we have
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 11 Jan 2017 22:13:52 +0000 (22:13 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 11 Jan 2017 22:13:52 +0000 (22:13 +0000)
either to keep the free stacktrace and/or to compute full xtree memory.

Also, properly compute avg nr of IP per execontext: the avg must
be computed using the real nr of execontext stored, not the hash
table size.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16199

coregrind/m_execontext.c
memcheck/mc_malloc_wrappers.c

index e326a52d9c4bdc887d184a16d1160b39f0e2a510..ee6cc9b97626fea65bc5e6f0021c7f4a7c014e2d 100644 (file)
@@ -186,7 +186,7 @@ void VG_(print_ExeContext_stats) ( Bool with_stacktraces )
       "   exectx: %'lu lists, %'llu contexts (avg %3.2f per list)"
       " (avg %3.2f IP per context)\n",
       ec_htab_size, ec_totstored, (Double)ec_totstored / (Double)ec_htab_size,
-      (Double)total_n_ips / (Double)ec_htab_size
+      (Double)total_n_ips / (Double)ec_totstored
    );
    VG_(message)(Vg_DebugMsg, 
       "   exectx: %'llu searches, %'llu full compares (%'llu per 1000)\n",
index e11fb23850ed13205fb351f4a63e163ac20cfca7..52e2c02a9ecce70e3e74ec7e6b5d8e63d0e1e153 100644 (file)
@@ -318,7 +318,11 @@ void  MC_(set_freed_at) (ThreadId tid, MC_Chunk* mc)
 
    switch (MC_(clo_keep_stacktraces)) {
       case KS_none:            return;
-      case KS_alloc:           pos = -1; break;
+      case KS_alloc:           
+                               if (LIKELY(VG_(clo_xtree_memory) 
+                                          != Vg_XTMemory_Full))
+                                  return;
+                               pos = -1; break;
       case KS_free:            pos = 0; break;
       case KS_alloc_then_free: pos = 0; break;
       case KS_alloc_and_free:  pos = 1; break;
@@ -332,7 +336,7 @@ void  MC_(set_freed_at) (ThreadId tid, MC_Chunk* mc)
    ec_free = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ );
    if (UNLIKELY(VG_(clo_xtree_memory) == Vg_XTMemory_Full))
        VG_(XTMemory_Full_free)(mc->szB, mc->where[0], ec_free);
-   if (pos >= 0)
+   if (LIKELY(pos >= 0))
       mc->where[pos] = ec_free;
 }