SBTarget.h revision bdcda468276dc9ab6bf648fc8cc07f3faad91526
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 GetProcess (); 56 57 lldb::SBProcess 58 LaunchProcess (char const **argv, 59 char const **envp, 60 const char *tty, 61 uint32_t launch_flags, // See LaunchFlags 62 bool stop_at_entry); 63 64 lldb::SBProcess 65 Launch (char const **argv, 66 char const **envp, 67 const char *tty, 68 uint32_t launch_flags, // See LaunchFlags 69 bool stop_at_entry, 70 lldb::SBError& error); 71 72 lldb::SBProcess 73 AttachToProcessWithID (lldb::pid_t pid, // The process ID to attach to 74 lldb::SBError& error); // An error explaining what went wrong if attach fails 75 76 lldb::SBProcess 77 AttachToProcessWithName (const char *name, // basename of process to attach to 78 bool wait_for, // if true wait for a new instance of "name" to be launched 79 lldb::SBError& error); // An error explaining what went wrong if attach fails 80 81 lldb::SBFileSpec 82 GetExecutable (); 83 84 uint32_t 85 GetNumModules () const; 86 87 lldb::SBModule 88 GetModuleAtIndex (uint32_t idx); 89 90 lldb::SBDebugger 91 GetDebugger() const; 92 93 lldb::SBModule 94 FindModule (const lldb::SBFileSpec &file_spec); 95 96 void 97 Clear (); 98 99 bool 100 DeleteTargetFromList (lldb_private::TargetList *list); 101 102 bool 103 ResolveLoadAddress (lldb::addr_t vm_addr, 104 lldb::SBAddress& addr); 105 106 lldb::SBBreakpoint 107 BreakpointCreateByLocation (const char *file, uint32_t line); 108 109 lldb::SBBreakpoint 110 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line); 111 112 lldb::SBBreakpoint 113 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL); 114 115 lldb::SBBreakpoint 116 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL); 117 118 lldb::SBBreakpoint 119 BreakpointCreateByAddress (addr_t address); 120 121 uint32_t 122 GetNumBreakpoints () const; 123 124 lldb::SBBreakpoint 125 GetBreakpointAtIndex (uint32_t idx) const; 126 127 bool 128 BreakpointDelete (break_id_t break_id); 129 130 lldb::SBBreakpoint 131 FindBreakpointByID (break_id_t break_id); 132 133 bool 134 EnableAllBreakpoints (); 135 136 bool 137 DisableAllBreakpoints (); 138 139 bool 140 DeleteAllBreakpoints (); 141 142 lldb::SBBroadcaster 143 GetBroadcaster () const; 144 145#ifndef SWIG 146 bool 147 operator == (const lldb::SBTarget &rhs) const; 148 149 bool 150 operator != (const lldb::SBTarget &rhs) const; 151 152#endif 153 154 bool 155 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel); 156 157 bool 158 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel) const; 159 160protected: 161 friend class SBAddress; 162 friend class SBDebugger; 163 friend class SBFunction; 164 friend class SBProcess; 165 friend class SBSymbol; 166 167 //------------------------------------------------------------------ 168 // Constructors are private, use static Target::Create function to 169 // create an instance of this class. 170 //------------------------------------------------------------------ 171 172 SBTarget (const lldb::TargetSP& target_sp); 173 174 void 175 reset (const lldb::TargetSP& target_sp); 176 177 lldb_private::Target * 178 operator ->() const; 179 180 lldb_private::Target * 181 get() const; 182 183private: 184 //------------------------------------------------------------------ 185 // For Target only 186 //------------------------------------------------------------------ 187 188 lldb::TargetSP m_opaque_sp; 189}; 190 191} // namespace lldb 192 193#endif // LLDB_SBTarget_h_ 194