SBDebugger.h revision c4ed12f9db1a526401f29a4cef17d78fa5e3da26
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    // FIXME: Once we get the set show stuff in place, the driver won't need
121    // an interface to the Set/Get UseExternalEditor.
122    bool
123    SetUseExternalEditor (bool input);
124
125    bool
126    GetUseExternalEditor ();
127
128    static bool
129    GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
130
131    static bool
132    SetDefaultArchitecture (const char *arch_name);
133
134    lldb::ScriptLanguage
135    GetScriptingLanguage (const char *script_language_name);
136
137    static const char *
138    GetVersionString ();
139
140    static const char *
141    StateAsCString (lldb::StateType state);
142
143    static bool
144    StateIsRunningState (lldb::StateType state);
145
146    static bool
147    StateIsStoppedState (lldb::StateType state);
148
149    void
150    DispatchInput (void *baton, const void *data, size_t data_len);
151
152    void
153    DispatchInputInterrupt ();
154
155    void
156    DispatchInputEndOfFile ();
157
158    void
159    PushInputReader (lldb::SBInputReader &reader);
160
161    const char *
162    GetInstanceName  ();
163
164    static SBDebugger
165    FindDebuggerWithID (int id);
166
167    static lldb::SBError
168    SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
169
170    static lldb::SBStringList
171    GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
172
173    bool
174    GetDescription (lldb::SBStream &description);
175
176    uint32_t
177    GetTerminalWidth () const;
178
179    void
180    SetTerminalWidth (uint32_t term_width);
181
182    lldb::user_id_t
183    GetID ();
184
185    const char *
186    GetPrompt() const;
187
188    void
189    SetPrompt (const char *prompt);
190
191    lldb::ScriptLanguage
192    GetScriptLanguage() const;
193
194    void
195    SetScriptLanguage (lldb::ScriptLanguage script_lang);
196
197private:
198
199#ifndef SWIG
200
201    friend class SBInputReader;
202    friend class SBProcess;
203    friend class SBTarget;
204
205    lldb::SBTarget
206    FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
207
208    void
209    reset (const lldb::DebuggerSP &debugger_sp);
210
211    lldb_private::Debugger *
212    get () const;
213
214    lldb_private::Debugger &
215    ref () const;
216
217#endif
218
219    lldb::DebuggerSP m_opaque_sp;
220
221}; // class SBDebugger
222
223
224} // namespace lldb
225
226#endif // LLDB_SBDebugger_h_
227