]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBDebugger.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / tools / lldb / include / lldb / API / SBDebugger.h
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 <stdio.h>
14
15 #include "lldb/API/SBDefines.h"
16 #include "lldb/API/SBPlatform.h"
17
18 namespace lldb {
19
20     
21 class SBInputReader
22 {
23 public:
24     SBInputReader();
25     ~SBInputReader();
26     SBError Initialize(lldb::SBDebugger&, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool);
27     void SetIsDone(bool);
28     bool IsActive() const;
29 };
30 class SBDebugger
31 {
32 public:
33
34     static void
35     Initialize();
36     
37     static void
38     Terminate();
39     
40     // Deprecated, use the one that takes a source_init_files bool.
41     static lldb::SBDebugger
42     Create();
43
44     static lldb::SBDebugger
45     Create(bool source_init_files);
46
47     static lldb::SBDebugger
48     Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton);
49
50     static void
51     Destroy (lldb::SBDebugger &debugger);
52
53     static void
54     MemoryPressureDetected ();
55
56     SBDebugger();
57
58     SBDebugger(const lldb::SBDebugger &rhs);
59
60     SBDebugger(const lldb::DebuggerSP &debugger_sp);
61     
62     lldb::SBDebugger &
63     operator = (const lldb::SBDebugger &rhs);
64     
65     ~SBDebugger();
66
67     bool
68     IsValid() const;
69
70     void
71     Clear ();
72
73     void
74     SetAsync (bool b);
75     
76     bool 
77     GetAsync ();
78
79     void
80     SkipLLDBInitFiles (bool b);
81
82     void
83     SkipAppInitFiles (bool b);
84
85     void
86     SetInputFileHandle (FILE *f, bool transfer_ownership);
87
88     void
89     SetOutputFileHandle (FILE *f, bool transfer_ownership);
90
91     void
92     SetErrorFileHandle (FILE *f, bool transfer_ownership);
93     
94     FILE *
95     GetInputFileHandle ();
96
97     FILE *
98     GetOutputFileHandle ();
99
100     FILE *
101     GetErrorFileHandle ();
102
103     void
104     SaveInputTerminalState();
105     
106     void
107     RestoreInputTerminalState();
108
109     lldb::SBCommandInterpreter
110     GetCommandInterpreter ();
111
112     void
113     HandleCommand (const char *command);
114
115     lldb::SBListener
116     GetListener ();
117
118     void
119     HandleProcessEvent (const lldb::SBProcess &process,
120                         const lldb::SBEvent &event,
121                         FILE *out,
122                         FILE *err);
123
124     lldb::SBTarget
125     CreateTarget (const char *filename,
126                   const char *target_triple,
127                   const char *platform_name,
128                   bool add_dependent_modules,
129                   lldb::SBError& error);
130
131     lldb::SBTarget
132     CreateTargetWithFileAndTargetTriple (const char *filename,
133                                          const char *target_triple);
134
135     lldb::SBTarget
136     CreateTargetWithFileAndArch (const char *filename,
137                                  const char *archname);
138
139     lldb::SBTarget
140     CreateTarget (const char *filename);
141
142     // Return true if target is deleted from the target list of the debugger.
143     bool
144     DeleteTarget (lldb::SBTarget &target);
145
146     lldb::SBTarget
147     GetTargetAtIndex (uint32_t idx);
148     
149     uint32_t
150     GetIndexOfTarget (lldb::SBTarget target);
151
152     lldb::SBTarget
153     FindTargetWithProcessID (pid_t pid);
154
155     lldb::SBTarget
156     FindTargetWithFileAndArch (const char *filename,
157                                const char *arch);
158
159     uint32_t
160     GetNumTargets ();
161
162     lldb::SBTarget
163     GetSelectedTarget ();
164
165     void
166     SetSelectedTarget (SBTarget& target);
167
168     lldb::SBPlatform
169     GetSelectedPlatform();
170
171     void
172     SetSelectedPlatform(lldb::SBPlatform &platform);
173
174     lldb::SBSourceManager
175     GetSourceManager ();
176
177     // REMOVE: just for a quick fix, need to expose platforms through
178     // SBPlatform from this class.
179     lldb::SBError
180     SetCurrentPlatform (const char *platform_name);
181     
182     bool
183     SetCurrentPlatformSDKRoot (const char *sysroot);
184
185     // FIXME: Once we get the set show stuff in place, the driver won't need
186     // an interface to the Set/Get UseExternalEditor.
187     bool
188     SetUseExternalEditor (bool input);
189     
190     bool 
191     GetUseExternalEditor ();
192
193     bool
194     SetUseColor (bool use_color);
195
196     bool
197     GetUseColor () const;
198
199     static bool
200     GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
201
202     static bool
203     SetDefaultArchitecture (const char *arch_name);
204
205     lldb::ScriptLanguage
206     GetScriptingLanguage (const char *script_language_name);
207
208     static const char *
209     GetVersionString ();
210
211     static const char *
212     StateAsCString (lldb::StateType state);
213
214     static bool
215     StateIsRunningState (lldb::StateType state);
216
217     static bool
218     StateIsStoppedState (lldb::StateType state);
219     
220     bool
221     EnableLog (const char *channel, const char **categories);
222
223     void
224     SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
225     
226     // DEPRECATED
227     void
228     DispatchInput (void* baton,
229                    const void* data,
230                    size_t data_len);
231     
232     void
233     DispatchInput (const void *data, size_t data_len);
234
235     void
236     DispatchInputInterrupt ();
237
238     void
239     DispatchInputEndOfFile ();
240     
241     void
242     PushInputReader (lldb::SBInputReader &reader);
243
244     const char *
245     GetInstanceName  ();
246
247     static SBDebugger
248     FindDebuggerWithID (int id);
249
250     static lldb::SBError
251     SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
252
253     static lldb::SBStringList
254     GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
255
256     bool
257     GetDescription (lldb::SBStream &description);
258
259     uint32_t
260     GetTerminalWidth () const;
261
262     void
263     SetTerminalWidth (uint32_t term_width);
264
265     lldb::user_id_t
266     GetID ();
267     
268     const char *
269     GetPrompt() const;
270
271     void
272     SetPrompt (const char *prompt);
273         
274     lldb::ScriptLanguage 
275     GetScriptLanguage() const;
276
277     void
278     SetScriptLanguage (lldb::ScriptLanguage script_lang);
279
280     bool
281     GetCloseInputOnEOF () const;
282     
283     void
284     SetCloseInputOnEOF (bool b);
285
286     SBTypeCategory
287     GetCategory (const char* category_name);
288
289     SBTypeCategory
290     CreateCategory (const char* category_name);
291     
292     bool
293     DeleteCategory (const char* category_name);
294     
295     uint32_t
296     GetNumCategories ();
297     
298     SBTypeCategory
299     GetCategoryAtIndex (uint32_t);
300     
301     SBTypeCategory
302     GetDefaultCategory();
303     
304     SBTypeFormat
305     GetFormatForType (SBTypeNameSpecifier);
306
307 #ifndef LLDB_DISABLE_PYTHON
308     SBTypeSummary
309     GetSummaryForType (SBTypeNameSpecifier);
310 #endif
311
312     SBTypeFilter
313     GetFilterForType (SBTypeNameSpecifier);
314
315 #ifndef LLDB_DISABLE_PYTHON
316     SBTypeSynthetic
317     GetSyntheticForType (SBTypeNameSpecifier);
318 #endif
319
320     void
321     RunCommandInterpreter (bool auto_handle_events,
322                            bool spawn_thread);
323
324 private:
325
326     friend class SBCommandInterpreter;
327     friend class SBInputReader;
328     friend class SBListener;
329     friend class SBProcess;
330     friend class SBSourceManager;
331     friend class SBTarget;
332     
333     lldb::SBTarget
334     FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
335
336     void
337     reset (const lldb::DebuggerSP &debugger_sp);
338
339     lldb_private::Debugger *
340     get () const;
341
342     lldb_private::Debugger &
343     ref () const;
344
345     const lldb::DebuggerSP &
346     get_sp () const;
347     
348     lldb::DebuggerSP m_opaque_sp;
349
350 }; // class SBDebugger
351
352
353 } // namespace lldb
354
355 #endif // LLDB_SBDebugger_h_