1 // SPDX-License-Identifier: GPL-2.0 2 #include "perf.h" 3 #include "archinsn.h" 4 #include "util/intel-pt-decoder/insn.h" 5 #include "machine.h" 6 #include "thread.h" 7 #include "symbol.h" 8 9 void arch_fetch_insn(struct perf_sample *sample, 10 struct thread *thread, 11 struct machine *machine) 12 { 13 struct insn insn; 14 int len; 15 bool is64bit = false; 16 17 if (!sample->ip) 18 return; 19 len = thread__memcpy(thread, machine, sample->insn, sample->ip, sizeof(sample->insn), &is64bit); 20 if (len <= 0) 21 return; 22 insn_init(&insn, sample->insn, len, is64bit); 23 insn_get_length(&insn); 24 if (insn_complete(&insn) && insn.length <= len) 25 sample->insn_len = insn.length; 26 } 27