[llvm] r345320 - llvm-dwarfdump: loclists: Don't expect an (albeit empty) expression for LLE_base_address

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 25 14:35:59 PDT 2018


Author: dblaikie
Date: Thu Oct 25 14:35:59 2018
New Revision: 345320

URL: http://llvm.org/viewvc/llvm-project?rev=345320&view=rev
Log:
llvm-dwarfdump: loclists: Don't expect an (albeit empty) expression for LLE_base_address

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
    llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-loclists.test

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp?rev=345320&r1=345319&r2=345320&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp Thu Oct 25 14:35:59 2018
@@ -183,12 +183,14 @@ DWARFDebugLoclists::parseOneLocationList
       return None;
     }
 
-    unsigned Bytes = Data.getU16(Offset);
-    // A single location description describing the location of the object...
-    StringRef str = Data.getData().substr(*Offset, Bytes);
-    *Offset += Bytes;
-    E.Loc.resize(str.size());
-    std::copy(str.begin(), str.end(), E.Loc.begin());
+    if (Kind != dwarf::DW_LLE_base_address) {
+      unsigned Bytes = Data.getU16(Offset);
+      // A single location description describing the location of the object...
+      StringRef str = Data.getData().substr(*Offset, Bytes);
+      *Offset += Bytes;
+      E.Loc.resize(str.size());
+      std::copy(str.begin(), str.end(), E.Loc.begin());
+    }
 
     LL.Entries.push_back(std::move(E));
   }

Modified: llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-loclists.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-loclists.test?rev=345320&r1=345319&r2=345320&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-loclists.test (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-loclists.test Thu Oct 25 14:35:59 2018
@@ -9,7 +9,7 @@
 # CHECK-NEXT:    [0x0000000000000700, 0x0000000000000710): DW_OP_breg5 RDI+0
 
 # CHECK:      .debug_loclists contents:
-# CHECK-NEXT: 0x00000000: locations list header: length = 0x00000031, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
+# CHECK-NEXT: 0x00000000: locations list header: length = 0x0000002f, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
 # CHECK-NEXT: 0x00000000:
 # CHECK-NEXT:   [0x0000000000000000, 0x0000000000000010): DW_OP_breg5 RDI+0
 # CHECK-NEXT:   [0x0000000000000530, 0x0000000000000540): DW_OP_breg6 RBP-8, DW_OP_deref
@@ -43,7 +43,6 @@
   
   .byte  6                       # DW_LLE_base_address
   .quad  0x500                   # Some address
-  .short  0                      # Loc expr size = 0.
   
   .byte  4                       # DW_LLE_offset_pair
   .uleb128 0x30                  #   starting offset




More information about the llvm-commits mailing list