xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBCommandInterpreterDocstrings.i (revision 725a9f47324d42037db93c27ceb40d4956872f3e)
1 %feature("docstring",
2 "SBCommandInterpreter handles/interprets commands for lldb.
3 
4 You get the command interpreter from the :py:class:`SBDebugger` instance.
5 
6 For 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 
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;
46