SBTarget.h revision 538eb82a89a68dbc57251915080bd5152b333978
1//===-- SBTarget.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_SBTarget_h_ 11#define LLDB_SBTarget_h_ 12 13#include "lldb/API/SBDefines.h" 14#include "lldb/API/SBBroadcaster.h" 15#include "lldb/API/SBFileSpec.h" 16 17namespace lldb { 18 19class SBBreakpoint; 20 21class SBTarget 22{ 23public: 24 //------------------------------------------------------------------ 25 // Broadcaster bits. 26 //------------------------------------------------------------------ 27 enum 28 { 29 eBroadcastBitBreakpointChanged = (1 << 0), 30 eBroadcastBitModulesLoaded = (1 << 1), 31 eBroadcastBitModulesUnloaded = (1 << 2) 32 }; 33 34 //------------------------------------------------------------------ 35 // Constructors 36 //------------------------------------------------------------------ 37 SBTarget (); 38 39 SBTarget (const lldb::SBTarget& rhs); 40 41#ifndef SWIG 42 const lldb::SBTarget& 43 operator = (const lldb::SBTarget& rhs); 44#endif 45 46 //------------------------------------------------------------------ 47 // Destructor 48 //------------------------------------------------------------------ 49 ~SBTarget(); 50 51 bool 52 IsValid() const; 53 54 lldb::SBProcess 55 CreateProcess (); // DEPRECATED 56 57 lldb::SBProcess 58 GetProcess (); 59 60 // DEPRECATED in favor of the function below that contains an SBError as the 61 // last parameter. 62 lldb::SBProcess 63 LaunchProcess (char const **argv, 64 char const **envp, 65 const char *tty, 66 uint32_t launch_flags, // See LaunchFlags 67 bool stop_at_entry); 68 69 lldb::SBProcess 70 Launch (char const **argv, 71 char const **envp, 72 const char *tty, 73 uint32_t launch_flags, // See LaunchFlags 74 bool stop_at_entry, 75 lldb::SBError& error); 76 77 lldb::SBProcess 78 AttachToProcessWithID (lldb::pid_t pid, // The process ID to attach to 79 lldb::SBError& error); // An error explaining what went wrong if attach fails 80 81 lldb::SBProcess 82 AttachToProcessWithName (const char *name, // basename of process to attach to 83 bool wait_for, // if true wait for a new instance of "name" to be launched 84 lldb::SBError& error); // An error explaining what went wrong if attach fails 85 86 lldb::SBFileSpec 87 GetExecutable (); 88 89 uint32_t 90 GetNumModules () const; 91 92 lldb::SBModule 93 GetModuleAtIndex (uint32_t idx); 94 95 lldb::SBDebugger 96 GetDebugger() const; 97 98 lldb::SBModule 99 FindModule (const lldb::SBFileSpec &file_spec); 100 101 void 102 Clear (); 103 104 bool 105 DeleteTargetFromList (lldb_private::TargetList *list); 106 107 lldb::SBBreakpoint 108 BreakpointCreateByLocation (const char *file, uint32_t line); 109 110 lldb::SBBreakpoint 111 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line); 112 113 lldb::SBBreakpoint 114 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL); 115 116 lldb::SBBreakpoint 117 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL); 118 119 lldb::SBBreakpoint 120 BreakpointCreateByAddress (addr_t address); 121 122 uint32_t 123 GetNumBreakpoints () const; 124 125 lldb::SBBreakpoint 126 GetBreakpointAtIndex (uint32_t idx) const; 127 128 bool 129 BreakpointDelete (break_id_t break_id); 130 131 lldb::SBBreakpoint 132 FindBreakpointByID (break_id_t break_id); 133 134 bool 135 EnableAllBreakpoints (); 136 137 bool 138 DisableAllBreakpoints (); 139 140 bool 141 DeleteAllBreakpoints (); 142 143 lldb::SBBroadcaster 144 GetBroadcaster () const; 145 146 //void 147 //Disassemble (); 148 149 void 150 Disassemble (lldb::addr_t start_address, 151 lldb::addr_t end_address = LLDB_INVALID_ADDRESS, 152 const char *module_name = NULL); 153 154 void 155 Disassemble (const char *function_name, const char *module_name = NULL); 156 157#ifndef SWIG 158 bool 159 operator == (const lldb::SBTarget &rhs) const; 160 161 bool 162 operator != (const lldb::SBTarget &rhs) const; 163 164#endif 165 166 bool 167 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel); 168 169 bool 170 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel) const; 171 172protected: 173 friend class SBAddress; 174 friend class SBDebugger; 175 friend class SBFunction; 176 friend class SBProcess; 177 friend class SBSymbol; 178 179 //------------------------------------------------------------------ 180 // Constructors are private, use static Target::Create function to 181 // create an instance of this class. 182 //------------------------------------------------------------------ 183 184 SBTarget (const lldb::TargetSP& target_sp); 185 186 void 187 reset (const lldb::TargetSP& target_sp); 188 189 lldb_private::Target * 190 operator ->() const; 191 192 lldb_private::Target * 193 get() const; 194 195private: 196 //------------------------------------------------------------------ 197 // For Target only 198 //------------------------------------------------------------------ 199 200 lldb::TargetSP m_opaque_sp; 201}; 202 203} // namespace lldb 204 205#endif // LLDB_SBTarget_h_ 206