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
93 if (c->sample->ip && !c->sample->insn_len && thread__maps(c->al->thread)) {93 if (c->sample->ip && !c->sample->insn_len && thread__maps(c->al->thread)) {
94 struct machine *machine = maps__machine(thread__maps(c->al->thread));94 struct machine *machine = maps__machine(thread__maps(c->al->thread));
95 95
96 script_fetch_insn(c->sample, c->al->thread, machine, /*native_arch=*/true);96 perf_sample__fetch_insn(c->sample, c->al->thread, machine);
97 }97 }
98 if (!c->sample->insn_len)98 if (!c->sample->insn_len)
99 Py_RETURN_NONE; /* N.B. This is a return statement */99 Py_RETURN_NONE; /* N.B. This is a return statement */