From 2dd2dab1ff98c61b2cae2e1734047cb0c283b5c8 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 25 Oct 2018 21:35:59 +0000 Subject: [PATCH] llvm-dwarfdump: loclists: Don't expect an (albeit empty) expression for LLE_base_address llvm-svn: 345320 --- lib/DebugInfo/DWARF/DWARFDebugLoc.cpp | 14 ++++++++------ test/DebugInfo/X86/dwarfdump-debug-loclists.test | 3 +-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp b/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp index 044a0243360..9146b457a5d 100644 --- a/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp +++ b/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp @@ -183,12 +183,14 @@ DWARFDebugLoclists::parseOneLocationList(DataExtractor Data, unsigned *Offset, 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)); } diff --git a/test/DebugInfo/X86/dwarfdump-debug-loclists.test b/test/DebugInfo/X86/dwarfdump-debug-loclists.test index e5f7fb0c1c1..669607fe557 100644 --- a/test/DebugInfo/X86/dwarfdump-debug-loclists.test +++ b/test/DebugInfo/X86/dwarfdump-debug-loclists.test @@ -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