History

perf script: Fix script_fetch_insn for more than just x86

The script_fetch_insn code was only supported on natively running x86. Implement a crude elf_machine_max_instruction_length function and use to give an instruction length on more than just x86. Use the ELF machine to determine the length to use to support cross-architecture development.

Ian Rogers committed 9 months ago

Commit 7ce6dfc1 parent 0a6fb6611 files · +87 −78Browse files

Showing the changes to tools/perf/scripts/python (1 of 11 files). Show all

Unified · Split

tools/perf/scripts/python/Perf-Trace-Util/Context.c+1−1
@@ -93,7 +93,7 @@ static PyObject *perf_sample_insn(PyObject *obj, PyObject *args) · 92 unmodified lines
9393 if (c->sample->ip && !c->sample->insn_len && thread__maps(c->al->thread)) {
9494 struct machine *machine = maps__machine(thread__maps(c->al->thread));
9595
96− script_fetch_insn(c->sample, c->al->thread, machine, /*native_arch=*/true);
96+ perf_sample__fetch_insn(c->sample, c->al->thread, machine);
9797 }
9898 if (!c->sample->insn_len)
9999 Py_RETURN_NONE; /* N.B. This is a return statement */