summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-03-28 16:55:43 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-04-04 09:39:56 -0300
commit57594454ceb92defaa0707cf29289f0c3c266ede (patch)
tree43d67d121ce11ca1096e42017f7682b56746da55 /tools/perf/builtin-top.c
parent0b02b47e71fa0e006407efd4f647b0e1336a2e8c (diff)
downloadlinux-next-57594454ceb92defaa0707cf29289f0c3c266ede.tar.gz
perf symbol: Add command line support for addr2line path
Allow addr2line to be set either on the command line or via the perfconfig file. This doesn't currently work with llvm-addr2line as the addr2line code emits two things: 1) the address to decode, 2) a bogus ',' value. The expectation is the bogus value will generate: ?? ??:0 that terminates the addr2line reading. However, the output from llvm-addr2line is a single line with just the input ',' locking up the addr2line reading that is expecting a second line. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andres Freund <andres@anarazel.de> Cc: German Gomez <german.gomez@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Tom Rix <trix@redhat.com> Cc: llvm@lists.linux.dev Link: https://lore.kernel.org/r/20230328235543.1082207-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 57a273cd03de..82c6c065830d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1439,7 +1439,7 @@ int cmd_top(int argc, const char **argv)
};
struct record_opts *opts = &top.record_opts;
struct target *target = &opts->target;
- const char *disassembler_style = NULL, *objdump_path = NULL;
+ const char *disassembler_style = NULL, *objdump_path = NULL, *addr2line_path = NULL;
const struct option options[] = {
OPT_CALLBACK('e', "event", &top.evlist, "event",
"event selector. use 'perf list' to list available events",
@@ -1527,6 +1527,8 @@ int cmd_top(int argc, const char **argv)
OPT_BOOLEAN(0, "no-bpf-event", &top.record_opts.no_bpf_event, "do not record bpf events"),
OPT_STRING(0, "objdump", &objdump_path, "path",
"objdump binary to use for disassembly and annotations"),
+ OPT_STRING(0, "addr2line", &addr2line_path, "path",
+ "addr2line binary to use for line numbers"),
OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_STRING(0, "prefix", &top.annotation_opts.prefix, "prefix",
@@ -1629,7 +1631,11 @@ int cmd_top(int argc, const char **argv)
if (!top.annotation_opts.objdump_path)
return -ENOMEM;
}
-
+ if (addr2line_path) {
+ symbol_conf.addr2line_path = strdup(addr2line_path);
+ if (!symbol_conf.addr2line_path)
+ return -ENOMEM;
+ }
status = symbol__validate_sym_arguments();
if (status)