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