1 //===-- SBAttachInfo.cpp ----------------------------------------*- 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 #include "lldb/API/SBAttachInfo.h" 11 12 #include "lldb/API/SBFileSpec.h" 13 #include "lldb/API/SBListener.h" 14 #include "lldb/Target/Process.h" 15 16 using namespace lldb; 17 using namespace lldb_private; 18 19 20 SBAttachInfo::SBAttachInfo () : 21 m_opaque_sp (new ProcessAttachInfo()) 22 { 23 } 24 25 SBAttachInfo::SBAttachInfo (lldb::pid_t pid) : 26 m_opaque_sp (new ProcessAttachInfo()) 27 { 28 m_opaque_sp->SetProcessID (pid); 29 } 30 31 SBAttachInfo::SBAttachInfo (const char *path, bool wait_for) : 32 m_opaque_sp (new ProcessAttachInfo()) 33 { 34 if (path && path[0]) 35 m_opaque_sp->GetExecutableFile().SetFile(path, false); 36 m_opaque_sp->SetWaitForLaunch (wait_for); 37 } 38 39 SBAttachInfo::SBAttachInfo (const SBAttachInfo &rhs) : 40 m_opaque_sp (new ProcessAttachInfo()) 41 { 42 *m_opaque_sp = *rhs.m_opaque_sp; 43 } 44 45 SBAttachInfo::~SBAttachInfo() 46 { 47 } 48 49 lldb_private::ProcessAttachInfo & 50 SBAttachInfo::ref () 51 { 52 return *m_opaque_sp; 53 } 54 55 SBAttachInfo & 56 SBAttachInfo::operator = (const SBAttachInfo &rhs) 57 { 58 if (this != &rhs) 59 *m_opaque_sp = *rhs.m_opaque_sp; 60 return *this; 61 } 62 63 lldb::pid_t 64 SBAttachInfo::GetProcessID () 65 { 66 return m_opaque_sp->GetProcessID(); 67 } 68 69 void 70 SBAttachInfo::SetProcessID (lldb::pid_t pid) 71 { 72 m_opaque_sp->SetProcessID (pid); 73 } 74 75 76 uint32_t 77 SBAttachInfo::GetResumeCount () 78 { 79 return m_opaque_sp->GetResumeCount(); 80 } 81 82 void 83 SBAttachInfo::SetResumeCount (uint32_t c) 84 { 85 m_opaque_sp->SetResumeCount (c); 86 } 87 88 const char * 89 SBAttachInfo::GetProcessPluginName () 90 { 91 return m_opaque_sp->GetProcessPluginName(); 92 } 93 94 void 95 SBAttachInfo::SetProcessPluginName (const char *plugin_name) 96 { 97 return m_opaque_sp->SetProcessPluginName (plugin_name); 98 } 99 100 void 101 SBAttachInfo::SetExecutable (const char *path) 102 { 103 if (path && path[0]) 104 m_opaque_sp->GetExecutableFile().SetFile(path, false); 105 else 106 m_opaque_sp->GetExecutableFile().Clear(); 107 } 108 109 void 110 SBAttachInfo::SetExecutable (SBFileSpec exe_file) 111 { 112 if (exe_file.IsValid()) 113 m_opaque_sp->GetExecutableFile() = exe_file.ref(); 114 else 115 m_opaque_sp->GetExecutableFile().Clear(); 116 } 117 118 bool 119 SBAttachInfo::GetWaitForLaunch () 120 { 121 return m_opaque_sp->GetWaitForLaunch(); 122 } 123 124 void 125 SBAttachInfo::SetWaitForLaunch (bool b) 126 { 127 m_opaque_sp->SetWaitForLaunch (b); 128 } 129 130 bool 131 SBAttachInfo::GetIgnoreExisting () 132 { 133 return m_opaque_sp->GetIgnoreExisting(); 134 } 135 136 void 137 SBAttachInfo::SetIgnoreExisting (bool b) 138 { 139 m_opaque_sp->SetIgnoreExisting (b); 140 } 141 142 uint32_t 143 SBAttachInfo::GetUserID() 144 { 145 return m_opaque_sp->GetUserID(); 146 } 147 148 uint32_t 149 SBAttachInfo::GetGroupID() 150 { 151 return m_opaque_sp->GetGroupID(); 152 } 153 154 bool 155 SBAttachInfo::UserIDIsValid () 156 { 157 return m_opaque_sp->UserIDIsValid(); 158 } 159 160 bool 161 SBAttachInfo::GroupIDIsValid () 162 { 163 return m_opaque_sp->GroupIDIsValid(); 164 } 165 166 void 167 SBAttachInfo::SetUserID (uint32_t uid) 168 { 169 m_opaque_sp->SetUserID (uid); 170 } 171 172 void 173 SBAttachInfo::SetGroupID (uint32_t gid) 174 { 175 m_opaque_sp->SetGroupID (gid); 176 } 177 178 uint32_t 179 SBAttachInfo::GetEffectiveUserID() 180 { 181 return m_opaque_sp->GetEffectiveUserID(); 182 } 183 184 uint32_t 185 SBAttachInfo::GetEffectiveGroupID() 186 { 187 return m_opaque_sp->GetEffectiveGroupID(); 188 } 189 190 bool 191 SBAttachInfo::EffectiveUserIDIsValid () 192 { 193 return m_opaque_sp->EffectiveUserIDIsValid(); 194 } 195 196 bool 197 SBAttachInfo::EffectiveGroupIDIsValid () 198 { 199 return m_opaque_sp->EffectiveGroupIDIsValid (); 200 } 201 202 void 203 SBAttachInfo::SetEffectiveUserID (uint32_t uid) 204 { 205 m_opaque_sp->SetEffectiveUserID(uid); 206 } 207 208 void 209 SBAttachInfo::SetEffectiveGroupID (uint32_t gid) 210 { 211 m_opaque_sp->SetEffectiveGroupID(gid); 212 } 213 214 lldb::pid_t 215 SBAttachInfo::GetParentProcessID () 216 { 217 return m_opaque_sp->GetParentProcessID(); 218 } 219 220 void 221 SBAttachInfo::SetParentProcessID (lldb::pid_t pid) 222 { 223 m_opaque_sp->SetParentProcessID (pid); 224 } 225 226 bool 227 SBAttachInfo::ParentProcessIDIsValid() 228 { 229 return m_opaque_sp->ParentProcessIDIsValid(); 230 } 231 232 SBListener 233 SBAttachInfo::GetListener () 234 { 235 return SBListener(m_opaque_sp->GetListener()); 236 } 237 238 void 239 SBAttachInfo::SetListener (SBListener &listener) 240 { 241 m_opaque_sp->SetListener(listener.GetSP()); 242 } 243