[PATCH] D103502: Bug 41152 - [DebugInfo] Better dumping of empty location expression

Soham Dixit via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 20:59:52 PDT 2021


sohamdixit created this revision.
sohamdixit added reviewers: JDevlieghere, fixing bugs in llvm, probinson, jhenderson, fhahn, dblaikie, aprantl, jmorse, keith.walker.arm.
sohamdixit added a project: LLVM.
Herald added subscribers: pengfei, hiraditya.
sohamdixit requested review of this revision.
Herald added a subscriber: llvm-commits.

Fixing Bug41152

In https://reviews.llvm.org/D59518 it was observed that dumping a
location-list entry with an empty (zero-length) location expression doesn't
provide an explicit indication that the expression is in fact empty.  Here's
the snippet from llvm/test/MC/X86/dwarf-size-field-overflow.test:

+# CHECK-NEXT:      DW_AT_location   (0x00000000
+# CHECK-NEXT:           [0x0000000000000000,  0x0000000000000008): )
+# CHECK-NEXT:      DW_AT_name   ("self")

It would be nice to dump this in a less subtle way.

Please Check and let me Know

~/Soham


Repository:
  rL LLVM

https://reviews.llvm.org/D103502

Files:
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/test/MC/X86/dwarf-size-field-overflow.test


Index: llvm/test/MC/X86/dwarf-size-field-overflow.test
===================================================================
--- llvm/test/MC/X86/dwarf-size-field-overflow.test
+++ llvm/test/MC/X86/dwarf-size-field-overflow.test
@@ -6,7 +6,7 @@
 #
 # CHECK:       0x0000004d:       DW_TAG_formal_parameter
 # CHECK-NEXT:      DW_AT_location   (0x00000000
-# CHECK-NEXT:           [0x0000000000000000,  0x0000000000000008): )
+# CHECK-NEXT:           [0x0000000000000000,  0x0000000000000008): (empty))
 # CHECK-NEXT:      DW_AT_name   ("self")
 
 import sys
Index: llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -326,6 +326,9 @@
                             bool IsEH) const {
   uint32_t EntryValExprSize = 0;
   uint64_t EntryValStartOffset = 0;
+  if (Data.getData().size()==0){
+  	OS << "(empty)";
+  	}
   for (auto &Op : *this) {
     if (!Op.print(OS, DumpOpts, this, RegInfo, U, IsEH)) {
       uint64_t FailOffset = Op.getEndOffset();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103502.349167.patch
Type: text/x-patch
Size: 1110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210602/a03e2984/attachment.bin>


More information about the llvm-commits mailing list