1 //===-- SWIG Interface for SBCommandInterpreter -----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
13 "SBCommandInterpreterRunOptions controls how the RunCommandInterpreter runs the code it is fed.
14 A default SBCommandInterpreterRunOptions object has:
23 ") SBCommandInterpreterRunOptions;
24 class SBCommandInterpreterRunOptions
26 friend class SBDebugger;
28 SBCommandInterpreterRunOptions();
29 ~SBCommandInterpreterRunOptions();
32 GetStopOnContinue () const;
35 SetStopOnContinue (bool);
38 GetStopOnError () const;
41 SetStopOnError (bool);
44 GetStopOnCrash () const;
47 SetStopOnCrash (bool);
50 GetEchoCommands () const;
53 SetEchoCommands (bool);
56 GetPrintResults () const;
59 SetPrintResults (bool);
62 GetAddToHistory () const;
65 SetAddToHistory (bool);
67 lldb_private::CommandInterpreterRunOptions *
70 lldb_private::CommandInterpreterRunOptions &
73 // This is set in the constructor and will always be valid.
74 mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions> m_opaque_up;
78 "SBCommandInterpreter handles/interprets commands for lldb. You get the
79 command interpreter from the SBDebugger instance. For example (from test/
80 python_api/interpreter/TestCommandInterpreterAPI.py),
82 def command_interpreter_api(self):
83 '''Test the SBCommandInterpreter APIs.'''
84 exe = os.path.join(os.getcwd(), 'a.out')
86 # Create a target by the debugger.
87 target = self.dbg.CreateTarget(exe)
88 self.assertTrue(target, VALID_TARGET)
90 # Retrieve the associated command interpreter from our debugger.
91 ci = self.dbg.GetCommandInterpreter()
92 self.assertTrue(ci, VALID_COMMAND_INTERPRETER)
94 # Exercise some APIs....
96 self.assertTrue(ci.HasCommands())
97 self.assertTrue(ci.HasAliases())
98 self.assertTrue(ci.HasAliasOptions())
99 self.assertTrue(ci.CommandExists('breakpoint'))
100 self.assertTrue(ci.CommandExists('target'))
101 self.assertTrue(ci.CommandExists('platform'))
102 self.assertTrue(ci.AliasExists('file'))
103 self.assertTrue(ci.AliasExists('run'))
104 self.assertTrue(ci.AliasExists('bt'))
106 res = lldb.SBCommandReturnObject()
107 ci.HandleCommand('breakpoint set -f main.c -l %d' % self.line, res)
108 self.assertTrue(res.Succeeded())
109 ci.HandleCommand('process launch', res)
110 self.assertTrue(res.Succeeded())
112 process = ci.GetProcess()
113 self.assertTrue(process)
117 The HandleCommand() instance method takes two args: the command string and
118 an SBCommandReturnObject instance which encapsulates the result of command
120 ") SBCommandInterpreter;
121 class SBCommandInterpreter
126 eBroadcastBitThreadShouldExit = (1 << 0),
127 eBroadcastBitResetPrompt = (1 << 1),
128 eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
129 eBroadcastBitAsynchronousOutputData = (1 << 3),
130 eBroadcastBitAsynchronousErrorData = (1 << 4)
133 SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
135 ~SBCommandInterpreter ();
138 GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
141 GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
144 EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
150 GetIOHandlerControlSequence(char ch);
156 SetPromptOnQuit(bool b);
159 ResolveCommand(const char *command_line, SBCommandReturnObject &result);
162 CommandExists (const char *cmd);
165 AliasExists (const char *cmd);
171 GetBroadcasterClass ();
189 SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
192 SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result);
195 HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
198 HandleCommand (const char *command_line, SBExecutionContext &exe_ctx, SBCommandReturnObject &result, bool add_to_history = false);
201 HandleCommandsFromFile (lldb::SBFileSpec &file,
202 lldb::SBExecutionContext &override_context,
203 lldb::SBCommandInterpreterRunOptions &options,
204 lldb::SBCommandReturnObject result);
207 HandleCompletion (const char *current_line,
209 int match_start_point,
210 int max_return_elements,
211 lldb::SBStringList &matches);