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