[RFC] add offset support to DWARF2_FRAME_REG_CFA

Christophe LYON
2005-11-22T09:36:55Z

Hi all,

Following a discussion we had back in july, I would like to submit the
following small patch. It enables to describe that SP = CFA + offset,
rather than only SP = CFA.

It can be used in conjonction with a customized xxx_dwarf2_frame_init_reg().

Regards,

Christophe.

2005-11-22 Christophe Lyon <christophe.lyon@st.com>

* dwarf2-frame.c: (dwarf2_frame_default_init_reg): Ensure
default offset between SP and CFA is 0.
(dwarf2_frame_prev_register): add offset to CFA in order to
compute SP

Index: dwarf2-frame.c
===================================================================
--- dwarf2-frame.c (revision 96)
+++ dwarf2-frame.c (working copy)
@@ -539,7 +542,10 @@
if (regnum == PC_REGNUM)
reg->how = DWARF2_FRAME_REG_RA;
else if (regnum == SP_REGNUM)
- reg->how = DWARF2_FRAME_REG_CFA;
+ {
+ reg->how = DWARF2_FRAME_REG_CFA;
+ reg->loc.offset = 0;
+ }
}

/* Return a default for the architecture-specific operations. */
@@ -914,7 +920,8 @@
if (valuep)
{
/* Store the value. */
- store_typed_address (valuep, builtin_type_void_data_ptr,
cache->cfa);
+ store_typed_address (valuep, builtin_type_void_data_ptr,
+ cache->cfa + cache->reg[regnum].loc.offset);
}
break;