aboutsummaryrefslogtreecommitdiff
path: root/lib/DebugInfo
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-12-17 14:14:40 +0000
committerEric Liu <ioeric@google.com>2018-12-17 14:14:40 +0000
commitcc188a7f8bbd0452a53c99869c81bad2ec226dd9 (patch)
treed628b32ad1d7dc362cd75436f1ff3394910524e3 /lib/DebugInfo
parent4ed822d1608ab71c6269466230871d3045865260 (diff)
downloadllvm-cc188a7f8bbd0452a53c99869c81bad2ec226dd9.tar.gz
Revert "DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)"
This reverts commit r349333. It caused internal test to fail. I have sent more information to the author. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r--lib/DebugInfo/DWARF/DWARFUnit.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/DebugInfo/DWARF/DWARFUnit.cpp b/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 569512cb8f0..48900e4b7a2 100644
--- a/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -581,6 +581,27 @@ void DWARFUnit::collectAddressRanges(DWARFAddressRangesVector &CURanges) {
} else
WithColor::error() << "decoding address ranges: "
<< toString(CUDIERangesOrError.takeError()) << '\n';
+
+ // This function is usually called if there in no .debug_aranges section
+ // in order to produce a compile unit level set of address ranges that
+ // is accurate. If the DIEs weren't parsed, then we don't want all dies for
+ // all compile units to stay loaded when they weren't needed. So we can end
+ // up parsing the DWARF and then throwing them all away to keep memory usage
+ // down.
+ const bool ClearDIEs = extractDIEsIfNeeded(false) > 1;
+ getUnitDIE().collectChildrenAddressRanges(CURanges);
+
+ // Collect address ranges from DIEs in .dwo if necessary.
+ bool DWOCreated = parseDWO();
+ if (DWO)
+ DWO->collectAddressRanges(CURanges);
+ if (DWOCreated)
+ DWO.reset();
+
+ // Keep memory down by clearing DIEs if this generate function
+ // caused them to be parsed.
+ if (ClearDIEs)
+ clearDIEs(true);
}
void DWARFUnit::updateAddressDieMap(DWARFDie Die) {