https://github.com/clayborg commented:
While this does solve the problem, it means other clients that want to do the same thing will need to create this same kind of code. I would propose we modify `ModuleList::FindSymbolsWithNameAndType(...)` to take an extra parameter `SymbolContext &sc` which indicates the contents from which we are doing the search: ``` void ModuleList::FindSymbolsWithNameAndType( ConstString name, lldb::SymbolType symbol_type, const SymbolContext &sc, /// <-- The symbol context from which to perform the lookup SymbolContextList &sc_list) const; ``` Then the code inside will check if "sc" has a module, and if so, prefer that module first since someone is performing the search from somewhere (like an expression has a symbol context of the location in the current stack frame). Then we don't duplicate this kind of code everywhere. We need these `SymbolContext &sc` in a lot of searches: - search for types for an expression so we can prefer types from the current function, then compile unit, then module, and all modules. - search for functions, for same reason - 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