Markus Lavin via llvm-dev
2019-Jan-25 18:31 UTC
[llvm-dev] Concatenating DWARF location expressions
> 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. This would perhaps allow us to implement a simple debug expression verifier. Thanks! -Markus
Adrian Prantl via llvm-dev
2019-Jan-25 20:47 UTC
[llvm-dev] Concatenating DWARF location expressions
> 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
Markus Lavin via llvm-dev
2019-Jan-28 14:52 UTC
[llvm-dev] Concatenating DWARF location expressions
> Do you think it makes sense to distinguish between memory and register > addresses at the IR metadata level already?I think it would make sense to be a bit stricter with types in debug expressions in general and if there is, as an example, an expression that derefs something then clearly keep track of the type of the address and the type of the value behind that address. I am sure that most of the time it is not really necessary and the type can be picked up by looking at the intrinsic it is bound to etc but I can also imagine that there are cases where this would not be sufficient.> What kind of properties would you like to verify?E.g. that one doesn't concatenate expressions with incompatible types or that one does not insert a DW_OP_deref(_size) of wrong size. My exposure to the debug framework is quite limited so I don’t really know for sure, it is mostly opinions based on my gut feeling 😊 -Markus