From: Philippe Waroquiers Date: Sat, 5 May 2012 22:18:24 +0000 (+0000) Subject: Avoid duplicate primary names when merging identical symbol table entries. X-Git-Tag: svn/VALGRIND_3_8_0~314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adf73d7410e1458b120533259085e7b0c9f97e2e;p=thirdparty%2Fvalgrind.git Avoid duplicate primary names when merging identical symbol table entries. --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 --- diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index 2a9938fb3e..b90b2e721a 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -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) {