diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-05-28 13:24:45 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-06-04 09:28:53 -0400 |
commit | f178fd2d498eccbf6592ace72b9f235f0e58c77d (patch) | |
tree | 7a603c7fd487ee73c2d0dcd8c4b7d36fcad0b10c /tools/perf | |
parent | cd0cccbae9f654479a1c5abcd876c7fc4356b882 (diff) |
perf annotate: Move objdump_path to struct annotation_options
One more step in grouping annotation options.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-sogzdhugoavm6fyw60jnb0vs@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/arch/common.c | 4 | ||||
-rw-r--r-- | tools/perf/arch/common.h | 4 | ||||
-rw-r--r-- | tools/perf/builtin-annotate.c | 7 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 7 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 3 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 3 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 1 |
8 files changed, 16 insertions, 15 deletions
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index c6f373508a4f..82657c01a3b8 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c | |||
@@ -189,7 +189,7 @@ out_error: | |||
189 | return -1; | 189 | return -1; |
190 | } | 190 | } |
191 | 191 | ||
192 | int perf_env__lookup_objdump(struct perf_env *env) | 192 | int perf_env__lookup_objdump(struct perf_env *env, const char **path) |
193 | { | 193 | { |
194 | /* | 194 | /* |
195 | * For live mode, env->arch will be NULL and we can use | 195 | * For live mode, env->arch will be NULL and we can use |
@@ -198,5 +198,5 @@ int perf_env__lookup_objdump(struct perf_env *env) | |||
198 | if (env->arch == NULL) | 198 | if (env->arch == NULL) |
199 | return 0; | 199 | return 0; |
200 | 200 | ||
201 | return perf_env__lookup_binutils_path(env, "objdump", &objdump_path); | 201 | return perf_env__lookup_binutils_path(env, "objdump", path); |
202 | } | 202 | } |
diff --git a/tools/perf/arch/common.h b/tools/perf/arch/common.h index 2d875baa92e6..2167001b18c5 100644 --- a/tools/perf/arch/common.h +++ b/tools/perf/arch/common.h | |||
@@ -4,8 +4,6 @@ | |||
4 | 4 | ||
5 | #include "../util/env.h" | 5 | #include "../util/env.h" |
6 | 6 | ||
7 | extern const char *objdump_path; | 7 | int perf_env__lookup_objdump(struct perf_env *env, const char **path); |
8 | |||
9 | int perf_env__lookup_objdump(struct perf_env *env); | ||
10 | 8 | ||
11 | #endif /* ARCH_PERF_COMMON_H */ | 9 | #endif /* ARCH_PERF_COMMON_H */ |
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 2339ae719e1d..5eb22cc56363 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -388,8 +388,9 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
388 | goto out; | 388 | goto out; |
389 | } | 389 | } |
390 | 390 | ||
391 | if (!objdump_path) { | 391 | if (!ann->opts.objdump_path) { |
392 | ret = perf_env__lookup_objdump(&session->header.env); | 392 | ret = perf_env__lookup_objdump(&session->header.env, |
393 | &ann->opts.objdump_path); | ||
393 | if (ret) | 394 | if (ret) |
394 | goto out; | 395 | goto out; |
395 | } | 396 | } |
@@ -521,7 +522,7 @@ int cmd_annotate(int argc, const char **argv) | |||
521 | "Display raw encoding of assembly instructions (default)"), | 522 | "Display raw encoding of assembly instructions (default)"), |
522 | OPT_STRING('M', "disassembler-style", &annotate.opts.disassembler_style, "disassembler style", | 523 | OPT_STRING('M', "disassembler-style", &annotate.opts.disassembler_style, "disassembler style", |
523 | "Specify disassembler style (e.g. -M intel for intel syntax)"), | 524 | "Specify disassembler style (e.g. -M intel for intel syntax)"), |
524 | OPT_STRING(0, "objdump", &objdump_path, "path", | 525 | OPT_STRING(0, "objdump", &annotate.opts.objdump_path, "path", |
525 | "objdump binary to use for disassembly and annotations"), | 526 | "objdump binary to use for disassembly and annotations"), |
526 | OPT_BOOLEAN(0, "group", &symbol_conf.event_group, | 527 | OPT_BOOLEAN(0, "group", &symbol_conf.event_group, |
527 | "Show event group information together"), | 528 | "Show event group information together"), |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 14b516a3a0de..bc133e7a7ac2 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -1094,7 +1094,7 @@ int cmd_report(int argc, const char **argv) | |||
1094 | parse_branch_mode), | 1094 | parse_branch_mode), |
1095 | OPT_BOOLEAN(0, "branch-history", &branch_call_mode, | 1095 | OPT_BOOLEAN(0, "branch-history", &branch_call_mode, |
1096 | "add last branch records to call history"), | 1096 | "add last branch records to call history"), |
1097 | OPT_STRING(0, "objdump", &objdump_path, "path", | 1097 | OPT_STRING(0, "objdump", &report.annotation_opts.objdump_path, "path", |
1098 | "objdump binary to use for disassembly and annotations"), | 1098 | "objdump binary to use for disassembly and annotations"), |
1099 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, | 1099 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, |
1100 | "Disable symbol demangling"), | 1100 | "Disable symbol demangling"), |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index bd60a631a481..ffdc2769ff9f 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -1077,8 +1077,9 @@ static int __cmd_top(struct perf_top *top) | |||
1077 | if (top->session == NULL) | 1077 | if (top->session == NULL) |
1078 | return -1; | 1078 | return -1; |
1079 | 1079 | ||
1080 | if (!objdump_path) { | 1080 | if (!top->annotation_opts.objdump_path) { |
1081 | ret = perf_env__lookup_objdump(&top->session->header.env); | 1081 | ret = perf_env__lookup_objdump(&top->session->header.env, |
1082 | &top->annotation_opts.objdump_path); | ||
1082 | if (ret) | 1083 | if (ret) |
1083 | goto out_delete; | 1084 | goto out_delete; |
1084 | } | 1085 | } |
@@ -1347,7 +1348,7 @@ int cmd_top(int argc, const char **argv) | |||
1347 | "Display raw encoding of assembly instructions (default)"), | 1348 | "Display raw encoding of assembly instructions (default)"), |
1348 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, | 1349 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, |
1349 | "Enable kernel symbol demangling"), | 1350 | "Enable kernel symbol demangling"), |
1350 | OPT_STRING(0, "objdump", &objdump_path, "path", | 1351 | OPT_STRING(0, "objdump", &top.annotation_opts.objdump_path, "path", |
1351 | "objdump binary to use for disassembly and annotations"), | 1352 | "objdump binary to use for disassembly and annotations"), |
1352 | OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style", | 1353 | OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style", |
1353 | "Specify disassembler style (e.g. -M intel for intel syntax)"), | 1354 | "Specify disassembler style (e.g. -M intel for intel syntax)"), |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 3af1b74608ab..22054107f1af 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -2338,7 +2338,8 @@ do_annotate(struct hist_browser *browser, struct popup_action *act) | |||
2338 | struct hist_entry *he; | 2338 | struct hist_entry *he; |
2339 | int err; | 2339 | int err; |
2340 | 2340 | ||
2341 | if (!objdump_path && perf_env__lookup_objdump(browser->env)) | 2341 | if (!browser->annotation_opts->objdump_path && |
2342 | perf_env__lookup_objdump(browser->env, &browser->annotation_opts->objdump_path)) | ||
2342 | return 0; | 2343 | return 0; |
2343 | 2344 | ||
2344 | notes = symbol__annotation(act->ms.sym); | 2345 | notes = symbol__annotation(act->ms.sym); |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index a90777717b60..2baa22933b0e 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -51,7 +51,6 @@ struct annotation_options annotation__default_options = { | |||
51 | .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, | 51 | .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, |
52 | }; | 52 | }; |
53 | 53 | ||
54 | const char *objdump_path; | ||
55 | static regex_t file_lineno; | 54 | static regex_t file_lineno; |
56 | 55 | ||
57 | static struct ins_ops *ins__find(struct arch *arch, const char *name); | 56 | static struct ins_ops *ins__find(struct arch *arch, const char *name); |
@@ -1657,7 +1656,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) | |||
1657 | "%s %s%s --start-address=0x%016" PRIx64 | 1656 | "%s %s%s --start-address=0x%016" PRIx64 |
1658 | " --stop-address=0x%016" PRIx64 | 1657 | " --stop-address=0x%016" PRIx64 |
1659 | " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand", | 1658 | " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand", |
1660 | objdump_path ? objdump_path : "objdump", | 1659 | opts->objdump_path ?: "objdump", |
1661 | opts->disassembler_style ? "-M " : "", | 1660 | opts->disassembler_style ? "-M " : "", |
1662 | opts->disassembler_style ?: "", | 1661 | opts->disassembler_style ?: "", |
1663 | map__rip_2objdump(map, sym->start), | 1662 | map__rip_2objdump(map, sym->start), |
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 6e6e2a571928..a4c0d91907e6 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -80,6 +80,7 @@ struct annotation_options { | |||
80 | int min_pcnt; | 80 | int min_pcnt; |
81 | int max_lines; | 81 | int max_lines; |
82 | int context; | 82 | int context; |
83 | const char *objdump_path; | ||
83 | const char *disassembler_style; | 84 | const char *disassembler_style; |
84 | }; | 85 | }; |
85 | 86 | ||