summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 2bcda237a4c..f55ece2fdfd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -245,8 +245,12 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
auto BaseAddr = toAddress(UnitDie.find({DW_AT_low_pc, DW_AT_entry_pc}));
if (BaseAddr)
setBaseAddress(*BaseAddr);
- AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_GNU_addr_base), 0);
- RangeSectionBase = toSectionOffset(UnitDie.find(DW_AT_rnglists_base), 0);
+ Optional<DWARFFormValue> AddrBase = UnitDie.find(DW_AT_GNU_addr_base);
+ if (AddrBase)
+ AddrOffsetSectionBase = *toSectionOffset(AddrBase);
+ Optional<DWARFFormValue> RngListsBase = UnitDie.find(DW_AT_rnglists_base);
+ if (RngListsBase)
+ RangeSectionBase = *toSectionOffset(RngListsBase);
// In general, we derive the offset of the unit's contibution to the
// debug_str_offsets{.dwo} section from the unit DIE's
OpenPOWER on IntegriCloud