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