SBDebugger.h revision 180546b3feb8c7bcca70a56776a7c4fad99ba09c
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
16namespace lldb {
17
18class SBDebugger
19{
20public:
21
22    static void
23    Initialize();
24
25    static void
26    Terminate();
27
28    static lldb::SBDebugger
29    Create();
30
31    static void
32    Destroy (lldb::SBDebugger &debugger);
33
34    SBDebugger();
35
36    SBDebugger(const lldb::SBDebugger &rhs);
37
38#ifndef SWIG
39    lldb::SBDebugger &
40    operator = (const lldb::SBDebugger &rhs);
41#endif
42
43    ~SBDebugger();
44
45    bool
46    IsValid() const;
47
48    void
49    Clear ();
50
51    void
52    SetAsync (bool b);
53
54    void
55    SkipLLDBInitFiles (bool b);
56
57    void
58    SetInputFileHandle (FILE *f, bool transfer_ownership);
59
60    void
61    SetOutputFileHandle (FILE *f, bool transfer_ownership);
62
63    void
64    SetErrorFileHandle (FILE *f, bool transfer_ownership);
65
66    FILE *
67    GetInputFileHandle ();
68
69    FILE *
70    GetOutputFileHandle ();
71
72    FILE *
73    GetErrorFileHandle ();
74
75    lldb::SBCommandInterpreter
76    GetCommandInterpreter ();
77
78    void
79    HandleCommand (const char *command);
80
81    lldb::SBListener
82    GetListener ();
83
84    void
85    HandleProcessEvent (const lldb::SBProcess &process,
86                        const lldb::SBEvent &event,
87                        FILE *out,
88                        FILE *err);
89
90    lldb::SBTarget
91    CreateTargetWithFileAndTargetTriple (const char *filename,
92                                         const char *target_triple);
93
94    lldb::SBTarget
95    CreateTargetWithFileAndArch (const char *filename,
96                                 const char *archname);
97
98    lldb::SBTarget
99    CreateTarget (const char *filename);
100
101    lldb::SBTarget
102    GetTargetAtIndex (uint32_t idx);
103
104    lldb::SBTarget
105    FindTargetWithProcessID (pid_t pid);
106
107    lldb::SBTarget
108    FindTargetWithFileAndArch (const char *filename,
109                               const char *arch);
110
111    uint32_t
112    GetNumTargets ();
113
114    lldb::SBTarget
115    GetSelectedTarget ();
116
117    lldb::SBSourceManager &
118    GetSourceManager ();
119
120    // REMOVE: just for a quick fix, need to expose platforms through
121    // SBPlatform from this class.
122    lldb::SBError
123    SetCurrentPlatform (const char *platform_name);
124
125    // FIXME: Once we get the set show stuff in place, the driver won't need
126    // an interface to the Set/Get UseExternalEditor.
127    bool
128    SetUseExternalEditor (bool input);
129
130    bool
131    GetUseExternalEditor ();
132
133    static bool
134    GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
135
136    static bool
137    SetDefaultArchitecture (const char *arch_name);
138
139    lldb::ScriptLanguage
140    GetScriptingLanguage (const char *script_language_name);
141
142    static const char *
143    GetVersionString ();
144
145    static const char *
146    StateAsCString (lldb::StateType state);
147
148    static bool
149    StateIsRunningState (lldb::StateType state);
150
151    static bool
152    StateIsStoppedState (lldb::StateType state);
153
154    void
155    DispatchInput (void *baton, const void *data, size_t data_len);
156
157    void
158    DispatchInputInterrupt ();
159
160    void
161    DispatchInputEndOfFile ();
162
163    void
164    PushInputReader (lldb::SBInputReader &reader);
165
166    const char *
167    GetInstanceName  ();
168
169    static SBDebugger
170    FindDebuggerWithID (int id);
171
172    static lldb::SBError
173    SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
174
175    static lldb::SBStringList
176    GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
177
178    bool
179    GetDescription (lldb::SBStream &description);
180
181    uint32_t
182    GetTerminalWidth () const;
183
184    void
185    SetTerminalWidth (uint32_t term_width);
186
187    lldb::user_id_t
188    GetID ();
189
190    const char *
191    GetPrompt() const;
192
193    void
194    SetPrompt (const char *prompt);
195
196    lldb::ScriptLanguage
197    GetScriptLanguage() const;
198
199    void
200    SetScriptLanguage (lldb::ScriptLanguage script_lang);
201
202private:
203
204#ifndef SWIG
205
206    friend class SBInputReader;
207    friend class SBProcess;
208    friend class SBTarget;
209
210    lldb::SBTarget
211    FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
212
213    void
214    reset (const lldb::DebuggerSP &debugger_sp);
215
216    lldb_private::Debugger *
217    get () const;
218
219    lldb_private::Debugger &
220    ref () const;
221
222#endif
223
224    lldb::DebuggerSP m_opaque_sp;
225
226}; // class SBDebugger
227
228
229} // namespace lldb
230
231#endif // LLDB_SBDebugger_h_
232