LLDB  mainline
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
lldb::SBCommandInterpreter Class Reference

#include <SBCommandInterpreter.h>

Collaboration diagram for lldb::SBCommandInterpreter:
Collaboration graph
[legend]

Public Types

enum  {
  eBroadcastBitThreadShouldExit = (1 << 0), eBroadcastBitResetPrompt = (1 << 1), eBroadcastBitQuitCommandReceived = (1 << 2), eBroadcastBitAsynchronousOutputData = (1 << 3),
  eBroadcastBitAsynchronousErrorData = (1 << 4)
}
 

Public Member Functions

 SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs)
 
 ~SBCommandInterpreter ()
 
const lldb::SBCommandInterpreteroperator= (const lldb::SBCommandInterpreter &rhs)
 
 operator bool () const
 
bool IsValid () const
 
bool CommandExists (const char *cmd)
 
bool AliasExists (const char *cmd)
 
lldb::SBBroadcaster GetBroadcaster ()
 
bool HasCommands ()
 
bool HasAliases ()
 
bool HasAliasOptions ()
 
lldb::SBProcess GetProcess ()
 
lldb::SBDebugger GetDebugger ()
 
lldb::SBCommand AddMultiwordCommand (const char *name, const char *help)
 
lldb::SBCommand AddCommand (const char *name, lldb::SBCommandPluginInterface *impl, const char *help)
 Add a new command to the lldb::CommandInterpreter. More...
 
lldb::SBCommand AddCommand (const char *name, lldb::SBCommandPluginInterface *impl, const char *help, const char *syntax)
 Add a new command to the lldb::CommandInterpreter. More...
 
lldb::SBCommand AddCommand (const char *name, lldb::SBCommandPluginInterface *impl, const char *help, const char *syntax, const char *auto_repeat_command)
 Add a new command to the lldb::CommandInterpreter. More...
 
void SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result)
 
void SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result, bool is_repl)
 
void SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result)
 
lldb::ReturnStatus HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history=false)
 
lldb::ReturnStatus HandleCommand (const char *command_line, SBExecutionContext &exe_ctx, SBCommandReturnObject &result, bool add_to_history=false)
 
void HandleCommandsFromFile (lldb::SBFileSpec &file, lldb::SBExecutionContext &override_context, lldb::SBCommandInterpreterRunOptions &options, lldb::SBCommandReturnObject result)
 
int HandleCompletion (const char *current_line, const char *cursor, const char *last_char, int match_start_point, int max_return_elements, lldb::SBStringList &matches)
 
int HandleCompletion (const char *current_line, uint32_t cursor_pos, int match_start_point, int max_return_elements, lldb::SBStringList &matches)
 
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)
 
int HandleCompletionWithDescriptions (const char *current_line, uint32_t cursor_pos, int match_start_point, int max_return_elements, lldb::SBStringList &matches, lldb::SBStringList &descriptions)
 
bool WasInterrupted () const
 
bool SetCommandOverrideCallback (const char *command_name, lldb::CommandOverrideCallback callback, void *baton)
 
 SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr=nullptr)
 
bool IsActive ()
 Return true if the command interpreter is the active IO handler. More...
 
const char * GetIOHandlerControlSequence (char ch)
 Get the string that needs to be written to the debugger stdin file handle when a control character is typed. More...
 
bool GetPromptOnQuit ()
 
void SetPromptOnQuit (bool b)
 
void AllowExitCodeOnQuit (bool allow)
 Sets whether the command interpreter should allow custom exit codes for the 'quit' command. More...
 
bool HasCustomQuitExitCode ()
 Returns true if the user has called the 'quit' command with a custom exit code. More...
 
int GetQuitStatus ()
 Returns the exit code that the user has specified when running the 'quit' command. More...
 
void ResolveCommand (const char *command_line, SBCommandReturnObject &result)
 Resolve the command just as HandleCommand would, expanding abbreviations and aliases. More...
 

Static Public Member Functions

static const char * GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type)
 
static const char * GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type)
 
static bool EventIsCommandInterpreterEvent (const lldb::SBEvent &event)
 
static const char * GetBroadcasterClass ()
 

Protected Member Functions

lldb_private::CommandInterpreterref ()
 
lldb_private::CommandInterpreterget ()
 
void reset (lldb_private::CommandInterpreter *)
 

Private Attributes

lldb_private::CommandInterpreterm_opaque_ptr
 

Friends

class SBDebugger
 

Detailed Description

Definition at line 19 of file SBCommandInterpreter.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eBroadcastBitThreadShouldExit 
eBroadcastBitResetPrompt 
eBroadcastBitQuitCommandReceived 
eBroadcastBitAsynchronousOutputData 
eBroadcastBitAsynchronousErrorData 

Definition at line 21 of file SBCommandInterpreter.h.

Constructor & Destructor Documentation

◆ SBCommandInterpreter() [1/2]

SBCommandInterpreter::SBCommandInterpreter ( const lldb::SBCommandInterpreter rhs)

Definition at line 86 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_CONSTRUCTOR.

◆ ~SBCommandInterpreter()

SBCommandInterpreter::~SBCommandInterpreter ( )
default

◆ SBCommandInterpreter() [2/2]

SBCommandInterpreter::SBCommandInterpreter ( lldb_private::CommandInterpreter interpreter_ptr = nullptr)

Definition at line 79 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_CONSTRUCTOR.

Member Function Documentation

◆ AddCommand() [1/3]

lldb::SBCommand SBCommandInterpreter::AddCommand ( const char *  name,
lldb::SBCommandPluginInterface impl,
const char *  help 
)

Add a new command to the lldb::CommandInterpreter.

The new command won't support autorepeat. If you need this functionality, use the override of this function that accepts the auto_repeat_command parameter.

Parameters
[in]nameThe name of the command.
[in]implThe handler of this command.
[in]helpThe general description to show as part of the help message of this command.
Returns
A lldb::SBCommand representing the newly created command.

Definition at line 587 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_METHOD, and LLDB_RECORD_RESULT.

Referenced by AddCommand().

◆ AddCommand() [2/3]

lldb::SBCommand SBCommandInterpreter::AddCommand ( const char *  name,
lldb::SBCommandPluginInterface impl,
const char *  help,
const char *  syntax 
)

Add a new command to the lldb::CommandInterpreter.

The new command won't support autorepeat. If you need this functionality, use the override of this function that accepts the auto_repeat_command parameter.

Parameters
[in]nameThe name of the command.
[in]implThe handler of this command.
[in]helpThe general description to show as part of the help message of this command.
[in]syntaxThe syntax to show as part of the help message of this command. This could include a description of the different arguments and flags this command accepts.
Returns
A lldb::SBCommand representing the newly created command.

Definition at line 599 of file SBCommandInterpreter.cpp.

References AddCommand(), LLDB_RECORD_METHOD, and LLDB_RECORD_RESULT.

◆ AddCommand() [3/3]

lldb::SBCommand SBCommandInterpreter::AddCommand ( const char *  name,
lldb::SBCommandPluginInterface impl,
const char *  help,
const char *  syntax,
const char *  auto_repeat_command 
)

Add a new command to the lldb::CommandInterpreter.

Parameters
[in]nameThe name of the command.
[in]implThe handler of this command.
[in]helpThe general description to show as part of the help message of this command.
[in]syntaxThe syntax to show as part of the help message of this command. This could include a description of the different arguments and flags this command accepts.
[in]auto_repeat_commandAutorepeating is triggered when the user presses Enter successively after executing a command. If nullptr is provided, the previous exact command will be repeated. If "" is provided, autorepeating is disabled. Otherwise, the provided string is used as a repeat command.
Returns
A lldb::SBCommand representing the newly created command.

Definition at line 610 of file SBCommandInterpreter.cpp.

References AddCommand(), lldb_private::CommandInterpreter::AddUserCommand(), LLDB_RECORD_METHOD, LLDB_RECORD_RESULT, and m_opaque_ptr.

◆ AddMultiwordCommand()

lldb::SBCommand SBCommandInterpreter::AddMultiwordCommand ( const char *  name,
const char *  help 
)

◆ AliasExists()

bool SBCommandInterpreter::AliasExists ( const char *  cmd)

◆ AllowExitCodeOnQuit()

void SBCommandInterpreter::AllowExitCodeOnQuit ( bool  allow)

Sets whether the command interpreter should allow custom exit codes for the 'quit' command.

Definition at line 403 of file SBCommandInterpreter.cpp.

References lldb_private::CommandInterpreter::AllowExitCodeOnQuit(), LLDB_RECORD_METHOD, and m_opaque_ptr.

◆ CommandExists()

bool SBCommandInterpreter::CommandExists ( const char *  cmd)

◆ EventIsCommandInterpreterEvent()

bool SBCommandInterpreter::EventIsCommandInterpreterEvent ( const lldb::SBEvent event)
static

Definition at line 542 of file SBCommandInterpreter.cpp.

References GetBroadcasterClass(), and LLDB_RECORD_STATIC_METHOD.

◆ get()

CommandInterpreter * SBCommandInterpreter::get ( )
protected

Definition at line 442 of file SBCommandInterpreter.cpp.

References m_opaque_ptr.

Referenced by lldb::SBDebugger::Create().

◆ GetArgumentDescriptionAsCString()

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

Definition at line 533 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_STATIC_METHOD.

◆ GetArgumentTypeAsCString()

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

Definition at line 524 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_STATIC_METHOD.

◆ GetBroadcaster()

SBBroadcaster SBCommandInterpreter::GetBroadcaster ( )

◆ GetBroadcasterClass()

const char * SBCommandInterpreter::GetBroadcasterClass ( )
static

◆ GetDebugger()

SBDebugger SBCommandInterpreter::GetDebugger ( )

◆ GetIOHandlerControlSequence()

const char * SBCommandInterpreter::GetIOHandlerControlSequence ( char  ch)

Get the string that needs to be written to the debugger stdin file handle when a control character is typed.

Some GUI programs will intercept "control + char" sequences and want to have them do what normally would happen when using a real terminal, so this function allows GUI programs to emulate this functionality.

Parameters
[in]chThe character that was typed along with the control key
Returns
The string that should be written into the file handle that is feeding the input stream for the debugger, or nullptr if there is no string for this control key.

Definition at line 143 of file SBCommandInterpreter.cpp.

References lldb_private::ConstString::GetCString(), lldb_private::CommandInterpreter::GetDebugger(), lldb_private::Debugger::GetTopIOHandlerControlSequence(), IsValid(), LLDB_RECORD_METHOD, and m_opaque_ptr.

◆ GetProcess()

SBProcess SBCommandInterpreter::GetProcess ( )

◆ GetPromptOnQuit()

bool SBCommandInterpreter::GetPromptOnQuit ( )

◆ GetQuitStatus()

int SBCommandInterpreter::GetQuitStatus ( )

Returns the exit code that the user has specified when running the 'quit' command.

Returns 0 if the user hasn't called 'quit' at all or without a custom exit code.

Definition at line 420 of file SBCommandInterpreter.cpp.

References lldb_private::CommandInterpreter::GetQuitExitCode(), LLDB_RECORD_METHOD_NO_ARGS, and m_opaque_ptr.

◆ HandleCommand() [1/2]

lldb::ReturnStatus SBCommandInterpreter::HandleCommand ( const char *  command_line,
lldb::SBCommandReturnObject result,
bool  add_to_history = false 
)

Definition at line 155 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_METHOD.

Referenced by lldb::SBDebugger::HandleCommand(), and HandleCommand().

◆ HandleCommand() [2/2]

lldb::ReturnStatus SBCommandInterpreter::HandleCommand ( const char *  command_line,
SBExecutionContext exe_ctx,
SBCommandReturnObject result,
bool  add_to_history = false 
)

◆ HandleCommandsFromFile()

void SBCommandInterpreter::HandleCommandsFromFile ( lldb::SBFileSpec file,
lldb::SBExecutionContext override_context,
lldb::SBCommandInterpreterRunOptions options,
lldb::SBCommandReturnObject  result 
)

◆ HandleCompletion() [1/2]

int SBCommandInterpreter::HandleCompletion ( const char *  current_line,
const char *  cursor,
const char *  last_char,
int  match_start_point,
int  max_return_elements,
lldb::SBStringList matches 
)

Definition at line 225 of file SBCommandInterpreter.cpp.

References HandleCompletionWithDescriptions(), and LLDB_RECORD_METHOD.

Referenced by HandleCompletion().

◆ HandleCompletion() [2/2]

int SBCommandInterpreter::HandleCompletion ( const char *  current_line,
uint32_t  cursor_pos,
int  match_start_point,
int  max_return_elements,
lldb::SBStringList matches 
)

Definition at line 328 of file SBCommandInterpreter.cpp.

References HandleCompletion(), and LLDB_RECORD_METHOD.

◆ HandleCompletionWithDescriptions() [1/2]

int SBCommandInterpreter::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 
)

◆ HandleCompletionWithDescriptions() [2/2]

int SBCommandInterpreter::HandleCompletionWithDescriptions ( const char *  current_line,
uint32_t  cursor_pos,
int  match_start_point,
int  max_return_elements,
lldb::SBStringList matches,
lldb::SBStringList descriptions 
)

◆ HasAliases()

bool SBCommandInterpreter::HasAliases ( )

◆ HasAliasOptions()

bool SBCommandInterpreter::HasAliasOptions ( )

◆ HasCommands()

bool SBCommandInterpreter::HasCommands ( )

◆ HasCustomQuitExitCode()

bool SBCommandInterpreter::HasCustomQuitExitCode ( )

Returns true if the user has called the 'quit' command with a custom exit code.

Definition at line 411 of file SBCommandInterpreter.cpp.

References lldb_private::CommandInterpreter::GetQuitExitCode(), LLDB_RECORD_METHOD_NO_ARGS, and m_opaque_ptr.

◆ IsActive()

bool SBCommandInterpreter::IsActive ( )

Return true if the command interpreter is the active IO handler.

This indicates that any input coming into the debugger handles will go to the command interpreter and will result in LLDB command line commands being executed.

Definition at line 131 of file SBCommandInterpreter.cpp.

References lldb_private::CommandInterpreter::IsActive(), IsValid(), LLDB_RECORD_METHOD_NO_ARGS, and m_opaque_ptr.

◆ IsValid()

bool SBCommandInterpreter::IsValid ( ) const

◆ operator bool()

SBCommandInterpreter::operator bool ( ) const
explicit

Definition at line 109 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_METHOD_CONST_NO_ARGS.

◆ operator=()

const SBCommandInterpreter & SBCommandInterpreter::operator= ( const lldb::SBCommandInterpreter rhs)

Definition at line 95 of file SBCommandInterpreter.cpp.

References LLDB_RECORD_METHOD, LLDB_RECORD_RESULT, and m_opaque_ptr.

◆ ref()

CommandInterpreter & SBCommandInterpreter::ref ( )
protected

Definition at line 444 of file SBCommandInterpreter.cpp.

References m_opaque_ptr.

◆ reset()

void SBCommandInterpreter::reset ( lldb_private::CommandInterpreter interpreter)
protected

Definition at line 449 of file SBCommandInterpreter.cpp.

References m_opaque_ptr.

Referenced by lldb::SBDebugger::GetCommandInterpreter().

◆ ResolveCommand()

void SBCommandInterpreter::ResolveCommand ( const char *  command_line,
SBCommandReturnObject result 
)

Resolve the command just as HandleCommand would, expanding abbreviations and aliases.

If successful, result->GetOutput has the full expansion.

Definition at line 427 of file SBCommandInterpreter.cpp.

References lldb_private::CommandReturnObject::AppendError(), lldb::SBCommandReturnObject::Clear(), IsValid(), LLDB_RECORD_METHOD, m_opaque_ptr, lldb::SBCommandReturnObject::ref(), and lldb_private::CommandInterpreter::ResolveCommand().

◆ SetCommandOverrideCallback()

bool SBCommandInterpreter::SetCommandOverrideCallback ( const char *  command_name,
lldb::CommandOverrideCallback  callback,
void *  baton 
)

◆ SetPromptOnQuit()

void SBCommandInterpreter::SetPromptOnQuit ( bool  b)

◆ SourceInitFileInCurrentWorkingDirectory()

void SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory ( lldb::SBCommandReturnObject result)

◆ SourceInitFileInHomeDirectory() [1/2]

void SBCommandInterpreter::SourceInitFileInHomeDirectory ( lldb::SBCommandReturnObject result)

◆ SourceInitFileInHomeDirectory() [2/2]

void SBCommandInterpreter::SourceInitFileInHomeDirectory ( lldb::SBCommandReturnObject result,
bool  is_repl 
)

◆ WasInterrupted()

bool SBCommandInterpreter::WasInterrupted ( ) const

Friends And Related Function Documentation

◆ SBDebugger

friend class SBDebugger
friend

Definition at line 274 of file SBCommandInterpreter.h.

Member Data Documentation

◆ m_opaque_ptr

lldb_private::CommandInterpreter* lldb::SBCommandInterpreter::m_opaque_ptr
private

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