1 //===-- SBAttachInfo.cpp ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/API/SBAttachInfo.h"
12 #include "lldb/API/SBFileSpec.h"
13 #include "lldb/API/SBListener.h"
14 #include "lldb/Target/Process.h"
17 using namespace lldb_private;
19 SBAttachInfo::SBAttachInfo() : m_opaque_sp(new ProcessAttachInfo()) {}
21 SBAttachInfo::SBAttachInfo(lldb::pid_t pid)
22 : m_opaque_sp(new ProcessAttachInfo()) {
23 m_opaque_sp->SetProcessID(pid);
26 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for)
27 : m_opaque_sp(new ProcessAttachInfo()) {
29 m_opaque_sp->GetExecutableFile().SetFile(path, false,
30 FileSpec::Style::native);
31 m_opaque_sp->SetWaitForLaunch(wait_for);
34 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async)
35 : m_opaque_sp(new ProcessAttachInfo()) {
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);
43 SBAttachInfo::SBAttachInfo(const SBAttachInfo &rhs)
44 : m_opaque_sp(new ProcessAttachInfo()) {
45 *m_opaque_sp = *rhs.m_opaque_sp;
48 SBAttachInfo::~SBAttachInfo() {}
50 lldb_private::ProcessAttachInfo &SBAttachInfo::ref() { return *m_opaque_sp; }
52 SBAttachInfo &SBAttachInfo::operator=(const SBAttachInfo &rhs) {
54 *m_opaque_sp = *rhs.m_opaque_sp;
58 lldb::pid_t SBAttachInfo::GetProcessID() { return m_opaque_sp->GetProcessID(); }
60 void SBAttachInfo::SetProcessID(lldb::pid_t pid) {
61 m_opaque_sp->SetProcessID(pid);
64 uint32_t SBAttachInfo::GetResumeCount() {
65 return m_opaque_sp->GetResumeCount();
68 void SBAttachInfo::SetResumeCount(uint32_t c) {
69 m_opaque_sp->SetResumeCount(c);
72 const char *SBAttachInfo::GetProcessPluginName() {
73 return m_opaque_sp->GetProcessPluginName();
76 void SBAttachInfo::SetProcessPluginName(const char *plugin_name) {
77 return m_opaque_sp->SetProcessPluginName(plugin_name);
80 void SBAttachInfo::SetExecutable(const char *path) {
82 m_opaque_sp->GetExecutableFile().SetFile(path, false,
83 FileSpec::Style::native);
85 m_opaque_sp->GetExecutableFile().Clear();
88 void SBAttachInfo::SetExecutable(SBFileSpec exe_file) {
89 if (exe_file.IsValid())
90 m_opaque_sp->GetExecutableFile() = exe_file.ref();
92 m_opaque_sp->GetExecutableFile().Clear();
95 bool SBAttachInfo::GetWaitForLaunch() {
96 return m_opaque_sp->GetWaitForLaunch();
99 void SBAttachInfo::SetWaitForLaunch(bool b) {
100 m_opaque_sp->SetWaitForLaunch(b);
103 void SBAttachInfo::SetWaitForLaunch(bool b, bool async) {
104 m_opaque_sp->SetWaitForLaunch(b);
105 m_opaque_sp->SetAsync(async);
108 bool SBAttachInfo::GetIgnoreExisting() {
109 return m_opaque_sp->GetIgnoreExisting();
112 void SBAttachInfo::SetIgnoreExisting(bool b) {
113 m_opaque_sp->SetIgnoreExisting(b);
116 uint32_t SBAttachInfo::GetUserID() { return m_opaque_sp->GetUserID(); }
118 uint32_t SBAttachInfo::GetGroupID() { return m_opaque_sp->GetGroupID(); }
120 bool SBAttachInfo::UserIDIsValid() { return m_opaque_sp->UserIDIsValid(); }
122 bool SBAttachInfo::GroupIDIsValid() { return m_opaque_sp->GroupIDIsValid(); }
124 void SBAttachInfo::SetUserID(uint32_t uid) { m_opaque_sp->SetUserID(uid); }
126 void SBAttachInfo::SetGroupID(uint32_t gid) { m_opaque_sp->SetGroupID(gid); }
128 uint32_t SBAttachInfo::GetEffectiveUserID() {
129 return m_opaque_sp->GetEffectiveUserID();
132 uint32_t SBAttachInfo::GetEffectiveGroupID() {
133 return m_opaque_sp->GetEffectiveGroupID();
136 bool SBAttachInfo::EffectiveUserIDIsValid() {
137 return m_opaque_sp->EffectiveUserIDIsValid();
140 bool SBAttachInfo::EffectiveGroupIDIsValid() {
141 return m_opaque_sp->EffectiveGroupIDIsValid();
144 void SBAttachInfo::SetEffectiveUserID(uint32_t uid) {
145 m_opaque_sp->SetEffectiveUserID(uid);
148 void SBAttachInfo::SetEffectiveGroupID(uint32_t gid) {
149 m_opaque_sp->SetEffectiveGroupID(gid);
152 lldb::pid_t SBAttachInfo::GetParentProcessID() {
153 return m_opaque_sp->GetParentProcessID();
156 void SBAttachInfo::SetParentProcessID(lldb::pid_t pid) {
157 m_opaque_sp->SetParentProcessID(pid);
160 bool SBAttachInfo::ParentProcessIDIsValid() {
161 return m_opaque_sp->ParentProcessIDIsValid();
164 SBListener SBAttachInfo::GetListener() {
165 return SBListener(m_opaque_sp->GetListener());
168 void SBAttachInfo::SetListener(SBListener &listener) {
169 m_opaque_sp->SetListener(listener.GetSP());