[RFC,3/5] gdb/dwarf2: Add dwarf2_frame_reg_rule for GDB register number
Commit Message
Arm M-profile security extension requires the dwarf2 unwinder to
copy a value from a mode specific stack pointer to the general sp.
We can achive this using DWARF2_FRAME_REG_SAVED_REG but
it is complicated as the DWARF base register number has to be filled
to reg->loc.reg (and dwarf2_frame_prev_register() in turn converts
it back to the GDB register number).
To avoid the useless conversion forth and back introduce a new item
in enum dwarf2_frame_reg_rule for GDB internal use.
DWARF2_FRAME_REG_SAVED_GDB_REG copies the value from a register
indexed by GDB number.
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
---
gdb/dwarf2/frame.c | 4 ++++
gdb/dwarf2/frame.h | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
@@ -1166,6 +1166,10 @@ struct dwarf2_frame_cache
(gdbarch, cache->reg[regnum].loc.reg);
return frame_unwind_got_register (this_frame, regnum, realnum);
+ case DWARF2_FRAME_REG_SAVED_GDB_REG:
+ realnum = cache->reg[regnum].loc.reg;
+ return frame_unwind_got_register (this_frame, regnum, realnum);
+
case DWARF2_FRAME_REG_SAVED_EXP:
addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
cache->reg[regnum].loc.exp.len,
@@ -61,7 +61,10 @@ enum dwarf2_frame_reg_rule
DWARF2_FRAME_REG_RA, /* Return Address. */
DWARF2_FRAME_REG_RA_OFFSET, /* Return Address with offset. */
DWARF2_FRAME_REG_CFA, /* Call Frame Address. */
- DWARF2_FRAME_REG_CFA_OFFSET /* Call Frame Address with offset. */
+ DWARF2_FRAME_REG_CFA_OFFSET, /* Call Frame Address with offset. */
+ DWARF2_FRAME_REG_SAVED_GDB_REG
+ /* As DWARF2_FRAME_REG_SAVED_REG, loc.reg contains GDB register number,
+ not DWARF register number. */
};
/* Register state. */