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

llvm-svn: 345320
This commit is contained in:
David Blaikie 2018-10-25 21:35:59 +00:00
parent 38dfbc5f13
commit 2dd2dab1ff
2 changed files with 9 additions and 8 deletions

View File

@ -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));
}

View File

@ -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