summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp6
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp6
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp11
3 files changed, 17 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
index 948972f8f13..6e550f2e9ec 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
@@ -18,8 +18,10 @@ using namespace llvm;
void DWARFCompileUnit::dump(raw_ostream &OS) {
OS << format("0x%08x", getOffset()) << ": Compile Unit:"
<< " length = " << format("0x%08x", getLength())
- << " version = " << format("0x%04x", getVersion())
- << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
+ << " version = " << format("0x%04x", getVersion());
+ if (getVersion() >= 5)
+ OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
+ OS << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
<< " addr_size = " << format("0x%02x", getAddressByteSize())
<< " (next unit at " << format("0x%08x", getNextUnitOffset())
<< ")\n";
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
index b468ba28c94..1faa23a3df8 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
@@ -37,8 +37,10 @@ void DWARFTypeUnit::dump(raw_ostream &OS, bool SummarizeTypes) {
OS << format("0x%08x", getOffset()) << ": Type Unit:"
<< " length = " << format("0x%08x", getLength())
- << " version = " << format("0x%04x", getVersion())
- << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
+ << " version = " << format("0x%04x", getVersion());
+ if (getVersion() >= 5)
+ OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
+ OS << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
<< " addr_size = " << format("0x%02x", getAddressByteSize())
<< " name = '" << Name << "'"
<< " type_signature = " << format("0x%16" PRIx64, TypeHash)
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 84dc904f9b8..6050adb4bc7 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -88,7 +88,15 @@ bool DWARFUnit::getStringOffsetSectionItem(uint32_t Index,
bool DWARFUnit::extractImpl(DataExtractor debug_info, uint32_t *offset_ptr) {
Length = debug_info.getU32(offset_ptr);
Version = debug_info.getU16(offset_ptr);
- uint64_t AbbrOffset = debug_info.getU32(offset_ptr);
+ uint64_t AbbrOffset;
+ if (Version >= 5) {
+ UnitType = debug_info.getU8(offset_ptr);
+ AddrSize = debug_info.getU8(offset_ptr);
+ AbbrOffset = debug_info.getU32(offset_ptr);
+ } else {
+ AbbrOffset = debug_info.getU32(offset_ptr);
+ AddrSize = debug_info.getU8(offset_ptr);
+ }
if (IndexEntry) {
if (AbbrOffset)
return false;
@@ -100,7 +108,6 @@ bool DWARFUnit::extractImpl(DataExtractor debug_info, uint32_t *offset_ptr) {
return false;
AbbrOffset = AbbrEntry->Offset;
}
- AddrSize = debug_info.getU8(offset_ptr);
bool LengthOK = debug_info.isValidOffset(getNextUnitOffset() - 1);
bool VersionOK = DWARFContext::isSupportedVersion(Version);
OpenPOWER on IntegriCloud