Skip to content

Commit f178fd2

Browse files
committed
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>
1 parent cd0cccb commit f178fd2

8 files changed

Lines changed: 16 additions & 15 deletions

File tree

‎tools/perf/arch/common.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static int perf_env__lookup_binutils_path(struct perf_env *env,
189189
return -1;
190190
}
191191

192-
int perf_env__lookup_objdump(struct perf_env *env)
192+
int perf_env__lookup_objdump(struct perf_env *env, const char **path)
193193
{
194194
/*
195195
* 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)
198198
if (env->arch == NULL)
199199
return 0;
200200

201-
return perf_env__lookup_binutils_path(env, "objdump", &objdump_path);
201+
return perf_env__lookup_binutils_path(env, "objdump", path);
202202
}

‎tools/perf/arch/common.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
#include "../util/env.h"
66

7-
extern const char *objdump_path;
8-
9-
int perf_env__lookup_objdump(struct perf_env *env);
7+
int perf_env__lookup_objdump(struct perf_env *env, const char **path);
108

119
#endif /* ARCH_PERF_COMMON_H */

‎tools/perf/builtin-annotate.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,9 @@ static int __cmd_annotate(struct perf_annotate *ann)
388388
goto out;
389389
}
390390

391-
if (!objdump_path) {
392-
ret = perf_env__lookup_objdump(&session->header.env);
391+
if (!ann->opts.objdump_path) {
392+
ret = perf_env__lookup_objdump(&session->header.env,
393+
&ann->opts.objdump_path);
393394
if (ret)
394395
goto out;
395396
}
@@ -521,7 +522,7 @@ int cmd_annotate(int argc, const char **argv)
521522
"Display raw encoding of assembly instructions (default)"),
522523
OPT_STRING('M', "disassembler-style", &annotate.opts.disassembler_style, "disassembler style",
523524
"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",
525526
"objdump binary to use for disassembly and annotations"),
526527
OPT_BOOLEAN(0, "group", &symbol_conf.event_group,
527528
"Show event group information together"),

‎tools/perf/builtin-report.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ int cmd_report(int argc, const char **argv)
10941094
parse_branch_mode),
10951095
OPT_BOOLEAN(0, "branch-history", &branch_call_mode,
10961096
"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",
10981098
"objdump binary to use for disassembly and annotations"),
10991099
OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
11001100
"Disable symbol demangling"),

‎tools/perf/builtin-top.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,8 +1077,9 @@ static int __cmd_top(struct perf_top *top)
10771077
if (top->session == NULL)
10781078
return -1;
10791079

1080-
if (!objdump_path) {
1081-
ret = perf_env__lookup_objdump(&top->session->header.env);
1080+
if (!top->annotation_opts.objdump_path) {
1081+
ret = perf_env__lookup_objdump(&top->session->header.env,
1082+
&top->annotation_opts.objdump_path);
10821083
if (ret)
10831084
goto out_delete;
10841085
}
@@ -1347,7 +1348,7 @@ int cmd_top(int argc, const char **argv)
13471348
"Display raw encoding of assembly instructions (default)"),
13481349
OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
13491350
"Enable kernel symbol demangling"),
1350-
OPT_STRING(0, "objdump", &objdump_path, "path",
1351+
OPT_STRING(0, "objdump", &top.annotation_opts.objdump_path, "path",
13511352
"objdump binary to use for disassembly and annotations"),
13521353
OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style",
13531354
"Specify disassembler style (e.g. -M intel for intel syntax)"),

‎tools/perf/ui/browsers/hists.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2338,7 +2338,8 @@ do_annotate(struct hist_browser *browser, struct popup_action *act)
23382338
struct hist_entry *he;
23392339
int err;
23402340

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))
23422343
return 0;
23432344

23442345
notes = symbol__annotation(act->ms.sym);

‎tools/perf/util/annotate.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ struct annotation_options annotation__default_options = {
5151
.offset_level = ANNOTATION__OFFSET_JUMP_TARGETS,
5252
};
5353

54-
const char *objdump_path;
5554
static regex_t file_lineno;
5655

5756
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)
16571656
"%s %s%s --start-address=0x%016" PRIx64
16581657
" --stop-address=0x%016" PRIx64
16591658
" -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
1660-
objdump_path ? objdump_path : "objdump",
1659+
opts->objdump_path ?: "objdump",
16611660
opts->disassembler_style ? "-M " : "",
16621661
opts->disassembler_style ?: "",
16631662
map__rip_2objdump(map, sym->start),

‎tools/perf/util/annotate.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct annotation_options {
8080
int min_pcnt;
8181
int max_lines;
8282
int context;
83+
const char *objdump_path;
8384
const char *disassembler_style;
8485
};
8586

0 commit comments

Comments
 (0)