[llvm-dev] Concatenating DWARF location expressions

Adrian Prantl via llvm-dev
Fri, 25 Jan 2019 20:47:49 -0000

> On Jan 25, 2019, at 10:31 AM, Markus Lavin <markus.lavin at
ericsson.com> wrote:
>
>> From: aprantl at apple.com <aprantl at apple.com>
>
>> Since it sounds like the problem is only with implicit descriptions,
would a rule
>> such as "if the expression has a DW_OP_stack_value, add an extra
>> DW_OP_deref" work for the PrologueEpilgueInserter or do we need
>> something more principled?
>
> Right, that could very well be sufficient for this particular case so I
will experiment with that. In general though and for the future it seems that it
would be of benefit to have additional metadata in the expressions indicating if
they describe e.g. a memory address, a value or whatnot.

That is more a property of what the expression is bound to (via a llvm.dbg.*
intrinsic, a DIGlobalVariablesExpression) than of the DIExpression. The only
thing we can say by inspecting the DIExpression alone is when it would have to
be lowered into an implicit location description (because of the
DW_OP_stack_value). We could easily add a `bool isImplicit()` member to
DIExpression that returns true if a DW_OP_stack_value is present.

Do you think it makes sense to distinguish between memory and register addresses
at the IR metadata level already?

> This would perhaps allow us to implement a simple debug expression
verifier.

What kind of properties would you like to verify?

-- adrian