[PATCH] DebugInfo: SROA on references should result in undef dbg.values

David Blaikie dblaikie at gmail.com
Tue Aug 12 09:12:37 PDT 2014


On Tue, Aug 12, 2014 at 9:03 AM, Adrian Prantl <aprantl at apple.com> wrote:
> I've been wishing for a DW_OP_addr_of before. But, I was just browsing through the DWARF spec and came across:
>
> DW_OP_stack_value
> The DW_OP_stack_value operation specifies that the object does not exist in memory but its value is nonetheless known and is at the top of the DWARF expression stack. In this form of location description, the DWARF expression represents the actual value of the object, rather than its location. The DW_OP_stack_value operation terminates the expression.
>
> This *could* be interpreted as the DW_OP_addr_of we're looking for.

Unforunately, I suspect it isn't:

Imagine we have an int variable - usually the DW_AT_location describes
the location of that int in memory ("DW_OP_fbreg offset" for example).
But if we constant fold the variable away we can still describe its
value using DW_OP_stack_value (DW_OP_constu 42, DW_OP_stack_value).

But if we consider an int pointer (or int reference), its value is an
address of another variable. So when we think about its value, we are
thinking about an address. Since the referent doesn't exist in memory
(it's been constant folded away) - there's no address we can describe
(even as a constant) where the referent can be found :(

That's at least my understanding, unfortunately :/

- David

> I set aside some time this week to experiment with moving the complex expression part of DIVariable into an additional operand of dbg.value. My main motivation is reducing the memory footprint of OpPiece exprs. This will be a massive refactoring, but I'll keep you updated on how that goes.

Sounds good to me - let me know if there's anything I can do to help!

- David

>
> http://reviews.llvm.org/D3714
>
>




More information about the llvm-commits mailing list