[Lldb-commits] [lldb] Add 'FindFirstSymbolWithNameAndType()' to ModuleList. (PR #117777)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 26 12:10:34 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Miro Bucko (mbucko)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/117777.diff
2 Files Affected:
- (modified) lldb/include/lldb/Core/ModuleList.h (+4)
- (modified) lldb/source/Core/ModuleList.cpp (+13)
``````````diff
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 {
``````````
</details>
https://github.com/llvm/llvm-project/pull/117777
More information about the lldb-commits
mailing list