Skip to content

Commit 328ccda

Browse files
Namhyung Kimacmel
Namhyung Kim
authored andcommitted
perf report: Add --no-demangle option
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 <[email protected]> Suggested-by: William Cohen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: William Cohen <[email protected]> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=55571 Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 12c08a9 commit 328ccda

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

tools/perf/Documentation/perf-report.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ OPTIONS
206206
--group::
207207
Show event group information together.
208208

209+
--demangle::
210+
Demangle symbol names to human readable form. It's enabled by default,
211+
disable with --no-demangle.
212+
209213
SEE ALSO
210214
--------
211215
linkperf:perf-stat[1], linkperf:perf-annotate[1]

tools/perf/builtin-report.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
692692
"use branch records for histogram filling", parse_branch_mode),
693693
OPT_STRING(0, "objdump", &objdump_path, "path",
694694
"objdump binary to use for disassembly and annotations"),
695+
OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
696+
"Disable symbol demangling"),
695697
OPT_END()
696698
};
697699

tools/perf/util/symbol-elf.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,12 @@ int dso__load_sym(struct dso *dso, struct map *map,
806806
* DWARF DW_compile_unit has this, but we don't always have access
807807
* to it...
808808
*/
809-
demangled = bfd_demangle(NULL, elf_name, DMGL_PARAMS | DMGL_ANSI);
810-
if (demangled != NULL)
811-
elf_name = demangled;
809+
if (symbol_conf.demangle) {
810+
demangled = bfd_demangle(NULL, elf_name,
811+
DMGL_PARAMS | DMGL_ANSI);
812+
if (demangled != NULL)
813+
elf_name = demangled;
814+
}
812815
new_symbol:
813816
f = symbol__new(sym.st_value, sym.st_size,
814817
GELF_ST_BIND(sym.st_info), elf_name);

tools/perf/util/symbol.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct symbol_conf symbol_conf = {
3636
.use_modules = true,
3737
.try_vmlinux_path = true,
3838
.annotate_src = true,
39+
.demangle = true,
3940
.symfs = "",
4041
};
4142

tools/perf/util/symbol.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ struct symbol_conf {
9797
kptr_restrict,
9898
annotate_asm_raw,
9999
annotate_src,
100-
event_group;
100+
event_group,
101+
demangle;
101102
const char *vmlinux_name,
102103
*kallsyms_name,
103104
*source_prefix,

0 commit comments

Comments
 (0)