SBDebugger.h revision 6e4c5ce0f697eb9899a54854a2a9004e961b0de2
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 SBDebugger
29    Create();
30
31    SBDebugger();
32
33    ~SBDebugger();
34
35    bool
36    IsValid() const;
37
38    void
39    Clear ();
40
41    void
42    SetAsync (bool b);
43
44    void
45    SetInputFileHandle (FILE *f, bool transfer_ownership);
46
47    void
48    SetOutputFileHandle (FILE *f, bool transfer_ownership);
49
50    void
51    SetErrorFileHandle (FILE *f, bool transfer_ownership);
52
53    FILE *
54    GetInputFileHandle ();
55
56    FILE *
57    GetOutputFileHandle ();
58
59    FILE *
60    GetErrorFileHandle ();
61
62    lldb::SBCommandInterpreter
63    GetCommandInterpreter ();
64
65    void
66    HandleCommand (const char *command);
67
68    lldb::SBListener
69    GetListener ();
70
71    void
72    HandleProcessEvent (const lldb::SBProcess &process,
73                        const lldb::SBEvent &event,
74                        FILE *out,
75                        FILE *err);
76
77    lldb::SBTarget
78    CreateTargetWithFileAndTargetTriple (const char *filename,
79                                         const char *target_triple);
80
81    lldb::SBTarget
82    CreateTargetWithFileAndArch (const char *filename,
83                                 const char *archname);
84
85    lldb::SBTarget
86    CreateTarget (const char *filename);
87
88    lldb::SBTarget
89    GetTargetAtIndex (uint32_t idx);
90
91    lldb::SBTarget
92    FindTargetWithProcessID (pid_t pid);
93
94    lldb::SBTarget
95    FindTargetWithFileAndArch (const char *filename,
96                               const char *arch);
97
98    uint32_t
99    GetNumTargets ();
100
101    lldb::SBTarget
102    GetSelectedTarget ();
103
104    void
105    UpdateSelectedThread (lldb::SBProcess &process);
106
107    lldb::SBSourceManager &
108    GetSourceManager ();
109
110    // FIXME: Once we get the set show stuff in place, the driver won't need
111    // an interface to the Set/Get UseExternalEditor.
112    bool
113    SetUseExternalEditor (bool input);
114
115    bool
116    UseExternalEditor ();
117
118    bool
119    GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
120
121    bool
122    SetDefaultArchitecture (const char *arch_name);
123
124    lldb::ScriptLanguage
125    GetScriptingLanguage (const char *script_language_name);
126
127    static const char *
128    GetVersionString ();
129
130    static const char *
131    StateAsCString (lldb::StateType state);
132
133    static bool
134    StateIsRunningState (lldb::StateType state);
135
136    static bool
137    StateIsStoppedState (lldb::StateType state);
138
139    void
140    DispatchInput (void *baton, const void *data, size_t data_len);
141
142    void
143    PushInputReader (lldb::SBInputReader &reader);
144
145    static SBDebugger
146    FindDebuggerWithID (int id);
147
148    lldb::SBError
149    SetInternalVariable (const char *var_name, const char *value);
150
151    lldb::SBStringList
152    GetInternalVariableValue (const char *var_name);
153
154private:
155
156#ifndef SWIG
157
158    friend class SBInputReader;
159    friend class SBProcess;
160    friend class SBTarget;
161
162    lldb::SBTarget
163    FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
164
165    void
166    reset (const lldb::DebuggerSP &debugger_sp);
167
168    lldb_private::Debugger *
169    get () const;
170
171    lldb_private::Debugger &
172    ref () const;
173
174#endif
175
176    lldb::DebuggerSP m_opaque_sp;
177
178}; // class SBDebugger
179
180
181} // namespace lldb
182
183#endif // LLDB_SBDebugger_h_
184