46 lines · plain
1%feature("docstring",2"SBCommandInterpreter handles/interprets commands for lldb.3 4You get the command interpreter from the :py:class:`SBDebugger` instance.5 6For example (from test/ python_api/interpreter/TestCommandInterpreterAPI.py),::7 8 def command_interpreter_api(self):9 '''Test the SBCommandInterpreter APIs.'''10 exe = os.path.join(os.getcwd(), 'a.out')11 12 # Create a target by the debugger.13 target = self.dbg.CreateTarget(exe)14 self.assertTrue(target, VALID_TARGET)15 16 # Retrieve the associated command interpreter from our debugger.17 ci = self.dbg.GetCommandInterpreter()18 self.assertTrue(ci, VALID_COMMAND_INTERPRETER)19 20 # Exercise some APIs....21 22 self.assertTrue(ci.HasCommands())23 self.assertTrue(ci.HasAliases())24 self.assertTrue(ci.HasAliasOptions())25 self.assertTrue(ci.CommandExists('breakpoint'))26 self.assertTrue(ci.CommandExists('target'))27 self.assertTrue(ci.CommandExists('platform'))28 self.assertTrue(ci.AliasExists('file'))29 self.assertTrue(ci.AliasExists('run'))30 self.assertTrue(ci.AliasExists('bt'))31 32 res = lldb.SBCommandReturnObject()33 ci.HandleCommand('breakpoint set -f main.c -l %d' % self.line, res)34 self.assertTrue(res.Succeeded())35 ci.HandleCommand('process launch', res)36 self.assertTrue(res.Succeeded())37 38 process = ci.GetProcess()39 self.assertTrue(process)40 41 ...42 43The HandleCommand() instance method takes two args: the command string and44an SBCommandReturnObject instance which encapsulates the result of command45execution.") lldb::SBCommandInterpreter;46