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