summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARFUnit.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-06-12 18:52:35 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-06-12 18:52:35 +0000
commitf0e4034c425dd947f5373a29ebbf8b8912da01e8 (patch)
tree6b742c14d14df0c73a12917da016ec3690adb279 /llvm/lib/DebugInfo/DWARFUnit.cpp
parent6823a0b6781b92861ce5c83aed696b2c71979d3c (diff)
downloadbcm5719-llvm-f0e4034c425dd947f5373a29ebbf8b8912da01e8.tar.gz
bcm5719-llvm-f0e4034c425dd947f5373a29ebbf8b8912da01e8.zip
[llvm-symbolizer] Fix parsing DW_AT_ranges in Fission skeleton compile unit DIEs.
Turns out that DW_AT_ranges_base attribute sets the offset for DW_AT_ranges values specified in the .dwo file, but not for DW_AT_ranges specified in the skeleton compile unit DIE in the main executable. This is extremely confusing, and would hopefully be fixed in DWARF-5 when it's finalized. For now this behavior makes sense, as otherwise Fission would break DWARF consumers who doesn't know anything about DW_AT_ranges_base. llvm-svn: 210809
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFUnit.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARFUnit.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARFUnit.cpp
index f5f5072b9d3..027827735cf 100644
--- a/llvm/lib/DebugInfo/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARFUnit.cpp
@@ -225,8 +225,12 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
setBaseAddress(BaseAddr);
AddrOffsetSectionBase = DieArray[0].getAttributeValueAsSectionOffset(
this, DW_AT_GNU_addr_base, 0);
- RangeSectionBase = DieArray[0].getAttributeValueAsSectionOffset(
- this, DW_AT_GNU_ranges_base, 0);
+ // Users of old DWARF may not know about DW_AT_ranges_base, so it is ignored
+ // for skeleton CU DIE (e.g. DW_AT_ranges are *not* relative to it).
+ if (Version > 4) {
+ RangeSectionBase = DieArray[0].getAttributeValueAsSectionOffset(
+ this, DW_AT_GNU_ranges_base, 0);
+ }
}
setDIERelations();
@@ -272,7 +276,9 @@ bool DWARFUnit::parseDWO() {
}
// Share .debug_addr and .debug_ranges section with compile unit in .dwo
DWOCU->setAddrOffsetSection(AddrOffsetSection, AddrOffsetSectionBase);
- DWOCU->setRangesSection(RangeSection, RangeSectionBase);
+ uint32_t DWORangesBase = DieArray[0].getAttributeValueAsSectionOffset(
+ this, DW_AT_GNU_ranges_base, 0);
+ DWOCU->setRangesSection(RangeSection, DWORangesBase);
return true;
}
OpenPOWER on IntegriCloud