LLDB  mainline
SBAttachInfo.cpp
Go to the documentation of this file.
1 //===-- SBAttachInfo.cpp ----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "SBReproducerPrivate.h"
11 #include "Utils.h"
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 
21 }
22 
26 
27  m_opaque_sp->SetProcessID(pid);
28 }
29 
30 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for)
32  LLDB_RECORD_CONSTRUCTOR(SBAttachInfo, (const char *, bool), path, wait_for);
33 
34  if (path && path[0])
35  m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
36  m_opaque_sp->SetWaitForLaunch(wait_for);
37 }
38 
39 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async)
41  LLDB_RECORD_CONSTRUCTOR(SBAttachInfo, (const char *, bool, bool), path,
42  wait_for, async);
43 
44  if (path && path[0])
45  m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
46  m_opaque_sp->SetWaitForLaunch(wait_for);
47  m_opaque_sp->SetAsync(async);
48 }
49 
53 
55 }
56 
58 
60 
63  SBAttachInfo, operator=,(const lldb::SBAttachInfo &), rhs);
64 
65  if (this != &rhs)
67  return LLDB_RECORD_RESULT(*this);
68 }
69 
72 
73  return m_opaque_sp->GetProcessID();
74 }
75 
78 
79  m_opaque_sp->SetProcessID(pid);
80 }
81 
84 
85  return m_opaque_sp->GetResumeCount();
86 }
87 
90 
91  m_opaque_sp->SetResumeCount(c);
92 }
93 
96 
97  return m_opaque_sp->GetProcessPluginName();
98 }
99 
100 void SBAttachInfo::SetProcessPluginName(const char *plugin_name) {
102  plugin_name);
103 
104  return m_opaque_sp->SetProcessPluginName(plugin_name);
105 }
106 
107 void SBAttachInfo::SetExecutable(const char *path) {
108  LLDB_RECORD_METHOD(void, SBAttachInfo, SetExecutable, (const char *), path);
109 
110  if (path && path[0])
111  m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
112  else
113  m_opaque_sp->GetExecutableFile().Clear();
114 }
115 
118  exe_file);
119 
120  if (exe_file.IsValid())
121  m_opaque_sp->GetExecutableFile() = exe_file.ref();
122  else
123  m_opaque_sp->GetExecutableFile().Clear();
124 }
125 
128 
129  return m_opaque_sp->GetWaitForLaunch();
130 }
131 
134 
135  m_opaque_sp->SetWaitForLaunch(b);
136 }
137 
138 void SBAttachInfo::SetWaitForLaunch(bool b, bool async) {
139  LLDB_RECORD_METHOD(void, SBAttachInfo, SetWaitForLaunch, (bool, bool), b,
140  async);
141 
142  m_opaque_sp->SetWaitForLaunch(b);
143  m_opaque_sp->SetAsync(async);
144 }
145 
148 
149  return m_opaque_sp->GetIgnoreExisting();
150 }
151 
154 
155  m_opaque_sp->SetIgnoreExisting(b);
156 }
157 
160 
161  return m_opaque_sp->GetUserID();
162 }
163 
166 
167  return m_opaque_sp->GetGroupID();
168 }
169 
172 
173  return m_opaque_sp->UserIDIsValid();
174 }
175 
178 
179  return m_opaque_sp->GroupIDIsValid();
180 }
181 
184 
185  m_opaque_sp->SetUserID(uid);
186 }
187 
190 
191  m_opaque_sp->SetGroupID(gid);
192 }
193 
196 
197  return m_opaque_sp->GetEffectiveUserID();
198 }
199 
202 
203  return m_opaque_sp->GetEffectiveGroupID();
204 }
205 
208 
209  return m_opaque_sp->EffectiveUserIDIsValid();
210 }
211 
214 
215  return m_opaque_sp->EffectiveGroupIDIsValid();
216 }
217 
220 
221  m_opaque_sp->SetEffectiveUserID(uid);
222 }
223 
226 
227  m_opaque_sp->SetEffectiveGroupID(gid);
228 }
229 
232 
233  return m_opaque_sp->GetParentProcessID();
234 }
235 
238  pid);
239 
240  m_opaque_sp->SetParentProcessID(pid);
241 }
242 
245 
246  return m_opaque_sp->ParentProcessIDIsValid();
247 }
248 
251 
252  return LLDB_RECORD_RESULT(SBListener(m_opaque_sp->GetListener()));
253 }
254 
257  listener);
258 
259  m_opaque_sp->SetListener(listener.GetSP());
260 }
261 
262 namespace lldb_private {
263 namespace repro {
264 
265 template <>
269  LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, (const char *, bool));
270  LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, (const char *, bool, bool));
273  SBAttachInfo, operator=,(const lldb::SBAttachInfo &));
280  (const char *));
281  LLDB_REGISTER_METHOD(void, SBAttachInfo, SetExecutable, (const char *));
285  LLDB_REGISTER_METHOD(void, SBAttachInfo, SetWaitForLaunch, (bool, bool));
305 }
306 
307 }
308 }
The registry contains a unique mapping between functions and their ID.
void SetGroupID(uint32_t gid)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
lldb::pid_t GetProcessID()
void SetIgnoreExisting(bool b)
uint32_t GetResumeCount()
void SetResumeCount(uint32_t c)
void SetProcessID(lldb::pid_t pid)
void SetParentProcessID(lldb::pid_t pid)
ProcessAttachInfoSP m_opaque_sp
Definition: SBAttachInfo.h:172
uint32_t GetEffectiveGroupID()
bool IsValid() const
Definition: SBFileSpec.cpp:79
lldb::ListenerSP GetSP()
Definition: SBListener.cpp:315
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition: Utils.h:17
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
SBListener GetListener()
Get the listener that will be used to receive process events.
void SetListener(SBListener &listener)
Set the listener that will be used to receive process events.
void SetProcessPluginName(const char *plugin_name)
lldb_private::ProcessAttachInfo & ref()
void SetExecutable(const char *path)
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
SBAttachInfo & operator=(const SBAttachInfo &rhs)
lldb::pid_t GetParentProcessID()
void RegisterMethods< SBAttachInfo >(Registry &R)
const char * GetProcessPluginName()
class LLDB_API SBListener
Definition: SBDefines.h:54
bool EffectiveGroupIDIsValid()
Definition: SBAddress.h:15
uint64_t pid_t
Definition: lldb-types.h:85
void SetEffectiveGroupID(uint32_t gid)
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
uint32_t GetEffectiveUserID()
void SetUserID(uint32_t uid)
void SetEffectiveUserID(uint32_t uid)
#define LLDB_RECORD_RESULT(Result)
void SetWaitForLaunch(bool b)
Set attach by process name settings.