summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol-elf.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-28 14:21:13 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-28 14:21:13 -0700
commit9b565a8051b389e046209a5f68c93eade8de58bd (patch)
tree421884209c61b00e08fe7d47c957dc210df9a2b5 /tools/perf/util/symbol-elf.c
parentddd23eb1829988cc1ebc58a2f622c56c508e219e (diff)
parent8a3da6c7d0031fcb6a0d17f9c7a68b0e01f52855 (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "A couple of tooling fixlets and a PMU detection printout fix" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86: Fix PMU detection printout when no PMU is detected perf symbols: Demangle cloned functions perf machine: Fix path unpopulated in machine__create_modules() perf tools: Explicitly add libdl dependency perf probe: Fix probing symbols with optimization suffix perf trace: Add mmap2 handler perf kmem: Make it work again on non NUMA machines
Diffstat (limited to 'tools/perf/util/symbol-elf.c')
-rw-r--r--tools/perf/util/symbol-elf.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index a9c829be521..d2a888e2e05 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -928,8 +928,33 @@ int dso__load_sym(struct dso *dso, struct map *map,
* to it...
*/
if (symbol_conf.demangle) {
- demangled = bfd_demangle(NULL, elf_name,
+ /*
+ * The demangler doesn't deal with cloned functions.
+ * XXXX.clone.NUM or similar
+ * Strip the dot part and readd it later.
+ */
+ char *p = (char *)elf_name, *dot;
+ dot = strchr(elf_name, '.');
+ if (dot) {
+ p = strdup(elf_name);
+ if (!p)
+ goto new_symbol;
+ dot = strchr(p, '.');
+ *dot = 0;
+ }
+
+ demangled = bfd_demangle(NULL, p,
DMGL_PARAMS | DMGL_ANSI);
+ if (dot)
+ *dot = '.';
+ if (demangled && dot) {
+ demangled = realloc(demangled, strlen(demangled) + strlen(dot) + 1);
+ if (!demangled)
+ goto new_symbol;
+ strcpy(demangled + (dot - p), dot);
+ }
+ if (p != elf_name)
+ free(p);
if (demangled != NULL)
elf_name = demangled;
}