SBDebugger.h revision 63094e0bb161580564954dee512955c1c79d3476
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 132private: 133 134 // Use the static function: SBDebugger::Create(); 135 SBDebugger(); 136 137#ifndef SWIG 138 139 friend class SBInputReader; 140 friend class SBProcess; 141 friend class SBTarget; 142 143 lldb::SBTarget 144 FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP); 145 146 void 147 reset (const lldb::DebuggerSP &debugger_sp); 148 149 lldb_private::Debugger * 150 get () const; 151 152 lldb_private::Debugger & 153 ref () const; 154 155#endif 156 157 lldb::DebuggerSP m_opaque_sp; 158 159}; // class SBDebugger 160 161 162} // namespace lldb 163 164#endif // LLDB_SBDebugger_h_ 165