|
From: <sv...@va...> - 2012-05-05 22:18:33
|
philippe 2012-05-05 23:18:24 +0100 (Sat, 05 May 2012)
New Revision: 12554
Log:
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.
Modified files:
trunk/coregrind/m_debuginfo/storage.c
Modified: trunk/coregrind/m_debuginfo/storage.c (+7 -1)
===================================================================
--- trunk/coregrind/m_debuginfo/storage.c 2012-05-05 20:22:41 +01:00 (rev 12553)
+++ trunk/coregrind/m_debuginfo/storage.c 2012-05-05 23:18:24 +01:00 (rev 12554)
@@ -1372,7 +1372,13 @@
&& !!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) {
|