SBDebugger.h revision c833295baeec641086f536e78050388af36784f8
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 bool 111 GetDefaultArchitecture (char *arch_name, size_t arch_name_len); 112 113 bool 114 SetDefaultArchitecture (const char *arch_name); 115 116 lldb::ScriptLanguage 117 GetScriptingLanguage (const char *script_language_name); 118 119 static const char * 120 GetVersionString (); 121 122 static const char * 123 StateAsCString (lldb::StateType state); 124 125 static bool 126 StateIsRunningState (lldb::StateType state); 127 128 static bool 129 StateIsStoppedState (lldb::StateType state); 130 131 void 132 DispatchInput (void *baton, const void *data, size_t data_len); 133 134 void 135 PushInputReader (lldb::SBInputReader &reader); 136 137 static SBDebugger 138 FindDebuggerWithID (int id); 139 140private: 141 142#ifndef SWIG 143 144 friend class SBInputReader; 145 friend class SBProcess; 146 friend class SBTarget; 147 148 lldb::SBTarget 149 FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP); 150 151 void 152 reset (const lldb::DebuggerSP &debugger_sp); 153 154 lldb_private::Debugger * 155 get () const; 156 157 lldb_private::Debugger & 158 ref () const; 159 160#endif 161 162 lldb::DebuggerSP m_opaque_sp; 163 164}; // class SBDebugger 165 166 167} // namespace lldb 168 169#endif // LLDB_SBDebugger_h_ 170