43                                       const char *help = 
nullptr,
 
   44                                       const char *syntax = 
nullptr,
 
   46                                       const char *auto_repeat_command = 
"")
 
   50        auto_repeat_command == 
nullptr 
   52            : std::optional<std::string>(auto_repeat_command);
 
 
   66                                              uint32_t index)
 override {
 
 
 
  111  return this->
operator bool();
 
 
  113SBCommandInterpreter::operator 
bool()
 const {
 
 
  165             m_opaque_ptr->GetDebugger().GetTopIOHandlerControlSequence(ch))
 
 
  172                                    bool add_to_history) {
 
  176  return HandleCommand(command_line, sb_exe_ctx, result, add_to_history);
 
 
  186  if (command_line && 
IsValid()) {
 
  189    if (override_context.
get())
 
  190      m_opaque_ptr->HandleCommand(command_line, do_add_to_history,
 
  191                                  override_context.
get()->
Lock(
true),
 
  194      m_opaque_ptr->HandleCommand(command_line, do_add_to_history,
 
  198        "SBCommandInterpreter or the command line is not valid");
 
 
  211    result->
AppendError(
"SBCommandInterpreter is not valid");
 
  222  if (override_context.
get())
 
  224                                         override_context.
get()->
Lock(
true),
 
  225                                         options.
ref(), result.
ref());
 
 
  232    const char *current_line, 
const char *cursor, 
const char *last_char,
 
  233    int match_start_point, 
int max_return_elements, 
SBStringList &matches) {
 
  235                     max_return_elements, matches);
 
  239      current_line, cursor, last_char, match_start_point, max_return_elements,
 
  240      matches, dummy_descriptions);
 
 
  244    const char *current_line, 
const char *cursor, 
const char *last_char,
 
  245    int match_start_point, 
int max_return_elements, 
SBStringList &matches,
 
  248                     max_return_elements, matches, descriptions);
 
  252  if (current_line == 
nullptr || cursor == 
nullptr || last_char == 
nullptr)
 
  255  if (cursor < current_line || last_char < current_line)
 
  258  size_t current_line_size = strlen(current_line);
 
  259  if (cursor - current_line > 
static_cast<ptrdiff_t
>(current_line_size) ||
 
  260      last_char - current_line > 
static_cast<ptrdiff_t
>(current_line_size))
 
  266  if (max_return_elements == 0)
 
  272  if (max_return_elements > 0)
 
  279  if (max_return_elements > 0 &&
 
  280      lldb_matches.
GetSize() > 
static_cast<size_t>(max_return_elements)) {
 
  281    lldb_matches.
SetSize(max_return_elements);
 
  282    lldb_descriptions.
SetSize(max_return_elements);
 
  284  int number_of_matches = lldb_matches.
GetSize();
 
  298    const size_t partial_name_len = command_partial_str.size();
 
  299    common_prefix.erase(0, partial_name_len);
 
  303    if (lldb_matches.
GetSize() == 1) {
 
  308        common_prefix.push_back(quote_char);
 
  309      common_prefix.push_back(
' ');
 
  317  SBStringList temp_descriptions_list(&lldb_descriptions);
 
  318  descriptions.
AppendList(temp_descriptions_list);
 
  319  return number_of_matches;
 
 
  323    const char *current_line, uint32_t cursor_pos, 
int match_start_point,
 
  327                     max_return_elements, matches, descriptions);
 
  329  const char *cursor = current_line + cursor_pos;
 
  330  const char *last_char = current_line + strlen(current_line);
 
  332      current_line, cursor, last_char, match_start_point, max_return_elements,
 
  333      matches, descriptions);
 
 
  338                                           int match_start_point,
 
  339                                           int max_return_elements,
 
  342                     max_return_elements, matches);
 
  344  const char *cursor = current_line + cursor_pos;
 
  345  const char *last_char = current_line + strlen(current_line);
 
  347                          max_return_elements, matches);
 
 
  382      std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
 
  383      process_sp = target_sp->GetProcessSP();
 
  384      sb_process.
SetSP(process_sp);
 
 
  442  if (command_line && 
IsValid()) {
 
  446        "SBCommandInterpreter or the command line is not valid");
 
 
  469    std::unique_lock<std::recursive_mutex> lock;
 
  471      lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
 
  474    result->
AppendError(
"SBCommandInterpreter is not valid");
 
 
  492    std::unique_lock<std::recursive_mutex> lock;
 
  494      lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
 
  497    result->
AppendError(
"SBCommandInterpreter is not valid");
 
 
  508    std::unique_lock<std::recursive_mutex> lock;
 
  510      lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
 
  513    result->
AppendError(
"SBCommandInterpreter is not valid");
 
 
  552  return event.GetBroadcasterClass() ==
 
 
  561  if (command_name && command_name[0] && 
IsValid()) {
 
  562    llvm::StringRef command_name_str = command_name;
 
  564        m_opaque_ptr->GetCommandObjectForCommand(command_name_str);
 
  566      assert(command_name_str.empty());
 
 
  581  std::string json_str =
 
  582      llvm::formatv(
"{0:2}", 
m_opaque_ptr->GetStatistics()).str();
 
 
  598        std::make_shared<StructuredData::Array>(
m_opaque_ptr->GetTranscript()));
 
 
  608  new_command_sp->GetAsMultiwordCommand()->SetRemovable(
true);
 
 
  626                                 const char *help, 
const char *syntax) {
 
  628  return AddCommand(name, impl, help, syntax, 
"");
 
 
  633    const char *syntax, 
const char *auto_repeat_command) {
 
  637  new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
 
  639      auto_repeat_command);
 
 
  653  return this->
operator bool();
 
 
  655SBCommand::operator 
bool()
 const {
 
 
  708  if (new_command_sp && 
m_opaque_sp->LoadSubCommand(name, new_command_sp))
 
 
  723                                      const char *help, 
const char *syntax) {
 
  725  return AddCommand(name, impl, help, syntax, 
"");
 
 
  730                                      const char *help, 
const char *syntax,
 
  731                                      const char *auto_repeat_command) {
 
  739  new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
 
  740      m_opaque_sp->GetCommandInterpreter(), name, impl, help, syntax,
 
  741      0, auto_repeat_command);
 
  742  if (new_command_sp && 
m_opaque_sp->LoadSubCommand(name, new_command_sp))
 
 
  768          return callback(sb_result, baton);
 
 
#define LLDB_INSTRUMENT()
 
#define LLDB_INSTRUMENT_VA(...)
 
lldb_private::CommandInterpreterRunOptions & ref() const
 
lldb::SBCommand AddMultiwordCommand(const char *name, const char *help)
 
void SetPrintCallback(lldb::SBCommandPrintCallback callback, void *baton)
 
const lldb::SBCommandInterpreter & operator=(const lldb::SBCommandInterpreter &rhs)
 
lldb::SBProcess GetProcess()
 
lldb_private::CommandInterpreter & ref()
 
void ResolveCommand(const char *command_line, SBCommandReturnObject &result)
Resolve the command just as HandleCommand would, expanding abbreviations and aliases.
 
lldb::SBDebugger GetDebugger()
 
SBStructuredData GetStatistics()
 
static const char * GetBroadcasterClass()
 
const char * GetIOHandlerControlSequence(char ch)
Get the string that needs to be written to the debugger stdin file handle when a control character is...
 
SBStructuredData GetTranscript()
Returns a list of handled commands, output and error.
 
lldb::SBCommand AddCommand(const char *name, lldb::SBCommandPluginInterface *impl, const char *help)
Add a new command to the lldb::CommandInterpreter.
 
void AllowExitCodeOnQuit(bool allow)
Sets whether the command interpreter should allow custom exit codes for the 'quit' command.
 
bool AliasExists(const char *cmd)
Return whether the passed in name or command path exists and is an alias to some other command.
 
bool IsActive()
Return true if the command interpreter is the active IO handler.
 
static const char * GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type)
 
int HandleCompletion(const char *current_line, const char *cursor, const char *last_char, int match_start_point, int max_return_elements, lldb::SBStringList &matches)
 
void reset(lldb_private::CommandInterpreter *)
 
static const char * GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type)
 
bool SetCommandOverrideCallback(const char *command_name, lldb::CommandOverrideCallback callback, void *baton)
 
bool WasInterrupted() const
Returns whether an interrupt flag was raised either by the SBDebugger - when the function is not runn...
 
void SourceInitFileInCurrentWorkingDirectory(lldb::SBCommandReturnObject &result)
 
bool UserCommandExists(const char *cmd)
Return whether a user defined command with the passed in name or command path exists.
 
bool InterruptCommand()
Interrupts the command currently executing in the RunCommandInterpreter thread.
 
void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result)
 
lldb_private::CommandInterpreter * m_opaque_ptr
 
void HandleCommandsFromFile(lldb::SBFileSpec &file, lldb::SBExecutionContext &override_context, lldb::SBCommandInterpreterRunOptions &options, lldb::SBCommandReturnObject result)
 
lldb_private::CommandInterpreter * get()
 
bool HasCustomQuitExitCode()
Returns true if the user has called the 'quit' command with a custom exit code.
 
int HandleCompletionWithDescriptions(const char *current_line, const char *cursor, const char *last_char, int match_start_point, int max_return_elements, lldb::SBStringList &matches, lldb::SBStringList &descriptions)
 
void SourceInitFileInGlobalDirectory(lldb::SBCommandReturnObject &result)
 
void SetPromptOnQuit(bool b)
 
bool CommandExists(const char *cmd)
Return whether a built-in command with the passed in name or command path exists.
 
lldb::ReturnStatus HandleCommand(const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history=false)
 
lldb::SBBroadcaster GetBroadcaster()
 
int GetQuitStatus()
Returns the exit code that the user has specified when running the 'quit' command.
 
static bool EventIsCommandInterpreterEvent(const lldb::SBEvent &event)
 
lldb::ReturnStatus GetStatus()
 
lldb_private::CommandReturnObject & ref() const
 
const char * GetHelpLong()
 
lldb::CommandObjectSP m_opaque_sp
 
lldb::SBCommand AddMultiwordCommand(const char *name, const char *help=nullptr)
 
void SetHelpLong(const char *)
 
void SetFlags(uint32_t flags)
 
lldb::SBCommand AddCommand(const char *name, lldb::SBCommandPluginInterface *impl, const char *help=nullptr)
Add a new subcommand to the lldb::SBCommand.
 
void SetHelp(const char *)
 
void reset(const lldb::DebuggerSP &debugger_sp)
 
lldb_private::ExecutionContextRef * get() const
 
const lldb_private::FileSpec & ref() const
 
bool GetDescription(lldb::SBStream &description) const
 
void SetSP(const lldb::ProcessSP &process_sp)
 
void AppendList(const char **strv, int strc)
 
StructuredDataImplUP m_impl_up
 
A command line argument class.
 
char ** GetArgumentVector()
Gets the argument vector.
 
static std::string EscapeLLDBCommandArgument(const std::string &arg, char quote_char)
 
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
 
static llvm::StringRef GetStaticBroadcasterClass()
 
void SetRemovable(bool removable)
 
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
 
std::vector< CommandArgumentEntry > m_arguments
 
static const char * GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type)
 
CommandInterpreter & m_interpreter
 
void SetOverrideCallback(lldb::CommandOverrideCallback callback, void *baton)
 
static const char * GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type)
 
lldb::SBCommandPluginInterface * m_backend
 
std::optional< std::string > GetRepeatCommand(Args ¤t_command_args, uint32_t index) override
More documentation is available in lldb::CommandObject::GetRepeatCommand, but in short,...
 
void DoExecute(Args &command, CommandReturnObject &result) override
 
std::optional< std::string > m_auto_repeat_command
 
CommandPluginInterfaceImplementation(CommandInterpreter &interpreter, const char *name, lldb::SBCommandPluginInterface *backend, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0, const char *auto_repeat_command="")
 
bool IsRemovable() const override
 
void void AppendError(llvm::StringRef in_string)
 
void SetInteractive(bool b)
 
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
 
"lldb/Utility/ArgCompletionRequest.h"
 
void SetMaxReturnElements(size_t max_return_elements)
Sets the maximum number of completions that should be returned.
 
const Args & GetParsedLine() const
 
llvm::StringRef GetCursorArgumentPrefix() const
 
const Args::ArgEntry & GetParsedArg()
 
void GetDescriptions(StringList &descriptions) const
Adds all collected completion descriptions to the given list.
 
void GetMatches(StringList &matches) const
Adds all collected completion matches to the given list.
 
A uniqued constant string class.
 
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
 
const char * GetCString() const
Get the string value as a C string.
 
ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const
Create an ExecutionContext object from this object.
 
bool Success() const
Test for success condition.
 
void InsertStringAtIndex(size_t idx, const std::string &str)
 
std::string LongestCommonPrefix()
 
static ObjectSP ParseJSON(llvm::StringRef json_text)
 
A class that represents a running process on the host machine.
 
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
 
lldb::CommandReturnObjectCallbackResult(* SBCommandPrintCallback)(lldb::SBCommandReturnObject &result, void *baton)
 
std::shared_ptr< lldb_private::Process > ProcessSP
 
ReturnStatus
Command Return Status Types.
 
bool(* CommandOverrideCallback)(void *baton, const char **argv)
 
std::shared_ptr< lldb_private::Target > TargetSP
 
bool IsQuoted() const
Returns true if this argument was quoted in any way.
 
char GetQuoteChar() const
 
Used to build individual command argument lists.