diff options
| author | David Blaikie <dblaikie@gmail.com> | 2017-05-20 03:32:49 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2017-05-20 03:32:49 +0000 |
| commit | 8d039d40c5fd32ed44d14f2cabd4514818b9a9c9 (patch) | |
| tree | e4840da567e846bea2f6eeb958002c5d1441d290 /llvm/lib/DebugInfo/DWARF | |
| parent | 4eff87c36d6b104aa5fefa8b9c291e007b9ee48b (diff) | |
| download | bcm5719-llvm-8d039d40c5fd32ed44d14f2cabd4514818b9a9c9.tar.gz bcm5719-llvm-8d039d40c5fd32ed44d14f2cabd4514818b9a9c9.zip | |
llvm-symbolizer: Support multiple CUs in a single DWO file
llvm-svn: 303482
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index 3835d4da9ae..a784968e269 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -249,7 +249,7 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) { return DieArray.size(); } -DWARFUnit::DWOHolder::DWOHolder(StringRef DWOPath) { +DWARFUnit::DWOHolder::DWOHolder(StringRef DWOPath, uint64_t DWOId) { auto Obj = object::ObjectFile::createObjectFile(DWOPath); if (!Obj) { // TODO: Actually report errors helpfully. @@ -259,8 +259,11 @@ DWARFUnit::DWOHolder::DWOHolder(StringRef DWOPath) { DWOFile = std::move(Obj.get()); DWOContext.reset( cast<DWARFContext>(new DWARFContextInMemory(*DWOFile.getBinary()))); - if (DWOContext->getNumDWOCompileUnits() > 0) - DWOU = DWOContext->getDWOCompileUnitAtIndex(0); + for (const auto &DWOCU : DWOContext->dwo_compile_units()) + if (DWOCU->getDWOId() == DWOId) { + DWOU = DWOCU.get(); + return; + } } bool DWARFUnit::parseDWO() { @@ -281,10 +284,12 @@ bool DWARFUnit::parseDWO() { sys::path::append(AbsolutePath, *CompilationDir); } sys::path::append(AbsolutePath, *DWOFileName); - DWO = llvm::make_unique<DWOHolder>(AbsolutePath); + auto DWOId = getDWOId(); + if (!DWOId) + return false; + DWO = llvm::make_unique<DWOHolder>(AbsolutePath, *DWOId); DWARFUnit *DWOCU = DWO->getUnit(); - // Verify that compile unit in .dwo file is valid. - if (!DWOCU || DWOCU->getDWOId() != getDWOId()) { + if (!DWOCU) { DWO.reset(); return false; } |

