SBDebugger.h revision b38df1e945846a5d956974ec157902a6ad748868
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    void
167    NotifyTopInputReader (lldb::InputReaderAction notification);
168
169    bool
170    InputReaderIsTopReader (const lldb::SBInputReader &reader);
171
172    const char *
173    GetInstanceName  ();
174
175    static SBDebugger
176    FindDebuggerWithID (int id);
177
178    static lldb::SBError
179    SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
180
181    static lldb::SBStringList
182    GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
183
184    bool
185    GetDescription (lldb::SBStream &description);
186
187    uint32_t
188    GetTerminalWidth () const;
189
190    void
191    SetTerminalWidth (uint32_t term_width);
192
193    lldb::user_id_t
194    GetID ();
195
196    const char *
197    GetPrompt() const;
198
199    void
200    SetPrompt (const char *prompt);
201
202    lldb::ScriptLanguage
203    GetScriptLanguage() const;
204
205    void
206    SetScriptLanguage (lldb::ScriptLanguage script_lang);
207
208private:
209
210#ifndef SWIG
211
212    friend class SBInputReader;
213    friend class SBProcess;
214    friend class SBTarget;
215
216    lldb::SBTarget
217    FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
218
219    void
220    reset (const lldb::DebuggerSP &debugger_sp);
221
222    lldb_private::Debugger *
223    get () const;
224
225    lldb_private::Debugger &
226    ref () const;
227
228#endif
229
230    lldb::DebuggerSP m_opaque_sp;
231
232}; // class SBDebugger
233
234
235} // namespace lldb
236
237#endif // LLDB_SBDebugger_h_
238