mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
perf capstone: Remove open_capstone_handle
open_capstone_handle is similar to capstone_init and used only by symbol__disassemble_capstone. symbol__disassemble_capstone_powerpc already uses capstone_init, transition symbol__disassemble_capstone and eliminate open_capstone_handle. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Ghiti <alexghiti@rivosinc.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.ibm.com> Cc: Bill Wendling <morbo@google.com> Cc: Charlie Jenkins <charlie@rivosinc.com> Cc: Collin Funk <collin.funk1@gmail.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Dr. David Alan Gilbert <linux@treblig.org> Cc: Eric Biggers <ebiggers@kernel.org> Cc: Haibo Xu <haibo1.xu@intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Justin Stitt <justinstitt@google.com> Cc: Li Huafei <lihuafei1@huawei.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
95931d9a59
commit
2836ed1748
|
|
@ -137,33 +137,6 @@ ssize_t capstone__fprintf_insn_asm(struct machine *machine __maybe_unused,
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBCAPSTONE_SUPPORT
|
||||
static int open_capstone_handle(struct annotate_args *args, bool is_64bit, csh *handle)
|
||||
{
|
||||
struct annotation_options *opt = args->options;
|
||||
cs_mode mode = is_64bit ? CS_MODE_64 : CS_MODE_32;
|
||||
|
||||
/* TODO: support more architectures */
|
||||
if (!arch__is(args->arch, "x86"))
|
||||
return -1;
|
||||
|
||||
if (cs_open(CS_ARCH_X86, mode, handle) != CS_ERR_OK)
|
||||
return -1;
|
||||
|
||||
if (!opt->disassembler_style ||
|
||||
!strcmp(opt->disassembler_style, "att"))
|
||||
cs_option(*handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT);
|
||||
|
||||
/*
|
||||
* Resolving address operands to symbols is implemented
|
||||
* on x86 by investigating instruction details.
|
||||
*/
|
||||
cs_option(*handle, CS_OPT_DETAIL, CS_OPT_ON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBCAPSTONE_SUPPORT
|
||||
static void print_capstone_detail(cs_insn *insn, char *buf, size_t len,
|
||||
struct annotate_args *args, u64 addr)
|
||||
|
|
@ -309,6 +282,7 @@ int symbol__disassemble_capstone(const char *filename __maybe_unused,
|
|||
cs_insn *insn = NULL;
|
||||
char disasm_buf[512];
|
||||
struct disasm_line *dl;
|
||||
bool disassembler_style = false;
|
||||
|
||||
if (args->options->objdump_path)
|
||||
return -1;
|
||||
|
|
@ -333,7 +307,11 @@ int symbol__disassemble_capstone(const char *filename __maybe_unused,
|
|||
|
||||
annotation_line__add(&dl->al, ¬es->src->source);
|
||||
|
||||
if (open_capstone_handle(args, is_64bit, &handle) < 0)
|
||||
if (!args->options->disassembler_style ||
|
||||
!strcmp(args->options->disassembler_style, "att"))
|
||||
disassembler_style = true;
|
||||
|
||||
if (capstone_init(maps__machine(args->ms.maps), &handle, is_64bit, disassembler_style) < 0)
|
||||
goto err;
|
||||
|
||||
needs_cs_close = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user