SBDebugger.h revision 16376ed044df3ee70fcf69e19f06af01e71a8e9a
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 // Deprecated, use the one that takes a source_init_files bool. 29 static lldb::SBDebugger 30 Create(); 31 32 static lldb::SBDebugger 33 Create(bool source_init_files); 34 35 static void 36 Destroy (lldb::SBDebugger &debugger); 37 38 static void 39 MemoryPressureDetected (); 40 41 SBDebugger(); 42 43 SBDebugger(const lldb::SBDebugger &rhs); 44 45 SBDebugger(const lldb::DebuggerSP &debugger_sp); 46 47 lldb::SBDebugger & 48 operator = (const lldb::SBDebugger &rhs); 49 50 ~SBDebugger(); 51 52 bool 53 IsValid() const; 54 55 void 56 Clear (); 57 58 void 59 SetAsync (bool b); 60 61 bool 62 GetAsync (); 63 64 void 65 SkipLLDBInitFiles (bool b); 66 67 void 68 SkipAppInitFiles (bool b); 69 70 void 71 SetInputFileHandle (FILE *f, bool transfer_ownership); 72 73 void 74 SetOutputFileHandle (FILE *f, bool transfer_ownership); 75 76 void 77 SetErrorFileHandle (FILE *f, bool transfer_ownership); 78 79 FILE * 80 GetInputFileHandle (); 81 82 FILE * 83 GetOutputFileHandle (); 84 85 FILE * 86 GetErrorFileHandle (); 87 88 lldb::SBCommandInterpreter 89 GetCommandInterpreter (); 90 91 void 92 HandleCommand (const char *command); 93 94 lldb::SBListener 95 GetListener (); 96 97 void 98 HandleProcessEvent (const lldb::SBProcess &process, 99 const lldb::SBEvent &event, 100 FILE *out, 101 FILE *err); 102 103 lldb::SBTarget 104 CreateTarget (const char *filename, 105 const char *target_triple, 106 const char *platform_name, 107 bool add_dependent_modules, 108 lldb::SBError& error); 109 110 lldb::SBTarget 111 CreateTargetWithFileAndTargetTriple (const char *filename, 112 const char *target_triple); 113 114 lldb::SBTarget 115 CreateTargetWithFileAndArch (const char *filename, 116 const char *archname); 117 118 lldb::SBTarget 119 CreateTarget (const char *filename); 120 121 // Return true if target is deleted from the target list of the debugger. 122 bool 123 DeleteTarget (lldb::SBTarget &target); 124 125 lldb::SBTarget 126 GetTargetAtIndex (uint32_t idx); 127 128 lldb::SBTarget 129 FindTargetWithProcessID (pid_t pid); 130 131 lldb::SBTarget 132 FindTargetWithFileAndArch (const char *filename, 133 const char *arch); 134 135 uint32_t 136 GetNumTargets (); 137 138 lldb::SBTarget 139 GetSelectedTarget (); 140 141 void 142 SetSelectedTarget (SBTarget& target); 143 144 lldb::SBSourceManager 145 GetSourceManager (); 146 147 // REMOVE: just for a quick fix, need to expose platforms through 148 // SBPlatform from this class. 149 lldb::SBError 150 SetCurrentPlatform (const char *platform_name); 151 152 bool 153 SetCurrentPlatformSDKRoot (const char *sysroot); 154 155 // FIXME: Once we get the set show stuff in place, the driver won't need 156 // an interface to the Set/Get UseExternalEditor. 157 bool 158 SetUseExternalEditor (bool input); 159 160 bool 161 GetUseExternalEditor (); 162 163 static bool 164 GetDefaultArchitecture (char *arch_name, size_t arch_name_len); 165 166 static bool 167 SetDefaultArchitecture (const char *arch_name); 168 169 lldb::ScriptLanguage 170 GetScriptingLanguage (const char *script_language_name); 171 172 static const char * 173 GetVersionString (); 174 175 static const char * 176 StateAsCString (lldb::StateType state); 177 178 static bool 179 StateIsRunningState (lldb::StateType state); 180 181 static bool 182 StateIsStoppedState (lldb::StateType state); 183 184 void 185 DispatchInput (void *baton, const void *data, size_t data_len); 186 187 void 188 DispatchInputInterrupt (); 189 190 void 191 DispatchInputEndOfFile (); 192 193 void 194 PushInputReader (lldb::SBInputReader &reader); 195 196 void 197 NotifyTopInputReader (lldb::InputReaderAction notification); 198 199 bool 200 InputReaderIsTopReader (const lldb::SBInputReader &reader); 201 202 const char * 203 GetInstanceName (); 204 205 static SBDebugger 206 FindDebuggerWithID (int id); 207 208 static lldb::SBError 209 SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name); 210 211 static lldb::SBStringList 212 GetInternalVariableValue (const char *var_name, const char *debugger_instance_name); 213 214 bool 215 GetDescription (lldb::SBStream &description); 216 217 uint32_t 218 GetTerminalWidth () const; 219 220 void 221 SetTerminalWidth (uint32_t term_width); 222 223 lldb::user_id_t 224 GetID (); 225 226 const char * 227 GetPrompt() const; 228 229 void 230 SetPrompt (const char *prompt); 231 232 lldb::ScriptLanguage 233 GetScriptLanguage() const; 234 235 void 236 SetScriptLanguage (lldb::ScriptLanguage script_lang); 237 238 bool 239 GetCloseInputOnEOF () const; 240 241 void 242 SetCloseInputOnEOF (bool b); 243 244 SBTypeCategory 245 GetCategory (const char* category_name); 246 247 SBTypeCategory 248 CreateCategory (const char* category_name); 249 250 bool 251 DeleteCategory (const char* category_name); 252 253 uint32_t 254 GetNumCategories (); 255 256 SBTypeCategory 257 GetCategoryAtIndex (uint32_t); 258 259 SBTypeCategory 260 GetDefaultCategory(); 261 262 SBTypeFormat 263 GetFormatForType (SBTypeNameSpecifier); 264 265 SBTypeSummary 266 GetSummaryForType (SBTypeNameSpecifier); 267 268 SBTypeFilter 269 GetFilterForType (SBTypeNameSpecifier); 270 271 SBTypeSynthetic 272 GetSyntheticForType (SBTypeNameSpecifier); 273 274private: 275 276 friend class SBInputReader; 277 friend class SBProcess; 278 friend class SBSourceManager; 279 friend class SBTarget; 280 281 lldb::SBTarget 282 FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP); 283 284 void 285 reset (const lldb::DebuggerSP &debugger_sp); 286 287 lldb_private::Debugger * 288 get () const; 289 290 lldb_private::Debugger & 291 ref () const; 292 293 const lldb::DebuggerSP & 294 get_sp () const; 295 296 lldb::DebuggerSP m_opaque_sp; 297 298}; // class SBDebugger 299 300 301} // namespace lldb 302 303#endif // LLDB_SBDebugger_h_ 304