LLDB  mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
lldb_private::CommandObject Class Referenceabstract

#include <CommandObject.h>

Inheritance diagram for lldb_private::CommandObject:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::CommandObject:
Collaboration graph
[legend]

Classes

struct  ArgumentHelpCallback
 
struct  ArgumentTableEntry
 
struct  CommandArgumentData
 

Public Types

typedef llvm::StringRef() ArgumentHelpCallbackFunction()
 
typedef std::vector< CommandArgumentDataCommandArgumentEntry
 
typedef std::map< std::string, lldb::CommandObjectSP > CommandMap
 

Public Member Functions

 CommandObject (CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
 
virtual ~CommandObject ()
 
CommandInterpreterGetCommandInterpreter ()
 
DebuggerGetDebugger ()
 
virtual llvm::StringRef GetHelp ()
 
virtual llvm::StringRef GetHelpLong ()
 
virtual llvm::StringRef GetSyntax ()
 
llvm::StringRef GetCommandName () const
 
virtual void SetHelp (llvm::StringRef str)
 
virtual void SetHelpLong (llvm::StringRef str)
 
void SetSyntax (llvm::StringRef str)
 
virtual bool IsRemovable () const
 
virtual bool IsMultiwordObject ()
 
virtual CommandObjectMultiwordGetAsMultiwordCommand ()
 
virtual bool IsAlias ()
 
virtual bool IsDashDashCommand ()
 
virtual lldb::CommandObjectSP GetSubcommandSP (llvm::StringRef sub_cmd, StringList *matches=nullptr)
 
virtual CommandObjectGetSubcommandObject (llvm::StringRef sub_cmd, StringList *matches=nullptr)
 
virtual void AproposAllSubCommands (llvm::StringRef prefix, llvm::StringRef search_word, StringList &commands_found, StringList &commands_help)
 
void FormatLongHelpText (Stream &output_strm, llvm::StringRef long_help)
 
void GenerateHelpText (CommandReturnObject &result)
 
virtual void GenerateHelpText (Stream &result)
 
virtual bool LoadSubCommand (llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj)
 
virtual bool WantsRawCommandString ()=0
 
virtual bool WantsCompletion ()
 
virtual OptionsGetOptions ()
 
int GetNumArgumentEntries ()
 
CommandArgumentEntryGetArgumentEntryAtIndex (int idx)
 
void GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask=LLDB_OPT_SET_ALL)
 
bool IsPairType (ArgumentRepetitionType arg_repeat_type)
 
bool ParseOptions (Args &args, CommandReturnObject &result)
 
void SetCommandName (llvm::StringRef name)
 
virtual int HandleCompletion (CompletionRequest &request)
 This default version handles calling option argument completions and then calls HandleArgumentCompletion if the cursor is on an argument, not an option. More...
 
virtual int HandleArgumentCompletion (CompletionRequest &request, OptionElementVector &opt_element_vector)
 The input array contains a parsed version of the line. More...
 
bool HelpTextContainsWord (llvm::StringRef search_word, bool search_short_help=true, bool search_long_help=true, bool search_syntax=true, bool search_options=true)
 
FlagsGetFlags ()
 The flags accessor. More...
 
const FlagsGetFlags () const
 The flags const accessor. More...
 
virtual const char * GetRepeatCommand (Args &current_command_args, uint32_t index)
 Get the command that appropriate for a "repeat" of the current command. More...
 
bool HasOverrideCallback () const
 
void SetOverrideCallback (lldb::CommandOverrideCallback callback, void *baton)
 
void SetOverrideCallback (lldb::CommandOverrideCallbackWithResult callback, void *baton)
 
bool InvokeOverrideCallback (const char **argv, CommandReturnObject &result)
 
virtual bool Execute (const char *args_string, CommandReturnObject &result)=0
 

Static Public Member Functions

static const char * GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type)
 
static const char * GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type)
 
static const ArgumentTableEntryGetArgumentTable ()
 
static lldb::CommandArgumentType LookupArgumentName (llvm::StringRef arg_name)
 
static const ArgumentTableEntryFindArgumentDataByType (lldb::CommandArgumentType arg_type)
 
static void GetArgumentHelp (Stream &str, lldb::CommandArgumentType arg_type, CommandInterpreter &interpreter)
 
static const char * GetArgumentName (lldb::CommandArgumentType arg_type)
 

Static Public Attributes

static ArgumentTableEntry g_arguments_data [lldb::eArgTypeLastArg]
 

Protected Member Functions

bool ParseOptionsAndNotify (Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
 
virtual const char * GetInvalidTargetDescription ()
 
virtual const char * GetInvalidProcessDescription ()
 
virtual const char * GetInvalidThreadDescription ()
 
virtual const char * GetInvalidFrameDescription ()
 
virtual const char * GetInvalidRegContextDescription ()
 
TargetGetSelectedOrDummyTarget (bool prefer_dummy=false)
 
TargetGetDummyTarget ()
 
ThreadGetDefaultThread ()
 
bool CheckRequirements (CommandReturnObject &result)
 Check the command to make sure anything required by this command is available. More...
 
void Cleanup ()
 

Static Protected Member Functions

static void AddIDsArgumentData (CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange)
 

Protected Attributes

CommandInterpreterm_interpreter
 
ExecutionContext m_exe_ctx
 
std::unique_lock< std::recursive_mutex > m_api_locker
 
std::string m_cmd_name
 
std::string m_cmd_help_short
 
std::string m_cmd_help_long
 
std::string m_cmd_syntax
 
Flags m_flags
 
std::vector< CommandArgumentEntrym_arguments
 
lldb::CommandOverrideCallback m_deprecated_command_override_callback
 
lldb::CommandOverrideCallbackWithResult m_command_override_callback
 
void * m_command_override_baton
 

Detailed Description

Definition at line 67 of file CommandObject.h.

Member Typedef Documentation

◆ ArgumentHelpCallbackFunction

typedef llvm::StringRef() lldb_private::CommandObject::ArgumentHelpCallbackFunction()

Definition at line 69 of file CommandObject.h.

◆ CommandArgumentEntry

Definition at line 104 of file CommandObject.h.

◆ CommandMap

typedef std::map<std::string, lldb::CommandObjectSP> lldb_private::CommandObject::CommandMap

Definition at line 109 of file CommandObject.h.

Constructor & Destructor Documentation

◆ CommandObject()

CommandObject::CommandObject ( CommandInterpreter interpreter,
llvm::StringRef  name,
llvm::StringRef  help = "",
llvm::StringRef  syntax = "",
uint32_t  flags = 0 
)

Definition at line 40 of file CommandObject.cpp.

References m_cmd_help_short, and m_cmd_syntax.

◆ ~CommandObject()

CommandObject::~CommandObject ( )
virtual

Definition at line 50 of file CommandObject.cpp.

Member Function Documentation

◆ AddIDsArgumentData()

void CommandObject::AddIDsArgumentData ( CommandArgumentEntry arg,
lldb::CommandArgumentType  ID,
lldb::CommandArgumentType  IDRange 
)
staticprotected

◆ AproposAllSubCommands()

virtual void lldb_private::CommandObject::AproposAllSubCommands ( llvm::StringRef  prefix,
llvm::StringRef  search_word,
StringList commands_found,
StringList commands_help 
)
inlinevirtual

◆ CheckRequirements()

bool CommandObject::CheckRequirements ( CommandReturnObject result)
protected

◆ Cleanup()

void CommandObject::Cleanup ( )
protected

◆ Execute()

virtual bool lldb_private::CommandObject::Execute ( const char *  args_string,
CommandReturnObject result 
)
pure virtual

◆ FindArgumentDataByType()

const CommandObject::ArgumentTableEntry * CommandObject::FindArgumentDataByType ( lldb::CommandArgumentType  arg_type)
static

◆ FormatLongHelpText()

void CommandObject::FormatLongHelpText ( Stream output_strm,
llvm::StringRef  long_help 
)

◆ GenerateHelpText() [1/2]

void CommandObject::GenerateHelpText ( CommandReturnObject result)

◆ GenerateHelpText() [2/2]

void CommandObject::GenerateHelpText ( Stream result)
virtual

◆ GetArgumentDescriptionAsCString()

const char * CommandObject::GetArgumentDescriptionAsCString ( const lldb::CommandArgumentType  arg_type)
static

◆ GetArgumentEntryAtIndex()

CommandObject::CommandArgumentEntry * CommandObject::GetArgumentEntryAtIndex ( int  idx)

Definition at line 343 of file CommandObject.cpp.

References m_arguments.

Referenced by WantsCompletion().

◆ GetArgumentHelp()

void CommandObject::GetArgumentHelp ( Stream str,
lldb::CommandArgumentType  arg_type,
CommandInterpreter interpreter 
)
static

◆ GetArgumentName()

const char * CommandObject::GetArgumentName ( lldb::CommandArgumentType  arg_type)
static

◆ GetArgumentTable()

const CommandObject::ArgumentTableEntry * CommandObject::GetArgumentTable ( )
static

◆ GetArgumentTypeAsCString()

const char * CommandObject::GetArgumentTypeAsCString ( const lldb::CommandArgumentType  arg_type)
static

◆ GetAsMultiwordCommand()

virtual CommandObjectMultiword* lldb_private::CommandObject::GetAsMultiwordCommand ( )
inlinevirtual

◆ GetCommandInterpreter()

CommandInterpreter& lldb_private::CommandObject::GetCommandInterpreter ( )
inline

◆ GetCommandName()

llvm::StringRef CommandObject::GetCommandName ( ) const

◆ GetDebugger()

Debugger & CommandObject::GetDebugger ( )

◆ GetDefaultThread()

Thread * CommandObject::GetDefaultThread ( )
protected

◆ GetDummyTarget()

Target * CommandObject::GetDummyTarget ( )
protected

◆ GetFlags() [1/2]

Flags& lldb_private::CommandObject::GetFlags ( )
inline

The flags accessor.

Returns
A reference to the Flags member variable.

Definition at line 272 of file CommandObject.h.

References m_flags.

Referenced by CheckRequirements().

◆ GetFlags() [2/2]

const Flags& lldb_private::CommandObject::GetFlags ( ) const
inline

The flags const accessor.

Returns
A const reference to the Flags member variable.

Definition at line 278 of file CommandObject.h.

References m_flags.

◆ GetFormattedCommandArguments()

void CommandObject::GetFormattedCommandArguments ( Stream str,
uint32_t  opt_set_mask = LLDB_OPT_SET_ALL 
)

◆ GetHelp()

llvm::StringRef CommandObject::GetHelp ( )
virtual

◆ GetHelpLong()

llvm::StringRef CommandObject::GetHelpLong ( )
virtual

◆ GetInvalidFrameDescription()

virtual const char* lldb_private::CommandObject::GetInvalidFrameDescription ( )
inlineprotectedvirtual

Definition at line 342 of file CommandObject.h.

Referenced by CheckRequirements().

◆ GetInvalidProcessDescription()

virtual const char* lldb_private::CommandObject::GetInvalidProcessDescription ( )
inlineprotectedvirtual

Definition at line 336 of file CommandObject.h.

Referenced by CheckRequirements().

◆ GetInvalidRegContextDescription()

virtual const char* lldb_private::CommandObject::GetInvalidRegContextDescription ( )
inlineprotectedvirtual

◆ GetInvalidTargetDescription()

virtual const char* lldb_private::CommandObject::GetInvalidTargetDescription ( )
inlineprotectedvirtual

Definition at line 332 of file CommandObject.h.

Referenced by CheckRequirements().

◆ GetInvalidThreadDescription()

virtual const char* lldb_private::CommandObject::GetInvalidThreadDescription ( )
inlineprotectedvirtual

Definition at line 340 of file CommandObject.h.

Referenced by CheckRequirements().

◆ GetNumArgumentEntries()

int CommandObject::GetNumArgumentEntries ( )

Definition at line 340 of file CommandObject.cpp.

References m_arguments.

Referenced by GenerateHelpText(), and WantsCompletion().

◆ GetOptions()

Options * CommandObject::GetOptions ( )
virtual

Reimplemented in CommandObjectProcessGDBRemoteSpeedTest, CommandObjectRenderScriptRuntimeAllocationList, CommandObjectTargetStopHookAdd, CommandObjectRenderScriptRuntimeAllocationDump, CommandObjectRenderScriptRuntimeKernelBreakpointSet, CommandObjectRenderScriptRuntimeReductionBreakpointSet, CommandObjectTargetSymbolsAdd, CommandObjectTargetModulesLookup, CommandObjectTargetModulesShowUnwind, CommandObjectTargetModulesList, CommandObjectTypeLookup, CommandObjectTargetModulesLoad, CommandObjectTargetModulesAdd, CommandObjectBreakpointWrite, CommandObjectTargetModulesDumpLineTable, CommandObjectBreakpointRead, CommandObjectBreakpointNameList, CommandObjectBreakpointNameDelete, CommandObjectBreakpointNameAdd, CommandObjectTargetModulesDumpSymtab, CommandObjectThreadPlanList, CommandObjectBreakpointNameConfigure, CommandObjectThreadJump, CommandObjectPlatformShell, CommandObjectThreadReturn, CommandObjectBreakpointDelete, CommandObjectPlatformProcessAttach, CommandObjectCommandsScriptAdd, CommandObjectThreadInfo, CommandObjectBreakpointClear, CommandObjectCommandsScriptImport, CommandObjectProcessHandle, CommandObjectBreakpointList, CommandObjectMemoryWrite, CommandObjectThreadUntil, CommandObjectPlatformProcessList, CommandObjectWatchpointSetExpression, CommandObjectProcessLoad, CommandObjectBreakpointModify, CommandObjectMemoryFind, CommandObjectPlatformProcessLaunch, sddarwinlog_private::EnableCommand, CommandObjectProcessConnect, CommandObjectTypeFormatterDelete, CommandObjectWatchpointSetVariable, CommandObjectTargetVariable, CommandObjectProcessDetach, CommandObjectSourceList, CommandObjectPlatformFWrite, CommandObjectProcessContinue, CommandObjectProcessMinidumpDump, CommandObjectWatchpointModify, CommandObjectPlatformFRead, CommandObjectTargetDelete, CommandObjectThreadStepWithTypeAndScope, CommandObjectObjC_ClassTable_Dump, CommandObjectPlatformFOpen, CommandObjectWatchpointIgnore, CommandObjectBreakpointCommandDelete, CommandObjectPlatformMkDir, CommandObjectFrameVariable, CommandObjectSettingsRead, CommandObjectPlatformSettings, CommandObjectProcessAttach, CommandObjectCommandsAlias, CommandObjectBreakpointSet, CommandObjectMemoryRead, CommandObjectSettingsWrite, CommandObjectThreadBacktrace, CommandObjectPlatformConnect, CommandObjectFrameSelect, CommandObjectTargetCreate, CommandObjectCommandsSource, CommandObjectBreakpointCommandAdd, CommandObjectWatchpointCommandAdd, CommandObjectPlatformSelect, CommandObjectWatchpointList, CommandObjectFrameDiagnose, CommandObjectSourceInfo, CommandObjectProcessLaunch, lldb_private::CommandObjectProxy, CommandObjectSettingsSet, CommandObjectLogEnable, CommandObjectRegisterRead, lldb_private::CommandObjectHelp, lldb_private::CommandObjectDisassemble, CommandObjectCommandsHistory, lldb_private::CommandObjectExpression, lldb_private::CommandAlias, and CommandObjectBugreportUnwind.

Definition at line 91 of file CommandObject.cpp.

Referenced by GenerateHelpText(), lldb_private::CommandObjectProxy::GetOptions(), GetSyntax(), HandleCompletion(), HelpTextContainsWord(), ParseOptions(), lldb_private::CommandInterpreter::RunCommandInterpreter(), and WantsCompletion().

◆ GetRepeatCommand()

virtual const char* lldb_private::CommandObject::GetRepeatCommand ( Args current_command_args,
uint32_t  index 
)
inlinevirtual

Get the command that appropriate for a "repeat" of the current command.

Parameters
[in]current_command_lineThe complete current command line.
Returns
nullptr if there is no special repeat command - it will use the current command line. Otherwise a pointer to the command to be repeated. If the returned string is the empty string, the command won't be repeated.

Reimplemented in CommandObjectMemoryRegion, CommandObjectMemoryHistory, CommandObjectSourceList, CommandObjectMemoryRead, CommandObjectCommandsSource, CommandObjectProcessLaunch, lldb_private::CommandObjectProxy, and lldb_private::CommandObjectMultiword.

Definition at line 291 of file CommandObject.h.

Referenced by lldb_private::CommandObjectMultiword::GetRepeatCommand(), lldb_private::CommandObjectProxy::GetRepeatCommand(), and lldb_private::CommandInterpreter::HandleCommand().

◆ GetSelectedOrDummyTarget()

Target * CommandObject::GetSelectedOrDummyTarget ( bool  prefer_dummy = false)
protected

◆ GetSubcommandObject()

virtual CommandObject* lldb_private::CommandObject::GetSubcommandObject ( llvm::StringRef  sub_cmd,
StringList matches = nullptr 
)
inlinevirtual

◆ GetSubcommandSP()

virtual lldb::CommandObjectSP lldb_private::CommandObject::GetSubcommandSP ( llvm::StringRef  sub_cmd,
StringList matches = nullptr 
)
inlinevirtual

◆ GetSyntax()

llvm::StringRef CommandObject::GetSyntax ( )
virtual

◆ HandleArgumentCompletion()

virtual int lldb_private::CommandObject::HandleArgumentCompletion ( CompletionRequest request,
OptionElementVector opt_element_vector 
)
inlinevirtual

◆ HandleCompletion()

int CommandObject::HandleCompletion ( CompletionRequest request)
virtual

◆ HasOverrideCallback()

bool lldb_private::CommandObject::HasOverrideCallback ( ) const
inline

◆ HelpTextContainsWord()

bool CommandObject::HelpTextContainsWord ( llvm::StringRef  search_word,
bool  search_short_help = true,
bool  search_long_help = true,
bool  search_syntax = true,
bool  search_options = true 
)

◆ InvokeOverrideCallback()

bool lldb_private::CommandObject::InvokeOverrideCallback ( const char **  argv,
CommandReturnObject result 
)
inline

◆ IsAlias()

virtual bool lldb_private::CommandObject::IsAlias ( )
inlinevirtual

◆ IsDashDashCommand()

virtual bool lldb_private::CommandObject::IsDashDashCommand ( )
inlinevirtual

◆ IsMultiwordObject()

virtual bool lldb_private::CommandObject::IsMultiwordObject ( )
inlinevirtual

◆ IsPairType()

bool CommandObject::IsPairType ( ArgumentRepetitionType  arg_repeat_type)

◆ IsRemovable()

virtual bool lldb_private::CommandObject::IsRemovable ( ) const
inlinevirtual

◆ LoadSubCommand()

virtual bool lldb_private::CommandObject::LoadSubCommand ( llvm::StringRef  cmd_name,
const lldb::CommandObjectSP &  command_obj 
)
inlinevirtual

◆ LookupArgumentName()

CommandArgumentType CommandObject::LookupArgumentName ( llvm::StringRef  arg_name)
static

◆ ParseOptions()

bool CommandObject::ParseOptions ( Args args,
CommandReturnObject result 
)

◆ ParseOptionsAndNotify()

bool CommandObject::ParseOptionsAndNotify ( Args args,
CommandReturnObject result,
OptionGroupOptions group_options,
ExecutionContext exe_ctx 
)
protected

◆ SetCommandName()

void CommandObject::SetCommandName ( llvm::StringRef  name)

◆ SetHelp()

void CommandObject::SetHelp ( llvm::StringRef  str)
virtual

◆ SetHelpLong()

void CommandObject::SetHelpLong ( llvm::StringRef  str)
virtual

◆ SetOverrideCallback() [1/2]

void lldb_private::CommandObject::SetOverrideCallback ( lldb::CommandOverrideCallback  callback,
void *  baton 
)
inline

◆ SetOverrideCallback() [2/2]

void lldb_private::CommandObject::SetOverrideCallback ( lldb::CommandOverrideCallbackWithResult  callback,
void *  baton 
)
inline

Definition at line 307 of file CommandObject.h.

References m_command_override_baton, and m_command_override_callback.

◆ SetSyntax()

void CommandObject::SetSyntax ( llvm::StringRef  str)

◆ WantsCompletion()

virtual bool lldb_private::CommandObject::WantsCompletion ( )
inlinevirtual

◆ WantsRawCommandString()

virtual bool lldb_private::CommandObject::WantsRawCommandString ( )
pure virtual

Member Data Documentation

◆ g_arguments_data

CommandObject::ArgumentTableEntry CommandObject::g_arguments_data
static

◆ m_api_locker

std::unique_lock<std::recursive_mutex> lldb_private::CommandObject::m_api_locker
protected

Definition at line 376 of file CommandObject.h.

Referenced by CheckRequirements(), and Cleanup().

◆ m_arguments

std::vector<CommandArgumentEntry> lldb_private::CommandObject::m_arguments
protected

◆ m_cmd_help_long

std::string lldb_private::CommandObject::m_cmd_help_long
protected

◆ m_cmd_help_short

std::string lldb_private::CommandObject::m_cmd_help_short
protected

◆ m_cmd_name

std::string lldb_private::CommandObject::m_cmd_name
protected

◆ m_cmd_syntax

std::string lldb_private::CommandObject::m_cmd_syntax
protected

Definition at line 380 of file CommandObject.h.

Referenced by CommandObject(), GetSyntax(), and SetSyntax().

◆ m_command_override_baton

void* lldb_private::CommandObject::m_command_override_baton
protected

Definition at line 385 of file CommandObject.h.

Referenced by InvokeOverrideCallback(), and SetOverrideCallback().

◆ m_command_override_callback

lldb::CommandOverrideCallbackWithResult lldb_private::CommandObject::m_command_override_callback
protected

◆ m_deprecated_command_override_callback

lldb::CommandOverrideCallback lldb_private::CommandObject::m_deprecated_command_override_callback
protected

◆ m_exe_ctx

ExecutionContext lldb_private::CommandObject::m_exe_ctx
protected

◆ m_flags

Flags lldb_private::CommandObject::m_flags
protected

Definition at line 381 of file CommandObject.h.

Referenced by GetFlags().

◆ m_interpreter

CommandInterpreter& lldb_private::CommandObject::m_interpreter
protected

The documentation for this class was generated from the following files: