llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Dmitrii Galimzianov (DmT021) <details> <summary>Changes</summary> When we search for a symbol, we first check if it is in the module_sp of the current SymbolContext, and if not, we check in the target's modules. However, the target's ModuleList also includes the already checked module, which leads to a redundant search in it. --- Full diff: https://github.com/llvm/llvm-project/pull/102835.diff 1 Files Affected: - (modified) lldb/source/Expression/IRExecutionUnit.cpp (+15-12) ``````````diff diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index f220704423627d..aaf9cc3cfc9a23 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -785,6 +785,10 @@ IRExecutionUnit::FindInSymbols(const std::vector<ConstString> &names, return LLDB_INVALID_ADDRESS; } + ModuleList images = target->GetImages(); + // We'll process module_sp separately, before the other modules. + images.Remove(sc.module_sp); + LoadAddressResolver resolver(target, symbol_was_missing_weak); ModuleFunctionSearchOptions function_options; @@ -799,23 +803,22 @@ IRExecutionUnit::FindInSymbols(const std::vector<ConstString> &names, sc_list); if (auto load_addr = resolver.Resolve(sc_list)) return *load_addr; - } - if (sc.target_sp) { - SymbolContextList sc_list; - sc.target_sp->GetImages().FindFunctions(name, lldb::eFunctionNameTypeFull, - function_options, sc_list); + sc.module_sp->FindSymbolsWithNameAndType(name, lldb::eSymbolTypeAny, + sc_list); if (auto load_addr = resolver.Resolve(sc_list)) return *load_addr; } - if (sc.target_sp) { - SymbolContextList sc_list; - sc.target_sp->GetImages().FindSymbolsWithNameAndType( - name, lldb::eSymbolTypeAny, sc_list); - if (auto load_addr = resolver.Resolve(sc_list)) - return *load_addr; - } + SymbolContextList sc_list; + images.FindFunctions(name, lldb::eFunctionNameTypeFull, function_options, + sc_list); + if (auto load_addr = resolver.Resolve(sc_list)) + return *load_addr; + + images.FindSymbolsWithNameAndType(name, lldb::eSymbolTypeAny, sc_list); + if (auto load_addr = resolver.Resolve(sc_list)) + return *load_addr; lldb::addr_t best_internal_load_address = resolver.GetBestInternalLoadAddress(); `````````` </details> https://github.com/llvm/llvm-project/pull/102835 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits