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