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