summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-10-09 21:25:28 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-10-09 21:25:28 +0000
commit411497c6c714d43f30c6942ca0e98ecc0e800744 (patch)
tree6d26285a6b6ba61b09de045f956ebebe8133eb71 /llvm/lib/DebugInfo/DWARF
parent745e57c5939e289789b9171e118b09c3c59c572a (diff)
downloadbcm5719-llvm-411497c6c714d43f30c6942ca0e98ecc0e800744.tar.gz
bcm5719-llvm-411497c6c714d43f30c6942ca0e98ecc0e800744.zip
llvm-dwarfdump: Support multiple debug_loclists contributions
Also fixing the incorrect "offset" field being computed/printed for each location list. llvm-svn: 374232
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp28
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp5
2 files changed, 18 insertions, 15 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 770f129753e..ed6c2b93ce6 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -290,20 +290,24 @@ static void dumpLoclistsSection(raw_ostream &OS, DIDumpOptions DumpOpts,
const MCRegisterInfo *MRI,
Optional<uint64_t> DumpOffset) {
uint64_t Offset = 0;
- DWARFDebugLoclists Loclists;
- DWARFListTableHeader Header(".debug_loclists", "locations");
- if (Error E = Header.extract(Data, &Offset)) {
- WithColor::error() << toString(std::move(E)) << '\n';
- return;
- }
+ while (Data.isValidOffset(Offset)) {
+ DWARFListTableHeader Header(".debug_loclists", "locations");
+ if (Error E = Header.extract(Data, &Offset)) {
+ WithColor::error() << toString(std::move(E)) << '\n';
+ return;
+ }
- Header.dump(OS, DumpOpts);
- DataExtractor LocData(Data.getData().drop_front(Offset),
- Data.isLittleEndian(), Header.getAddrSize());
+ Header.dump(OS, DumpOpts);
+ DataExtractor LocData(Data.getData(),
+ Data.isLittleEndian(), Header.getAddrSize());
- Loclists.parse(LocData, Header.getVersion());
- Loclists.dump(OS, 0, MRI, DumpOffset);
+ DWARFDebugLoclists Loclists;
+ uint64_t EndOffset = Header.length() + Header.getHeaderOffset();
+ Loclists.parse(LocData, Offset, EndOffset, Header.getVersion());
+ Loclists.dump(OS, 0, MRI, DumpOffset);
+ Offset = EndOffset;
+ }
}
void DWARFContext::dump(
@@ -733,7 +737,7 @@ const DWARFDebugLoclists *DWARFContext::getDebugLocDWO() {
// Use version 4. DWO does not support the DWARF v5 .debug_loclists yet and
// that means we are parsing the new style .debug_loc (pre-standatized version
// of the .debug_loclists).
- LocDWO->parse(LocData, 4 /* Version */);
+ LocDWO->parse(LocData, 0, LocData.getData().size(), 4 /* Version */);
return LocDWO.get();
}
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
index a243ed3a80b..bdafafc7a37 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
@@ -187,12 +187,11 @@ DWARFDebugLoclists::parseOneLocationList(const DataExtractor &Data,
return LL;
}
-void DWARFDebugLoclists::parse(DataExtractor data, unsigned Version) {
+void DWARFDebugLoclists::parse(DataExtractor data, uint64_t Offset, uint64_t EndOffset, uint16_t Version) {
IsLittleEndian = data.isLittleEndian();
AddressSize = data.getAddressSize();
- uint64_t Offset = 0;
- while (Offset < data.getData().size()) {
+ while (Offset < EndOffset) {
if (auto LL = parseOneLocationList(data, &Offset, Version))
Locations.push_back(std::move(*LL));
else {
OpenPOWER on IntegriCloud