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