[Dwarf-Discuss] .cfi_offset questions
eager at eagercon.com
Sat Mar 26 09:49:48 PDT 2016
On 03/19/2016 04:46 AM, Jonas H. wrote:
> I hope this is the right mailing list to ask this kind of question.
> I’m working on a edu/research compiler that has yet to be equipped with DWARF info. Unlike GCC/Clang/… it doesn’t have spill slots that are “constant” within a procedure, i.e. may procedure code like this:
> je B
> movl %edi, -8(%rbp) # EDI spill slot: -8
> jmp C
> movl %eax, -8(%rbp)
> movl %edi, -16(%rbp) # EDI spill slot: -16
> jmp C
> Is this supported by the DWARF .cfi_offset directives at all, and if so, how? Generally speaking, what’s the “scope”/“validity period”/“life span” of such directive?
I'm a bit unclear on your question.
CFI doesn't depend on spill slots being constant or, in fact, know anything
about spill slots. The CFI information tracks the location of register values,
and describes that at some PC value a register (eg, %edi) may be found at a
specified location, and at another PC value it may be found at a different location.
The "scope" (if there is such a thing) for a CFI directive is from the PC
where it is specified until some following PC which indicates the same register
may be found at a different location, or the end of the CFI.
> As an example, if C were to raise an exception and we’d use stack unwinding, how could the unwinder find the old/callee-saved EDI value?
Look up the value's location as described in the CFI for the PC value.
Michael Eager eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
More information about the Dwarf-Discuss