[PATCH] D76164: Fix an assertion error when emitting call site info that combines two DW_OP_stack_values.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 15:07:57 PDT 2020


aprantl created this revision.
aprantl added reviewers: djtodoro, vsk, thakis.
aprantl added a project: debug-info.
Herald added a subscriber: hiraditya.
aprantl added a comment.

I believe that that's the same assertion failure that @thakis found in Chromium today.


When compiling

  struct S {
    float w;
  };
  void f(long w, long b);
  void g(struct S s) {
    int w = s.w;
    f(w, w*4);
  }

I get `Assertion failed: ((!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid")`.

That's because we combine two epxressions that both end in DW_OP_stack_value:

  (lldb) p Expr->dump()
  !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
  (lldb) p Param.Expr->dump()
  !DIExpression(DW_OP_constu, 4, DW_OP_mul, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
  (lldb) p CombinedExpr->isValid()
  (bool) $0 = false
  (lldb) p CombinedExpr->dump()
  !DIExpression(4097, 32, 5, 4097, 64, 5, 16, 4, 30, 4097, 32, 5, 4097, 64, 5, 159, 159)

I believe that in this particular case combining two stack values is safe, but I didn't want to sink the special handlingi into DIExpression::append() because I do want everyone to think about what they are doing.

      

rdar://problem/60383095


https://reviews.llvm.org/D76164

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/test/DebugInfo/MIR/X86/callsite-stack-value.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76164.250308.patch
Type: text/x-patch
Size: 5447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200313/2620db56/attachment.bin>


More information about the llvm-commits mailing list