================ @@ -1677,34 +1766,56 @@ void SymbolFileNativePDB::FindFunctions( if (name_type_mask & eFunctionNameTypeFull) name = lookup_info.GetName(); - // For now we only support lookup by method name or full name. if (!(name_type_mask & eFunctionNameTypeFull || + name_type_mask & eFunctionNameTypeBase || name_type_mask & eFunctionNameTypeMethod)) return; + CacheFunctionNames(); - using SymbolAndOffset = std::pair<uint32_t, llvm::codeview::CVSymbol>; + std::set<uint32_t> resolved_ids; // avoid duplicate lookups + auto resolve_from = [&](UniqueCStringMap<uint32_t> &Names) { + std::vector<uint32_t> ids; + if (!Names.GetValues(name, ids)) + return; - std::vector<SymbolAndOffset> matches = m_index->globals().findRecordsByName( - name.GetStringRef(), m_index->symrecords()); - for (const SymbolAndOffset &match : matches) { - if (match.second.kind() != S_PROCREF && match.second.kind() != S_LPROCREF) - continue; - ProcRefSym proc(match.second.kind()); - cantFail(SymbolDeserializer::deserializeAs<ProcRefSym>(match.second, proc)); + for (uint32_t id : ids) { + if (resolved_ids.find(id) != resolved_ids.end()) + continue; - if (!IsValidRecord(proc)) - continue; + PdbGlobalSymId global{id, false}; + if (parent_decl_ctx.IsValid() && + GetDeclContextContainingUID(toOpaqueUid(global)) != parent_decl_ctx) + continue; - CompilandIndexItem &cci = - m_index->compilands().GetOrCreateCompiland(proc.modi()); - SymbolContext sc; + CVSymbol sym = m_index->ReadSymbolRecord(global); + auto kind = sym.kind(); + lldbassert(kind == S_PROCREF || kind == S_LPROCREF); - sc.comp_unit = GetOrCreateCompileUnit(cci).get(); - PdbCompilandSymId func_id(proc.modi(), proc.SymOffset); - sc.function = GetOrCreateFunction(func_id, *sc.comp_unit).get(); + ProcRefSym proc = + cantFail(SymbolDeserializer::deserializeAs<ProcRefSym>(sym)); - sc_list.Append(sc); - } + if (!IsValidRecord(proc)) + continue; + + CompilandIndexItem &cci = + m_index->compilands().GetOrCreateCompiland(proc.modi()); + SymbolContext sc; + + sc.comp_unit = GetOrCreateCompileUnit(cci).get(); ---------------- Michael137 wrote:
missing `sc.comp_unit` nullptr check https://github.com/llvm/llvm-project/pull/152295 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits