int CommandCompletions::SettingsNames (CommandInterpreter &interpreter, const char *partial_setting_name, int match_start_point, int max_return_elements, SearchFilter *searcher, bool &word_complete, StringList &matches) { // Cache the full setting name list static StringList g_property_names; if (g_property_names.GetSize() == 0) { // Generate the full setting name list on demand lldb::OptionValuePropertiesSP properties_sp (interpreter.GetDebugger().GetValueProperties()); if (properties_sp) { StreamString strm; properties_sp->DumpValue(nullptr, strm, OptionValue::eDumpOptionName); const std::string &str = strm.GetString(); g_property_names.SplitIntoLines(str.c_str(), str.size()); } } size_t exact_matches_idx = SIZE_MAX; const size_t num_matches = g_property_names.AutoComplete (partial_setting_name, matches, exact_matches_idx); word_complete = exact_matches_idx != SIZE_MAX; return num_matches; }
int CommandCompletions::SettingsNames(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher) { // Cache the full setting name list static StringList g_property_names; if (g_property_names.GetSize() == 0) { // Generate the full setting name list on demand lldb::OptionValuePropertiesSP properties_sp( interpreter.GetDebugger().GetValueProperties()); if (properties_sp) { StreamString strm; properties_sp->DumpValue(nullptr, strm, OptionValue::eDumpOptionName); const std::string &str = strm.GetString(); g_property_names.SplitIntoLines(str.c_str(), str.size()); } } size_t exact_matches_idx = SIZE_MAX; StringList matches; g_property_names.AutoComplete(request.GetCursorArgumentPrefix(), matches, exact_matches_idx); request.SetWordComplete(exact_matches_idx != SIZE_MAX); request.AddCompletions(matches); return request.GetNumberOfMatches(); }
bool SBTypeCategory::AddTypeSynthetic(SBTypeNameSpecifier type_name, SBTypeSynthetic synth) { LLDB_RECORD_METHOD(bool, SBTypeCategory, AddTypeSynthetic, (lldb::SBTypeNameSpecifier, lldb::SBTypeSynthetic), type_name, synth); if (!IsValid()) return false; if (!type_name.IsValid()) return false; if (!synth.IsValid()) return false; // FIXME: we need to iterate over all the Debugger objects and have each of // them contain a copy of the function // since we currently have formatters live in a global space, while Python // code lives in a specific Debugger-related environment this should // eventually be fixed by deciding a final location in the LLDB object space // for formatters if (synth.IsClassCode()) { const void *name_token = (const void *)ConstString(type_name.GetName()).GetCString(); const char *script = synth.GetData(); StringList input; input.SplitIntoLines(script, strlen(script)); uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers(); bool need_set = true; for (uint32_t j = 0; j < num_debuggers; j++) { DebuggerSP debugger_sp = lldb_private::Debugger::GetDebuggerAtIndex(j); if (debugger_sp) { ScriptInterpreter *interpreter_ptr = debugger_sp->GetCommandInterpreter().GetScriptInterpreter(); if (interpreter_ptr) { std::string output; if (interpreter_ptr->GenerateTypeSynthClass(input, output, name_token) && !output.empty()) { if (need_set) { need_set = false; synth.SetClassName(output.c_str()); } } } } } } if (type_name.IsRegex()) m_opaque_sp->GetRegexTypeSyntheticsContainer()->Add( lldb::RegularExpressionSP(new RegularExpression( llvm::StringRef::withNullAsEmpty(type_name.GetName()))), synth.GetSP()); else m_opaque_sp->GetTypeSyntheticsContainer()->Add( ConstString(type_name.GetName()), synth.GetSP()); return true; }
bool SBTypeCategory::AddTypeSummary (SBTypeNameSpecifier type_name, SBTypeSummary summary) { if (!IsValid()) return false; if (!type_name.IsValid()) return false; if (!summary.IsValid()) return false; // FIXME: we need to iterate over all the Debugger objects and have each of them contain a copy of the function // since we currently have formatters live in a global space, while Python code lives in a specific Debugger-related environment // this should eventually be fixed by deciding a final location in the LLDB object space for formatters if (summary.IsFunctionCode()) { void *name_token = (void*)ConstString(type_name.GetName()).GetCString(); const char* script = summary.GetData(); StringList input; input.SplitIntoLines(script, strlen(script)); uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers(); bool need_set = true; for (uint32_t j = 0; j < num_debuggers; j++) { DebuggerSP debugger_sp = lldb_private::Debugger::GetDebuggerAtIndex(j); if (debugger_sp) { ScriptInterpreter* interpreter_ptr = debugger_sp->GetCommandInterpreter().GetScriptInterpreter(); if (interpreter_ptr) { std::string output; if (interpreter_ptr->GenerateTypeScriptFunction(input, output, name_token) && !output.empty()) { if (need_set) { need_set = false; summary.SetFunctionName(output.c_str()); } } } } } } if (type_name.IsRegex()) m_opaque_sp->GetRegexSummaryNavigator()->Add(lldb::RegularExpressionSP(new RegularExpression(type_name.GetName())), summary.GetSP()); else m_opaque_sp->GetSummaryNavigator()->Add(ConstString(type_name.GetName()), summary.GetSP()); return true; }