https://github.com/mbucko created https://github.com/llvm/llvm-project/pull/117777
None >From 7f36a8b8672c9a75aa7dfe6a123401ae6d789a11 Mon Sep 17 00:00:00 2001 From: Miro Bucko <mbu...@meta.com> Date: Tue, 26 Nov 2024 12:07:57 -0800 Subject: [PATCH] Add 'FindFirstSymbolWithNameAndType()' to ModuleList. --- lldb/include/lldb/Core/ModuleList.h | 4 ++++ lldb/source/Core/ModuleList.cpp | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 43d931a8447406..29881a967b7a61 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -353,6 +353,10 @@ class ModuleList { lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const; + const Symbol * + FindFirstSymbolWithNameAndType(ConstString name, + lldb::SymbolType symbol_type) const; + void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const; diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 2b8ccab2406c6b..3b0ee6bd87b334 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -524,6 +524,19 @@ void ModuleList::FindGlobalVariables(const RegularExpression ®ex, module_sp->FindGlobalVariables(regex, max_matches, variable_list); } +const Symbol * +ModuleList::FindFirstSymbolWithNameAndType(ConstString name, + lldb::SymbolType symbol_type) const { + std::lock_guard<std::recursive_mutex> guard(m_modules_mutex); + for (const ModuleSP &module_sp : m_modules) { + const Symbol *symbol = + module_sp->FindFirstSymbolWithNameAndType(name, symbol_type); + if (symbol) + return symbol; + } + return nullptr; +} + void ModuleList::FindSymbolsWithNameAndType(ConstString name, SymbolType symbol_type, SymbolContextList &sc_list) const { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits