[Dwarf-discuss] Proposal: Describe prologue and epilogue ranges

Andrew Cagney andrew.cagney@gmail.com
Tue Mar 19 01:11:18 GMT 2024


On Mon, 18 Mar 2024 at 17:06, Robinson, Paul via Dwarf-discuss
<dwarf-discuss@lists.dwarfstd.org> wrote:

> A single location description (which can be either simple or composite
> location descriptions) has the lifetime of its closest containing scope.
> The case we care about here is when that scope is a subprogram, and
> therefore the lifetime spans the entire subprogram. Pedantically, that
> lifetime includes prologue and epilogue ranges.
>
> It is common practice for unoptimized code to allocate local variables
> to a stack frame, and use that stack location in the single location
> description. Because the stack frame is not necessarily in a valid state
> during prologue or epilogue code, in practice, debuggers typically assume
> that a single location description is not valid during a prologue or
> epilogue, although the DWARF spec does not explicitly say so (AFAIK).

Does this problem extend to instructions within a statement where a
simple location can also be invalid?  For instance, given:

    load r1 from i        # i++
    inc r1
 -> store r1 in i

an attempt to modify "i" would be trashed when the store instruction is executed

I'm not sure if this should be mentioned in the standard though.
Perhaps this is covered by "... and it does not move during its
lifetime."

> ## Overview
>
> A stopping point might occur during a prologue or epilogue range, which
> means single location descriptions for subprogram-scope objects might
> not be valid.
>
> - It would be good if the DWARF spec actually said single location
> descriptions were not necessarily valid in those ranges. This is simply
> codifying existing practice.


More information about the Dwarf-discuss mailing list