TypeSP OperatingSystemGo::FindType(TargetSP target_sp, const char *name) { ConstString const_typename(name); SymbolContext sc; const bool exact_match = false; const ModuleList &module_list = target_sp->GetImages(); size_t count = module_list.GetSize(); for (size_t idx = 0; idx < count; idx++) { ModuleSP module_sp(module_list.GetModuleAtIndex(idx)); if (module_sp) { TypeSP type_sp(module_sp->FindFirstType(sc, const_typename, exact_match)); if (type_sp) return type_sp; } } Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS)); if (log) log->Printf("OperatingSystemGo::FindType(%s): not found", name); return TypeSP(); }
CompilerType LookupType(TargetSP target, ConstString name) { if (!target) return CompilerType(); SymbolContext sc; TypeList type_list; llvm::DenseSet<SymbolFile *> searched_symbol_files; uint32_t num_matches = target->GetImages().FindTypes( sc, name, false, 2, searched_symbol_files, type_list); if (num_matches > 0) { return type_list.GetTypeAtIndex(0)->GetFullCompilerType(); } return CompilerType(); }
VariableSP FindGlobalVariable(TargetSP target, llvm::Twine name) { ConstString fullname(name.str()); VariableList variable_list; const bool append = true; if (!target) { return nullptr; } const uint32_t match_count = target->GetImages().FindGlobalVariables( fullname, append, 1, variable_list); if (match_count == 1) { return variable_list.GetVariableAtIndex(0); } return nullptr; }
ValueObjectSP OperatingSystemGo::FindGlobal(TargetSP target, const char *name) { VariableList variable_list; const bool append = true; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS)); if (log) { log->Printf("exe: %s", target->GetExecutableModule()->GetSpecificationDescription().c_str()); log->Printf("modules: %zu", target->GetImages().GetSize()); } uint32_t match_count = target->GetImages().FindGlobalVariables(ConstString(name), append, 1, variable_list); if (match_count > 0) { ExecutionContextScope *exe_scope = target->GetProcessSP().get(); if (exe_scope == NULL) exe_scope = target.get(); return ValueObjectVariable::Create(exe_scope, variable_list.GetVariableAtIndex(0)); } return ValueObjectSP(); }