diff options
| author | Ian Rogers <irogers@google.com> | 2026-06-02 08:25:02 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-06-03 16:46:07 -0300 |
| commit | c4e16f0543ff5df76e221141ab8e7430792bf841 (patch) | |
| tree | b513034468341f0e7be7bbccb850e54506b13164 | |
| parent | 12c4737f55f2fb4a0062258336435c69847a426c (diff) | |
| download | linux-c4e16f0543ff5df76e221141ab8e7430792bf841.tar.gz linux-c4e16f0543ff5df76e221141ab8e7430792bf841.zip | |
perf print_insn: Use e_machine for fallback IP length check
Avoid string comparisons with perf_env arch, switch to using the more
precise ELF machine.
Sort header files and fix missing definitions.
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Honglei Wang <jameshongleiwang@126.com>
Cc: Jan Polensky <japo@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/perf/util/print_insn.c | 23 | ||||
| -rw-r--r-- | tools/perf/util/print_insn.h | 2 |
2 files changed, 16 insertions, 9 deletions
diff --git a/tools/perf/util/print_insn.c b/tools/perf/util/print_insn.c index 02e6fbb8ca04..4068436f26ea 100644 --- a/tools/perf/util/print_insn.c +++ b/tools/perf/util/print_insn.c @@ -4,19 +4,24 @@ * * Author(s): Changbin Du <changbin.du@huawei.com> */ +#include "print_insn.h" + #include <inttypes.h> -#include <string.h> #include <stdbool.h> +#include <string.h> + +#include <dwarf-regs.h> + #include "capstone.h" #include "debug.h" +#include "dso.h" +#include "dump-insn.h" +#include "env.h" +#include "machine.h" +#include "map.h" #include "sample.h" #include "symbol.h" -#include "machine.h" #include "thread.h" -#include "print_insn.h" -#include "dump-insn.h" -#include "map.h" -#include "dso.h" size_t sample__fprintf_insn_raw(struct perf_sample *sample, FILE *fp) { @@ -33,13 +38,13 @@ size_t sample__fprintf_insn_raw(struct perf_sample *sample, FILE *fp) static bool is64bitip(struct machine *machine, struct addr_location *al) { const struct dso *dso = al->map ? map__dso(al->map) : NULL; + uint16_t e_machine; if (dso) return dso__is_64_bit(dso); - return machine__is(machine, "x86_64") || - machine__normalized_is(machine, "arm64") || - machine__normalized_is(machine, "s390"); + e_machine = perf_env__e_machine(machine->env, /*e_flags=*/NULL); + return e_machine == EM_X86_64 || e_machine == EM_AARCH64 || e_machine == EM_S390; } ssize_t fprintf_insn_asm(struct machine *machine, struct thread *thread, u8 cpumode, diff --git a/tools/perf/util/print_insn.h b/tools/perf/util/print_insn.h index a54f7e858e49..cefa5c5f246e 100644 --- a/tools/perf/util/print_insn.h +++ b/tools/perf/util/print_insn.h @@ -5,6 +5,8 @@ #include <stddef.h> #include <stdio.h> +#include <linux/types.h> + struct addr_location; struct machine; struct perf_insn; |
