2 "SBCommandInterpreter handles/interprets commands for lldb.
4 You get the command interpreter from the :py:class:`SBDebugger` instance.
6 For example (from test/ python_api/interpreter/TestCommandInterpreterAPI.py),::
8 def command_interpreter_api(self):
9 '''Test the SBCommandInterpreter APIs.'''
10 exe = os.path.join(os.getcwd(), 'a.out')
12 # Create a target by the debugger.
13 target = self.dbg.CreateTarget(exe)
14 self.assertTrue(target, VALID_TARGET)
16 # Retrieve the associated command interpreter from our debugger.
17 ci = self.dbg.GetCommandInterpreter()
18 self.assertTrue(ci, VALID_COMMAND_INTERPRETER)
20 # Exercise some APIs....
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'))
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())
38 process = ci.GetProcess()
39 self.assertTrue(process)
43 The HandleCommand() instance method takes two args: the command string and
44 an SBCommandReturnObject instance which encapsulates the result of command
45 execution.") lldb
::SBCommandInterpreter
;