SBCommandInterpreter#

class lldb.SBCommandInterpreter(*args)#

SBCommandInterpreter handles/interprets commands for lldb.

You get the command interpreter from the SBDebugger instance.

For example (from test/ python_api/interpreter/TestCommandInterpreterAPI.py),:

def command_interpreter_api(self):
    '''Test the SBCommandInterpreter APIs.'''
    exe = os.path.join(os.getcwd(), 'a.out')

    # Create a target by the debugger.
    target = self.dbg.CreateTarget(exe)
    self.assertTrue(target, VALID_TARGET)

    # Retrieve the associated command interpreter from our debugger.
    ci = self.dbg.GetCommandInterpreter()
    self.assertTrue(ci, VALID_COMMAND_INTERPRETER)

    # Exercise some APIs....

    self.assertTrue(ci.HasCommands())
    self.assertTrue(ci.HasAliases())
    self.assertTrue(ci.HasAliasOptions())
    self.assertTrue(ci.CommandExists('breakpoint'))
    self.assertTrue(ci.CommandExists('target'))
    self.assertTrue(ci.CommandExists('platform'))
    self.assertTrue(ci.AliasExists('file'))
    self.assertTrue(ci.AliasExists('run'))
    self.assertTrue(ci.AliasExists('bt'))

    res = lldb.SBCommandReturnObject()
    ci.HandleCommand('breakpoint set -f main.c -l %d' % self.line, res)
    self.assertTrue(res.Succeeded())
    ci.HandleCommand('process launch', res)
    self.assertTrue(res.Succeeded())

    process = ci.GetProcess()
    self.assertTrue(process)

    ...

The HandleCommand() instance method takes two args: the command string and an SBCommandReturnObject instance which encapsulates the result of command execution.

Attributes Summary

Methods Summary

AliasExists(SBCommandInterpreter self, ...)

AllowExitCodeOnQuit(...)

CommandExists(SBCommandInterpreter self, ...)

EventIsCommandInterpreterEvent(SBEvent event)

GetArgumentDescriptionAsCString(lldb)

GetArgumentTypeAsCString(lldb)

GetBroadcaster(SBCommandInterpreter self)

GetBroadcasterClass()

GetDebugger(SBCommandInterpreter self)

GetIOHandlerControlSequence(...)

GetProcess(SBCommandInterpreter self)

GetPromptOnQuit(SBCommandInterpreter self)

GetQuitStatus(SBCommandInterpreter self)

GetStatistics(SBCommandInterpreter self)

GetTranscript(SBCommandInterpreter self)

HandleCommand(-> lldb)

HandleCommandsFromFile(...)

HandleCompletion(SBCommandInterpreter self, ...)

HandleCompletionWithDescriptions(...)

HasAliasOptions(SBCommandInterpreter self)

HasAliases(SBCommandInterpreter self)

HasCommands(SBCommandInterpreter self)

HasCustomQuitExitCode(SBCommandInterpreter self)

InterruptCommand(SBCommandInterpreter self)

IsActive(SBCommandInterpreter self)

IsInteractive(SBCommandInterpreter self)

IsValid(SBCommandInterpreter self)

ResolveCommand(SBCommandInterpreter self, ...)

SetCommandOverrideCallback(...)

SetPromptOnQuit(SBCommandInterpreter self, ...)

SourceInitFileInCurrentWorkingDirectory(...)

SourceInitFileInHomeDirectory()

UserCommandExists(SBCommandInterpreter self, ...)

WasInterrupted(SBCommandInterpreter self)

Attributes Documentation

eBroadcastBitAsynchronousErrorData = <Mock name='mock.SBCommandInterpreter_eBroadcastBitAsynchronousErrorData' id='140438895498480'>#
eBroadcastBitAsynchronousOutputData = <Mock name='mock.SBCommandInterpreter_eBroadcastBitAsynchronousOutputData' id='140438895498096'>#
eBroadcastBitQuitCommandReceived = <Mock name='mock.SBCommandInterpreter_eBroadcastBitQuitCommandReceived' id='140438895498336'>#
eBroadcastBitResetPrompt = <Mock name='mock.SBCommandInterpreter_eBroadcastBitResetPrompt' id='140438895498912'>#
eBroadcastBitThreadShouldExit = <Mock name='mock.SBCommandInterpreter_eBroadcastBitThreadShouldExit' id='140438895498000'>#

Methods Documentation

AliasExists(SBCommandInterpreter self, char const * cmd) bool#
AllowExitCodeOnQuit(SBCommandInterpreter self, bool allow)#
CommandExists(SBCommandInterpreter self, char const * cmd) bool#
static EventIsCommandInterpreterEvent(SBEvent event) bool#
static GetArgumentDescriptionAsCString(lldb::CommandArgumentType const arg_type) char const *#
static GetArgumentTypeAsCString(lldb::CommandArgumentType const arg_type) char const *#
GetBroadcaster(SBCommandInterpreter self) SBBroadcaster#
static GetBroadcasterClass() char const *#
GetDebugger(SBCommandInterpreter self) SBDebugger#
GetIOHandlerControlSequence(SBCommandInterpreter self, char ch) char const *#
GetProcess(SBCommandInterpreter self) SBProcess#
GetPromptOnQuit(SBCommandInterpreter self) bool#
GetQuitStatus(SBCommandInterpreter self) int#
GetStatistics(SBCommandInterpreter self) SBStructuredData#
GetTranscript(SBCommandInterpreter self) SBStructuredData#
HandleCommand(SBCommandInterpreter self, char const * command_line, SBCommandReturnObject result, bool add_to_history=False) lldb::ReturnStatus#
HandleCommand(SBCommandInterpreter self, char const * command_line, SBExecutionContext exe_ctx, SBCommandReturnObject result, bool add_to_history=False) lldb::ReturnStatus
HandleCommandsFromFile(SBCommandInterpreter self, SBFileSpec file, SBExecutionContext override_context, SBCommandInterpreterRunOptions options, SBCommandReturnObject result)#
HandleCompletion(SBCommandInterpreter self, char const * current_line, uint32_t cursor_pos, int match_start_point, int max_return_elements, SBStringList matches) int#
HandleCompletionWithDescriptions(SBCommandInterpreter self, char const * current_line, uint32_t cursor_pos, int match_start_point, int max_return_elements, SBStringList matches, SBStringList descriptions) int#
HasAliasOptions(SBCommandInterpreter self) bool#
HasAliases(SBCommandInterpreter self) bool#
HasCommands(SBCommandInterpreter self) bool#
HasCustomQuitExitCode(SBCommandInterpreter self) bool#
InterruptCommand(SBCommandInterpreter self) bool#
IsActive(SBCommandInterpreter self) bool#
IsInteractive(SBCommandInterpreter self) bool#
IsValid(SBCommandInterpreter self) bool#
ResolveCommand(SBCommandInterpreter self, char const * command_line, SBCommandReturnObject result)#
SetCommandOverrideCallback(SBCommandInterpreter self, char const * command_name, lldb::CommandOverrideCallback callback) bool#
SetPromptOnQuit(SBCommandInterpreter self, bool b)#
SourceInitFileInCurrentWorkingDirectory(SBCommandInterpreter self, SBCommandReturnObject result)#
SourceInitFileInHomeDirectory(SBCommandInterpreter self, SBCommandReturnObject result)#
SourceInitFileInHomeDirectory(SBCommandInterpreter self, SBCommandReturnObject result, bool is_repl) None
UserCommandExists(SBCommandInterpreter self, char const * cmd) bool#
WasInterrupted(SBCommandInterpreter self) bool#