||Describing Unsaved Stack Pointers
||Duplicate of 030812.2
Consider a function with no frame pointer, where the CFA is defined as
$sp + offset. The offset is constant at any point in the function, so
there's no real reason to save the old stack pointer on the stack. So,
how do we recover it? There are no rules for describing this; both
offset and expression rules describe an address in memory where the old
value is stored, and it isn't stored anywhere.
What I'm using right now is quite hideous: I check the CIE for the
initial CFA. If that CFA is defined in terms of a register plus
offset, and I have no information on how to unwind that register, then
I record that the unwound value of that register is the CFA. Note that
we have to ignore the offset; this makes unportable assumptions about
the way the compiler (GCC in this case) generates CIEs. We ignore the
offset because in this case, it's the difference between the stack
pointer at call time and the stack pointer when we arrive in the called
In other words, I'm assuming that the initial definition of the CFA is
in some terms of a stack pointer, and that the CFA is the unwound value
of the register being used. This is fragile, to say the least.
It seems to me that the best solution would be a new rule, either
val_expression(E) or the simpler val_cfa_offset(N). Then the unwind
information can accurately describe the stack pointer.
none at this time.