1 //===-- SBDebugger.h --------------------------------------------*- 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 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBDebugger_h_
11 #define LLDB_SBDebugger_h_
15 #include "lldb/API/SBDefines.h"
16 #include "lldb/API/SBPlatform.h"
26 SBError Initialize(lldb::SBDebugger&, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool);
28 bool IsActive() const;
41 // Deprecated, use the one that takes a source_init_files bool.
42 static lldb::SBDebugger
45 static lldb::SBDebugger
46 Create(bool source_init_files);
48 static lldb::SBDebugger
49 Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton);
52 Destroy (lldb::SBDebugger &debugger);
55 MemoryPressureDetected ();
59 SBDebugger(const lldb::SBDebugger &rhs);
61 SBDebugger(const lldb::DebuggerSP &debugger_sp);
64 operator = (const lldb::SBDebugger &rhs);
81 SkipLLDBInitFiles (bool b);
84 SkipAppInitFiles (bool b);
87 SetInputFileHandle (FILE *f, bool transfer_ownership);
90 SetOutputFileHandle (FILE *f, bool transfer_ownership);
93 SetErrorFileHandle (FILE *f, bool transfer_ownership);
96 GetInputFileHandle ();
99 GetOutputFileHandle ();
102 GetErrorFileHandle ();
105 SaveInputTerminalState();
108 RestoreInputTerminalState();
110 lldb::SBCommandInterpreter
111 GetCommandInterpreter ();
114 HandleCommand (const char *command);
120 HandleProcessEvent (const lldb::SBProcess &process,
121 const lldb::SBEvent &event,
126 CreateTarget (const char *filename,
127 const char *target_triple,
128 const char *platform_name,
129 bool add_dependent_modules,
130 lldb::SBError& error);
133 CreateTargetWithFileAndTargetTriple (const char *filename,
134 const char *target_triple);
137 CreateTargetWithFileAndArch (const char *filename,
138 const char *archname);
141 CreateTarget (const char *filename);
143 // Return true if target is deleted from the target list of the debugger.
145 DeleteTarget (lldb::SBTarget &target);
148 GetTargetAtIndex (uint32_t idx);
151 GetIndexOfTarget (lldb::SBTarget target);
154 FindTargetWithProcessID (pid_t pid);
157 FindTargetWithFileAndArch (const char *filename,
164 GetSelectedTarget ();
167 SetSelectedTarget (SBTarget& target);
170 GetSelectedPlatform();
173 SetSelectedPlatform(lldb::SBPlatform &platform);
175 lldb::SBSourceManager
178 // REMOVE: just for a quick fix, need to expose platforms through
179 // SBPlatform from this class.
181 SetCurrentPlatform (const char *platform_name);
184 SetCurrentPlatformSDKRoot (const char *sysroot);
186 // FIXME: Once we get the set show stuff in place, the driver won't need
187 // an interface to the Set/Get UseExternalEditor.
189 SetUseExternalEditor (bool input);
192 GetUseExternalEditor ();
195 SetUseColor (bool use_color);
198 GetUseColor () const;
201 GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
204 SetDefaultArchitecture (const char *arch_name);
207 GetScriptingLanguage (const char *script_language_name);
213 StateAsCString (lldb::StateType state);
216 StateIsRunningState (lldb::StateType state);
219 StateIsStoppedState (lldb::StateType state);
222 EnableLog (const char *channel, const char **categories);
225 SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
229 DispatchInput (void* baton,
234 DispatchInput (const void *data, size_t data_len);
237 DispatchInputInterrupt ();
240 DispatchInputEndOfFile ();
243 PushInputReader (lldb::SBInputReader &reader);
249 FindDebuggerWithID (int id);
252 SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
254 static lldb::SBStringList
255 GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
258 GetDescription (lldb::SBStream &description);
261 GetTerminalWidth () const;
264 SetTerminalWidth (uint32_t term_width);
273 SetPrompt (const char *prompt);
276 GetScriptLanguage() const;
279 SetScriptLanguage (lldb::ScriptLanguage script_lang);
282 GetCloseInputOnEOF () const;
285 SetCloseInputOnEOF (bool b);
288 GetCategory (const char* category_name);
291 CreateCategory (const char* category_name);
294 DeleteCategory (const char* category_name);
300 GetCategoryAtIndex (uint32_t);
303 GetDefaultCategory();
306 GetFormatForType (SBTypeNameSpecifier);
308 #ifndef LLDB_DISABLE_PYTHON
310 GetSummaryForType (SBTypeNameSpecifier);
314 GetFilterForType (SBTypeNameSpecifier);
316 #ifndef LLDB_DISABLE_PYTHON
318 GetSyntheticForType (SBTypeNameSpecifier);
322 RunCommandInterpreter (bool auto_handle_events,
326 RunCommandInterpreter (bool auto_handle_events,
328 SBCommandInterpreterRunOptions &options,
330 bool &quit_requested,
331 bool &stopped_for_crash);
334 friend class SBCommandInterpreter;
335 friend class SBInputReader;
336 friend class SBListener;
337 friend class SBProcess;
338 friend class SBSourceManager;
339 friend class SBTarget;
342 FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
345 reset (const lldb::DebuggerSP &debugger_sp);
347 lldb_private::Debugger *
350 lldb_private::Debugger &
353 const lldb::DebuggerSP &
356 lldb::DebuggerSP m_opaque_sp;
358 }; // class SBDebugger
363 #endif // LLDB_SBDebugger_h_