]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Avoid duplicate primary names when merging identical symbol table entries.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 5 May 2012 22:18:24 +0000 (22:18 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 5 May 2012 22:18:24 +0000 (22:18 +0000)
--trace-redir=yes shows that there are duplicated redir entries e.g.
--32537--    TOPSPECS of soname NONE filename /home/philippe/valgrind/m_redir_trace/memcheck/vgpreload_memcheck-amd64-linux.so
--32537--      libc.so*                  strcasecmp_l                   R-> (2014.0) 0x04c28bf0
--32537--      libc.so*                  strcasecmp_l                   R-> (2014.0) 0x04c28bf0
--32537--      libc.so*                  __GI_strcasecmp_l              R-> (2014.0) 0x04c28b70
--32537--      libc.so*                  __GI_strcasecmp_l              R-> (2014.0) 0x04c28b70

These are caused by the merging of identical debug entries always
adding the two primary names, even if the entries are exactly the same.

This patch avoids duplicated names in debug info if the entry to merge
has only one name identical to the entry name to which we are merging.

This avoids the useless duplicated redir entries, and slightly decreases
the "dinfo" memory usage.

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

coregrind/m_debuginfo/storage.c

index 2a9938fb3e1b820f1557a61a9cbe9edd461be1b5..b90b2e721a3e9ba98d8b37045e8a43be624ea5aa 100644 (file)
@@ -1372,7 +1372,13 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
              && !!di->symtab[w].isIFunc == !!di->symtab[r].isIFunc) {
             /* merge the two into one */
             n_merged++;
-            add_DiSym_names_to_from(di, &di->symtab[w], &di->symtab[r]);
+            /* Add r names to w if r has secondary names 
+               or r and w primary names differ. */
+            if (di->symtab[r].sec_names 
+                || (0 != VG_(strcmp)(di->symtab[r].pri_name,
+                                     di->symtab[w].pri_name))) {
+               add_DiSym_names_to_from(di, &di->symtab[w], &di->symtab[r]);
+            }
             /* and use ::pri_names to indicate this slot is no longer in use */
             di->symtab[r].pri_name = NULL;
             if (di->symtab[r].sec_names) {