diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-07-31 15:32:39 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-07-31 15:32:39 +0000 |
commit | d7b1e5af0a8a7ae571eafb63403a5177fa881f62 (patch) | |
tree | dff22fa1e612431749a04762abd4051a33dd2f96 | |
parent | 160d9472f4ae7cdb9df9dec0768a97fa1c3533d0 (diff) | |
download | bcm5719-llvm-d7b1e5af0a8a7ae571eafb63403a5177fa881f62.tar.gz bcm5719-llvm-d7b1e5af0a8a7ae571eafb63403a5177fa881f62.zip |
[DebugInfo] Don't overwrite DWARFUnit fields if the CU DIE doesn't have them.
DIEs are lazily deserialized so it's possible that the DWO CU is created
before the DIE is parsed. DWO shares .debug_addr and .debug_ranges with the
object file so overwriting the offset with 0 will make the CU unusable.
No test case because I couldn't get clang to emit a non-zero range base.
llvm-svn: 309570
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 8 |
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 |