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