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