perf annotate: Move disassembler_style global to annotation_options
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 28 May 2018 14:50:21 +0000 (11:50 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 4 Jun 2018 13:28:53 +0000 (10:28 -0300)
Continuing to group annotation specific stuff into a struct.

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-p3cdhltj58jt0byjzg3g7obx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/util/annotate.c
tools/perf/util/annotate.h

index 2ca7172f0780f499ff8020efd8c86009dcc07372..3ee0635983648985a227616625d54e1495714e09 100644 (file)
@@ -519,7 +519,7 @@ int cmd_annotate(int argc, const char **argv)
                    "Interleave source code with assembly code (default)"),
        OPT_BOOLEAN(0, "asm-raw", &annotate.opts.show_asm_raw,
                    "Display raw encoding of assembly instructions (default)"),
-       OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
+       OPT_STRING('M', "disassembler-style", &annotate.opts.disassembler_style, "disassembler style",
                   "Specify disassembler style (e.g. -M intel for intel syntax)"),
        OPT_STRING(0, "objdump", &objdump_path, "path",
                   "objdump binary to use for disassembly and annotations"),
index bee6dbfbf11e1e34da964e92c014f1bf86e07079..c74f9a219ad17e830020a70142dd49ceb4907d9e 100644 (file)
@@ -1083,7 +1083,7 @@ int cmd_report(int argc, const char **argv)
                    "Interleave source code with assembly code (default)"),
        OPT_BOOLEAN(0, "asm-raw", &report.annotation_opts.show_asm_raw,
                    "Display raw encoding of assembly instructions (default)"),
-       OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
+       OPT_STRING('M', "disassembler-style", &report.annotation_opts.disassembler_style, "disassembler style",
                   "Specify disassembler style (e.g. -M intel for intel syntax)"),
        OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
                    "Show a column with the sum of periods"),
index e65e72c06a01791a5bf990d191615520f5f86801..739c158fb39e74a0e551b518bda67ad90b0aec53 100644 (file)
@@ -1348,7 +1348,7 @@ int cmd_top(int argc, const char **argv)
                    "Enable kernel symbol demangling"),
        OPT_STRING(0, "objdump", &objdump_path, "path",
                    "objdump binary to use for disassembly and annotations"),
-       OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
+       OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style",
                   "Specify disassembler style (e.g. -M intel for intel syntax)"),
        OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
        OPT_CALLBACK(0, "percent-limit", &top, "percent",
index ff8f4f474b221c83a466759892d82db828a74ff5..a90777717b6056792be2aa4004974240338d6b18 100644 (file)
@@ -51,7 +51,6 @@ struct annotation_options annotation__default_options = {
        .offset_level   = ANNOTATION__OFFSET_JUMP_TARGETS,
 };
 
-const char     *disassembler_style;
 const char     *objdump_path;
 static regex_t  file_lineno;
 
@@ -1659,8 +1658,8 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
                 " --stop-address=0x%016" PRIx64
                 " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
                 objdump_path ? objdump_path : "objdump",
-                disassembler_style ? "-M " : "",
-                disassembler_style ? disassembler_style : "",
+                opts->disassembler_style ? "-M " : "",
+                opts->disassembler_style ?: "",
                 map__rip_2objdump(map, sym->start),
                 map__rip_2objdump(map, sym->end),
                 opts->show_asm_raw ? "" : "--no-show-raw",
index 476ea2a25649d0425abe663208c2cb7728383fa9..71a734b86873888e4b374e67a7ac550bb70fa533 100644 (file)
@@ -80,6 +80,7 @@ struct annotation_options {
        int  min_pcnt;
        int  max_lines;
        int  context;
+       const char *disassembler_style;
 };
 
 enum {
@@ -368,8 +369,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
 }
 #endif
 
-extern const char      *disassembler_style;
-
 void annotation_config__init(void);
 
 #endif /* __PERF_ANNOTATE_H */