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 SBAttachInfo::SBAttachInfo() : m_opaque_sp(new ProcessAttachInfo()) {} 20 21 SBAttachInfo::SBAttachInfo(lldb::pid_t pid) 22 : m_opaque_sp(new ProcessAttachInfo()) { 23 m_opaque_sp->SetProcessID(pid); 24 } 25 26 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for) 27 : m_opaque_sp(new ProcessAttachInfo()) { 28 if (path && path[0]) 29 m_opaque_sp->GetExecutableFile().SetFile(path, false); 30 m_opaque_sp->SetWaitForLaunch(wait_for); 31 } 32 33 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async) 34 : m_opaque_sp(new ProcessAttachInfo()) { 35 if (path && path[0]) 36 m_opaque_sp->GetExecutableFile().SetFile(path, false); 37 m_opaque_sp->SetWaitForLaunch(wait_for); 38 m_opaque_sp->SetAsync(async); 39 } 40 41 SBAttachInfo::SBAttachInfo(const SBAttachInfo &rhs) 42 : m_opaque_sp(new ProcessAttachInfo()) { 43 *m_opaque_sp = *rhs.m_opaque_sp; 44 } 45 46 SBAttachInfo::~SBAttachInfo() {} 47 48 lldb_private::ProcessAttachInfo &SBAttachInfo::ref() { return *m_opaque_sp; } 49 50 SBAttachInfo &SBAttachInfo::operator=(const SBAttachInfo &rhs) { 51 if (this != &rhs) 52 *m_opaque_sp = *rhs.m_opaque_sp; 53 return *this; 54 } 55 56 lldb::pid_t SBAttachInfo::GetProcessID() { return m_opaque_sp->GetProcessID(); } 57 58 void SBAttachInfo::SetProcessID(lldb::pid_t pid) { 59 m_opaque_sp->SetProcessID(pid); 60 } 61 62 uint32_t SBAttachInfo::GetResumeCount() { 63 return m_opaque_sp->GetResumeCount(); 64 } 65 66 void SBAttachInfo::SetResumeCount(uint32_t c) { 67 m_opaque_sp->SetResumeCount(c); 68 } 69 70 const char *SBAttachInfo::GetProcessPluginName() { 71 return m_opaque_sp->GetProcessPluginName(); 72 } 73 74 void SBAttachInfo::SetProcessPluginName(const char *plugin_name) { 75 return m_opaque_sp->SetProcessPluginName(plugin_name); 76 } 77 78 void SBAttachInfo::SetExecutable(const char *path) { 79 if (path && path[0]) 80 m_opaque_sp->GetExecutableFile().SetFile(path, false); 81 else 82 m_opaque_sp->GetExecutableFile().Clear(); 83 } 84 85 void SBAttachInfo::SetExecutable(SBFileSpec exe_file) { 86 if (exe_file.IsValid()) 87 m_opaque_sp->GetExecutableFile() = exe_file.ref(); 88 else 89 m_opaque_sp->GetExecutableFile().Clear(); 90 } 91 92 bool SBAttachInfo::GetWaitForLaunch() { 93 return m_opaque_sp->GetWaitForLaunch(); 94 } 95 96 void SBAttachInfo::SetWaitForLaunch(bool b) { 97 m_opaque_sp->SetWaitForLaunch(b); 98 } 99 100 void SBAttachInfo::SetWaitForLaunch(bool b, bool async) { 101 m_opaque_sp->SetWaitForLaunch(b); 102 m_opaque_sp->SetAsync(async); 103 } 104 105 bool SBAttachInfo::GetIgnoreExisting() { 106 return m_opaque_sp->GetIgnoreExisting(); 107 } 108 109 void SBAttachInfo::SetIgnoreExisting(bool b) { 110 m_opaque_sp->SetIgnoreExisting(b); 111 } 112 113 uint32_t SBAttachInfo::GetUserID() { return m_opaque_sp->GetUserID(); } 114 115 uint32_t SBAttachInfo::GetGroupID() { return m_opaque_sp->GetGroupID(); } 116 117 bool SBAttachInfo::UserIDIsValid() { return m_opaque_sp->UserIDIsValid(); } 118 119 bool SBAttachInfo::GroupIDIsValid() { return m_opaque_sp->GroupIDIsValid(); } 120 121 void SBAttachInfo::SetUserID(uint32_t uid) { m_opaque_sp->SetUserID(uid); } 122 123 void SBAttachInfo::SetGroupID(uint32_t gid) { m_opaque_sp->SetGroupID(gid); } 124 125 uint32_t SBAttachInfo::GetEffectiveUserID() { 126 return m_opaque_sp->GetEffectiveUserID(); 127 } 128 129 uint32_t SBAttachInfo::GetEffectiveGroupID() { 130 return m_opaque_sp->GetEffectiveGroupID(); 131 } 132 133 bool SBAttachInfo::EffectiveUserIDIsValid() { 134 return m_opaque_sp->EffectiveUserIDIsValid(); 135 } 136 137 bool SBAttachInfo::EffectiveGroupIDIsValid() { 138 return m_opaque_sp->EffectiveGroupIDIsValid(); 139 } 140 141 void SBAttachInfo::SetEffectiveUserID(uint32_t uid) { 142 m_opaque_sp->SetEffectiveUserID(uid); 143 } 144 145 void SBAttachInfo::SetEffectiveGroupID(uint32_t gid) { 146 m_opaque_sp->SetEffectiveGroupID(gid); 147 } 148 149 lldb::pid_t SBAttachInfo::GetParentProcessID() { 150 return m_opaque_sp->GetParentProcessID(); 151 } 152 153 void SBAttachInfo::SetParentProcessID(lldb::pid_t pid) { 154 m_opaque_sp->SetParentProcessID(pid); 155 } 156 157 bool SBAttachInfo::ParentProcessIDIsValid() { 158 return m_opaque_sp->ParentProcessIDIsValid(); 159 } 160 161 SBListener SBAttachInfo::GetListener() { 162 return SBListener(m_opaque_sp->GetListener()); 163 } 164 165 void SBAttachInfo::SetListener(SBListener &listener) { 166 m_opaque_sp->SetListener(listener.GetSP()); 167 } 168