[PATCH] D133926: [DebugInfo] Allow non-stack_value variadic expressions and use in DBG_INSTR_REF
Felipe de Azevedo Piovezan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 10:26:10 PDT 2023
fdeazeve added a comment.
> I'll take a quick look - off the top of my head, there should be an interface to treat `!DIExpression(DW_OP_LLVM_arg, 0, <ops>)` identically to `!DIExpression(<ops>)`, and if it either doesn't exist or is only applicable to specific cases then it should be created/generalized.
Thank you!
>> Also note that the `CodeGen/AsmPrinter/DwarfExpression.cpp` code for `DwarfExpression::addExpression` doesn't expect an EntryValue as anything but the first operand of the op list.
I think the problem here is that, inside `DwarfCompileUnit::constructVariableDIEImpl`, we are now taking the *variadic path* which ends up calling addExpression.
More concretely, inside that function we have:
if (auto *DVal = DV.getValueLoc()) {
if (!DVal->isVariadic()) {
We are taking the else path of that second if, i.e., we are treating things as variadic where we before we wouldn't?
(lldb) p DV.getValueLoc()->isVariadic()
(bool) $2 = true
(lldb) p DV.getValueLoc()->dump()
Loc = { reg=134 } !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 16, DW_OP_deref, DW_OP_deref)
Because of this, we end calling `DwarfExpression::addExpression`, which crashes for that example because it doesn't expect an entry value.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133926/new/
https://reviews.llvm.org/D133926
More information about the llvm-commits
mailing list