Skip to content

Commit 6073460

Browse files
author
Kevin Frei
committed
Finished without crashing
1 parent f4b8d25 commit 6073460

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@ class DWARFUnit {
566566

567567
Error tryExtractDIEsIfNeeded(bool CUDieOnly);
568568

569+
void freeDIEs();
570+
569571
private:
570572
/// Size in bytes of the .debug_info data associated with this compile unit.
571573
size_t getDebugInfoSize() const {

llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,11 @@ void DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
495495
Context.getRecoverableErrorHandler()(std::move(e));
496496
}
497497

498+
void DWARFUnit::freeDIEs() {
499+
if (DieArray.capacity())
500+
std::vector<DWARFDebugInfoEntry>().swap(DieArray);
501+
}
502+
498503
Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) {
499504
if ((CUDieOnly && !DieArray.empty()) ||
500505
DieArray.size() > 1)

llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,18 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
625625
StrStream.flush();
626626
Out << storage;
627627
}
628-
// Release the line table, once we're done.
628+
// Release the line table and DIEs once we're done.
629629
DICtx.clearLineTableForUnit(CU.get());
630+
CU->freeDIEs();
630631

631632
Out.Merge(ThreadOut);
632633
});
633634
}
634635
}
635636
pool.wait();
636637
}
638+
for (const auto &CU : DICtx.compile_units())
639+
CU->freeDIEs();
637640
size_t FunctionsAddedCount = Gsym.getNumFunctionInfos() - NumBefore;
638641
Out << "Loaded " << FunctionsAddedCount << " functions from DWARF.\n";
639642
return Error::success();

0 commit comments

Comments
 (0)