perf report: Add --no-demangle option
authorNamhyung Kim <namhyung.kim@lge.com>
Mon, 25 Mar 2013 09:18:18 +0000 (18:18 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 26 Mar 2013 19:38:21 +0000 (16:38 -0300)
It's sometimes useful to see undemangled raw symbol name for example
other tools using the perf output to do manipulation of binaries.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Suggested-by: William Cohen <wcohen@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: William Cohen <wcohen@redhat.com>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=55571
Link: http://lkml.kernel.org/r/1364203098-17741-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Documentation/perf-report.txt
tools/perf/builtin-report.c
tools/perf/util/symbol-elf.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h

index 02284a0067f0a416c2db23203ecfcc76ae7bd808..71f15510ca0bb19383af870963e25e0be03111a1 100644 (file)
@@ -206,6 +206,10 @@ OPTIONS
 --group::
        Show event group information together.
 
+--demangle::
+       Demangle symbol names to human readable form. It's enabled by default,
+       disable with --no-demangle.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1], linkperf:perf-annotate[1]
index 296bd219977accd13b983ea358a759f500dcabf6..b5ea26cc7eb1c4f63ab0c9de9c8124ccbfac079b 100644 (file)
@@ -692,6 +692,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
                    "use branch records for histogram filling", parse_branch_mode),
        OPT_STRING(0, "objdump", &objdump_path, "path",
                   "objdump binary to use for disassembly and annotations"),
+       OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
+                   "Disable symbol demangling"),
        OPT_END()
        };
 
index 54efcb5659ac2bf2f6061a5c64e496f1b408d54c..4b12bf85032530686406ecc8b82c1c95cde0d25c 100644 (file)
@@ -806,9 +806,12 @@ int dso__load_sym(struct dso *dso, struct map *map,
                 * DWARF DW_compile_unit has this, but we don't always have access
                 * to it...
                 */
-               demangled = bfd_demangle(NULL, elf_name, DMGL_PARAMS | DMGL_ANSI);
-               if (demangled != NULL)
-                       elf_name = demangled;
+               if (symbol_conf.demangle) {
+                       demangled = bfd_demangle(NULL, elf_name,
+                                                DMGL_PARAMS | DMGL_ANSI);
+                       if (demangled != NULL)
+                               elf_name = demangled;
+               }
 new_symbol:
                f = symbol__new(sym.st_value, sym.st_size,
                                GELF_ST_BIND(sym.st_info), elf_name);
index e6432d85b43dd9de0fc6470b271de72a3f6028b8..8cf3b5426a9aa9ddab8021bbdda944dec3c5e136 100644 (file)
@@ -36,6 +36,7 @@ struct symbol_conf symbol_conf = {
        .use_modules      = true,
        .try_vmlinux_path = true,
        .annotate_src     = true,
+       .demangle         = true,
        .symfs            = "",
 };
 
index b62ca37c4b77aff3e2f6e96387675842365f1bf9..d7654c23861afdc9f5ad9dfa73912f875b324ebc 100644 (file)
@@ -97,7 +97,8 @@ struct symbol_conf {
                        kptr_restrict,
                        annotate_asm_raw,
                        annotate_src,
-                       event_group;
+                       event_group,
+                       demangle;
        const char      *vmlinux_name,
                        *kallsyms_name,
                        *source_prefix,