Index: lldb/include/lldb/Symbol/SymbolFile.h =================================================================== --- lldb/include/lldb/Symbol/SymbolFile.h +++ lldb/include/lldb/Symbol/SymbolFile.h @@ -164,6 +164,25 @@ llvm::function_ref lambda) { return false; } + + /// Apply a lambda to each auxiliary lldb::Module referenced by this + /// \p comp_unit. + /// + /// This function can be used to traverse all OSO modules in a + /// SymbolFileDWARFDebugMap. + /// + /// \param[in] lambda + /// The lambda that should be applied to every function. The lambda can + /// return true if the iteration should be aborted earlier. + /// + /// \return + /// If the lambda early-exited, this function returns true to + /// propagate the early exit. + virtual bool + ForEachAuxiliaryModule(llvm::function_ref lambda) { + return false; + } + virtual bool ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) = 0; virtual size_t ParseTypes(CompileUnit &comp_unit) = 0; Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -67,6 +67,8 @@ bool ForEachExternalModule( lldb_private::CompileUnit &, llvm::DenseSet &, llvm::function_ref) override; + bool ForEachAuxiliaryModule( + llvm::function_ref) override; bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit, lldb_private::FileSpecList &support_files) override; Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -663,6 +663,19 @@ return false; } +bool SymbolFileDWARFDebugMap::ForEachAuxiliaryModule( + llvm::function_ref f) { + std::lock_guard guard(GetModuleMutex()); + ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { + if (oso_dwarf) + if (auto *obj = oso_dwarf->GetObjectFile()) + if (ModuleSP module_sp = obj->GetModule()) + return f(*module_sp); + return false; + }); + return false; +} + bool SymbolFileDWARFDebugMap::ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) { std::lock_guard guard(GetModuleMutex());