1 #include <elfutils/libdwfl.h> 2 #include "../../util/unwind-libdw.h" 3 #include "../../util/perf_regs.h" 4 5 bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg) 6 { 7 struct unwind_info *ui = arg; 8 struct regs_dump *user_regs = &ui->sample->user_regs; 9 Dwarf_Word dwarf_regs[PERF_REG_ARM_MAX]; 10 11 #define REG(r) ({ \ 12 Dwarf_Word val = 0; \ 13 perf_reg_value(&val, user_regs, PERF_REG_ARM_##r); \ 14 val; \ 15 }) 16 17 dwarf_regs[0] = REG(R0); 18 dwarf_regs[1] = REG(R1); 19 dwarf_regs[2] = REG(R2); 20 dwarf_regs[3] = REG(R3); 21 dwarf_regs[4] = REG(R4); 22 dwarf_regs[5] = REG(R5); 23 dwarf_regs[6] = REG(R6); 24 dwarf_regs[7] = REG(R7); 25 dwarf_regs[8] = REG(R8); 26 dwarf_regs[9] = REG(R9); 27 dwarf_regs[10] = REG(R10); 28 dwarf_regs[11] = REG(FP); 29 dwarf_regs[12] = REG(IP); 30 dwarf_regs[13] = REG(SP); 31 dwarf_regs[14] = REG(LR); 32 dwarf_regs[15] = REG(PC); 33 34 return dwfl_thread_state_registers(thread, 0, PERF_REG_ARM_MAX, 35 dwarf_regs); 36 } 37