LLDB API Documentation

SBDebugger.h
Go to the documentation of this file.
1 //===-- SBDebugger.h --------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_SBDebugger_h_
11 #define LLDB_SBDebugger_h_
12 
13 #include "lldb/API/SBDefines.h"
14 #include <stdio.h>
15 
16 namespace lldb {
17 
19 {
20 public:
21 
22  static void
23  Initialize();
24 
25  static void
26  Terminate();
27 
28  // Deprecated, use the one that takes a source_init_files bool.
29  static lldb::SBDebugger
30  Create();
31 
32  static lldb::SBDebugger
33  Create(bool source_init_files);
34 
35  static lldb::SBDebugger
36  Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton);
37 
38  static void
39  Destroy (lldb::SBDebugger &debugger);
40 
41  static void
43 
44  SBDebugger();
45 
46  SBDebugger(const lldb::SBDebugger &rhs);
47 
48  SBDebugger(const lldb::DebuggerSP &debugger_sp);
49 
51  operator = (const lldb::SBDebugger &rhs);
52 
53  ~SBDebugger();
54 
55  bool
56  IsValid() const;
57 
58  void
59  Clear ();
60 
61  void
62  SetAsync (bool b);
63 
64  bool
65  GetAsync ();
66 
67  void
68  SkipLLDBInitFiles (bool b);
69 
70  void
71  SkipAppInitFiles (bool b);
72 
73  void
74  SetInputFileHandle (FILE *f, bool transfer_ownership);
75 
76  void
77  SetOutputFileHandle (FILE *f, bool transfer_ownership);
78 
79  void
80  SetErrorFileHandle (FILE *f, bool transfer_ownership);
81 
82  FILE *
84 
85  FILE *
87 
88  FILE *
90 
91  void
93 
94  void
96 
99 
100  void
101  HandleCommand (const char *command);
102 
104  GetListener ();
105 
106  void
107  HandleProcessEvent (const lldb::SBProcess &process,
108  const lldb::SBEvent &event,
109  FILE *out,
110  FILE *err);
111 
113  CreateTarget (const char *filename,
114  const char *target_triple,
115  const char *platform_name,
116  bool add_dependent_modules,
117  lldb::SBError& error);
118 
120  CreateTargetWithFileAndTargetTriple (const char *filename,
121  const char *target_triple);
122 
124  CreateTargetWithFileAndArch (const char *filename,
125  const char *archname);
126 
128  CreateTarget (const char *filename);
129 
130  // Return true if target is deleted from the target list of the debugger.
131  bool
132  DeleteTarget (lldb::SBTarget &target);
133 
135  GetTargetAtIndex (uint32_t idx);
136 
137  uint32_t
139 
141  FindTargetWithProcessID (pid_t pid);
142 
144  FindTargetWithFileAndArch (const char *filename,
145  const char *arch);
146 
147  uint32_t
148  GetNumTargets ();
149 
152 
153  void
154  SetSelectedTarget (SBTarget& target);
155 
157  GetSourceManager ();
158 
159  // REMOVE: just for a quick fix, need to expose platforms through
160  // SBPlatform from this class.
162  SetCurrentPlatform (const char *platform_name);
163 
164  bool
165  SetCurrentPlatformSDKRoot (const char *sysroot);
166 
167  // FIXME: Once we get the set show stuff in place, the driver won't need
168  // an interface to the Set/Get UseExternalEditor.
169  bool
170  SetUseExternalEditor (bool input);
171 
172  bool
174 
175  bool
176  SetUseColor (bool use_color);
177 
178  bool
179  GetUseColor () const;
180 
181  static bool
182  GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
183 
184  static bool
185  SetDefaultArchitecture (const char *arch_name);
186 
187  lldb::ScriptLanguage
188  GetScriptingLanguage (const char *script_language_name);
189 
190  static const char *
191  GetVersionString ();
192 
193  static const char *
194  StateAsCString (lldb::StateType state);
195 
196  static bool
197  StateIsRunningState (lldb::StateType state);
198 
199  static bool
200  StateIsStoppedState (lldb::StateType state);
201 
202  bool
203  EnableLog (const char *channel, const char **categories);
204 
205  void
206  SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
207 
208  // DEPRECATED
209  void
210  DispatchInput (void* baton,
211  const void* data,
212  size_t data_len);
213 
214  void
215  DispatchInput (const void *data, size_t data_len);
216 
217  void
219 
220  void
222 
223  void
225 
226  void
227  NotifyTopInputReader (lldb::InputReaderAction notification);
228 
229  bool
231 
232  const char *
233  GetInstanceName ();
234 
235  static SBDebugger
236  FindDebuggerWithID (int id);
237 
238  static lldb::SBError
239  SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
240 
241  static lldb::SBStringList
242  GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
243 
244  bool
245  GetDescription (lldb::SBStream &description);
246 
247  uint32_t
248  GetTerminalWidth () const;
249 
250  void
251  SetTerminalWidth (uint32_t term_width);
252 
253  lldb::user_id_t
254  GetID ();
255 
256  const char *
257  GetPrompt() const;
258 
259  void
260  SetPrompt (const char *prompt);
261 
262  lldb::ScriptLanguage
263  GetScriptLanguage() const;
264 
265  void
266  SetScriptLanguage (lldb::ScriptLanguage script_lang);
267 
268  bool
269  GetCloseInputOnEOF () const;
270 
271  void
272  SetCloseInputOnEOF (bool b);
273 
275  GetCategory (const char* category_name);
276 
278  CreateCategory (const char* category_name);
279 
280  bool
281  DeleteCategory (const char* category_name);
282 
283  uint32_t
284  GetNumCategories ();
285 
287  GetCategoryAtIndex (uint32_t);
288 
291 
294 
295 #ifndef LLDB_DISABLE_PYTHON
298 #endif
299 
302 
303 #ifndef LLDB_DISABLE_PYTHON
306 #endif
307 
308 private:
309 
310  friend class SBCommandInterpreter;
311  friend class SBInputReader;
312  friend class SBListener;
313  friend class SBProcess;
314  friend class SBSourceManager;
315  friend class SBTarget;
316 
318  FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
319 
320  void
321  reset (const lldb::DebuggerSP &debugger_sp);
322 
323  lldb_private::Debugger *
324  get () const;
325 
326  lldb_private::Debugger &
327  ref () const;
328 
329  const lldb::DebuggerSP &
330  get_sp () const;
331 
332  lldb::DebuggerSP m_opaque_sp;
333 
334 }; // class SBDebugger
335 
336 
337 } // namespace lldb
338 
339 #endif // LLDB_SBDebugger_h_