[PATCH] D78931: [libunwind][RISCV] Track PC separately from RA

Amanieu d'Antras via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 10:12:04 PDT 2020


Amanieu added a comment.

The RISC-V unwinding spec is pretty bare: https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#dwarf

I had a look at libgcc, it tracks the PC separately from the other dwarf registers. The value modified by _Unwind_SetIP is separate from any of the values controlled by _Unwind_SetGR.

The way I am currently getting backtraces from a signal handler is to use unw_set_reg to initialize all the register from my sigcontext, and then using unw_set_reg(UNW_REG_IP) to set the PC. This only works if the PC is tracked separately from the return address register. This works fine on other targets (ARM, ARM64) where this is already the case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78931/new/

https://reviews.llvm.org/D78931





More information about the llvm-commits mailing list