[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / source / API / SBAttachInfo.cpp
blob838385c104ae68bef646990811b7d0252c4808fb
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 //===----------------------------------------------------------------------===//
9 #include "lldb/API/SBAttachInfo.h"
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"
16 using namespace lldb;
17 using namespace lldb_private;
19 SBAttachInfo::SBAttachInfo() : m_opaque_sp(new ProcessAttachInfo()) {
20 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBAttachInfo);
23 SBAttachInfo::SBAttachInfo(lldb::pid_t pid)
24 : m_opaque_sp(new ProcessAttachInfo()) {
25 LLDB_RECORD_CONSTRUCTOR(SBAttachInfo, (lldb::pid_t), pid);
27 m_opaque_sp->SetProcessID(pid);
30 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for)
31 : m_opaque_sp(new ProcessAttachInfo()) {
32 LLDB_RECORD_CONSTRUCTOR(SBAttachInfo, (const char *, bool), path, wait_for);
34 if (path && path[0])
35 m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
36 m_opaque_sp->SetWaitForLaunch(wait_for);
39 SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async)
40 : m_opaque_sp(new ProcessAttachInfo()) {
41 LLDB_RECORD_CONSTRUCTOR(SBAttachInfo, (const char *, bool, bool), path,
42 wait_for, async);
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);
50 SBAttachInfo::SBAttachInfo(const SBAttachInfo &rhs)
51 : m_opaque_sp(new ProcessAttachInfo()) {
52 LLDB_RECORD_CONSTRUCTOR(SBAttachInfo, (const lldb::SBAttachInfo &), rhs);
54 m_opaque_sp = clone(rhs.m_opaque_sp);
57 SBAttachInfo::~SBAttachInfo() {}
59 lldb_private::ProcessAttachInfo &SBAttachInfo::ref() { return *m_opaque_sp; }
61 SBAttachInfo &SBAttachInfo::operator=(const SBAttachInfo &rhs) {
62 LLDB_RECORD_METHOD(lldb::SBAttachInfo &,
63 SBAttachInfo, operator=,(const lldb::SBAttachInfo &), rhs);
65 if (this != &rhs)
66 m_opaque_sp = clone(rhs.m_opaque_sp);
67 return LLDB_RECORD_RESULT(*this);
70 lldb::pid_t SBAttachInfo::GetProcessID() {
71 LLDB_RECORD_METHOD_NO_ARGS(lldb::pid_t, SBAttachInfo, GetProcessID);
73 return m_opaque_sp->GetProcessID();
76 void SBAttachInfo::SetProcessID(lldb::pid_t pid) {
77 LLDB_RECORD_METHOD(void, SBAttachInfo, SetProcessID, (lldb::pid_t), pid);
79 m_opaque_sp->SetProcessID(pid);
82 uint32_t SBAttachInfo::GetResumeCount() {
83 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBAttachInfo, GetResumeCount);
85 return m_opaque_sp->GetResumeCount();
88 void SBAttachInfo::SetResumeCount(uint32_t c) {
89 LLDB_RECORD_METHOD(void, SBAttachInfo, SetResumeCount, (uint32_t), c);
91 m_opaque_sp->SetResumeCount(c);
94 const char *SBAttachInfo::GetProcessPluginName() {
95 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBAttachInfo, GetProcessPluginName);
97 return m_opaque_sp->GetProcessPluginName();
100 void SBAttachInfo::SetProcessPluginName(const char *plugin_name) {
101 LLDB_RECORD_METHOD(void, SBAttachInfo, SetProcessPluginName, (const char *),
102 plugin_name);
104 return m_opaque_sp->SetProcessPluginName(plugin_name);
107 void SBAttachInfo::SetExecutable(const char *path) {
108 LLDB_RECORD_METHOD(void, SBAttachInfo, SetExecutable, (const char *), path);
110 if (path && path[0])
111 m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
112 else
113 m_opaque_sp->GetExecutableFile().Clear();
116 void SBAttachInfo::SetExecutable(SBFileSpec exe_file) {
117 LLDB_RECORD_METHOD(void, SBAttachInfo, SetExecutable, (lldb::SBFileSpec),
118 exe_file);
120 if (exe_file.IsValid())
121 m_opaque_sp->GetExecutableFile() = exe_file.ref();
122 else
123 m_opaque_sp->GetExecutableFile().Clear();
126 bool SBAttachInfo::GetWaitForLaunch() {
127 LLDB_RECORD_METHOD_NO_ARGS(bool, SBAttachInfo, GetWaitForLaunch);
129 return m_opaque_sp->GetWaitForLaunch();
132 void SBAttachInfo::SetWaitForLaunch(bool b) {
133 LLDB_RECORD_METHOD(void, SBAttachInfo, SetWaitForLaunch, (bool), b);
135 m_opaque_sp->SetWaitForLaunch(b);
138 void SBAttachInfo::SetWaitForLaunch(bool b, bool async) {
139 LLDB_RECORD_METHOD(void, SBAttachInfo, SetWaitForLaunch, (bool, bool), b,
140 async);
142 m_opaque_sp->SetWaitForLaunch(b);
143 m_opaque_sp->SetAsync(async);
146 bool SBAttachInfo::GetIgnoreExisting() {
147 LLDB_RECORD_METHOD_NO_ARGS(bool, SBAttachInfo, GetIgnoreExisting);
149 return m_opaque_sp->GetIgnoreExisting();
152 void SBAttachInfo::SetIgnoreExisting(bool b) {
153 LLDB_RECORD_METHOD(void, SBAttachInfo, SetIgnoreExisting, (bool), b);
155 m_opaque_sp->SetIgnoreExisting(b);
158 uint32_t SBAttachInfo::GetUserID() {
159 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBAttachInfo, GetUserID);
161 return m_opaque_sp->GetUserID();
164 uint32_t SBAttachInfo::GetGroupID() {
165 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBAttachInfo, GetGroupID);
167 return m_opaque_sp->GetGroupID();
170 bool SBAttachInfo::UserIDIsValid() {
171 LLDB_RECORD_METHOD_NO_ARGS(bool, SBAttachInfo, UserIDIsValid);
173 return m_opaque_sp->UserIDIsValid();
176 bool SBAttachInfo::GroupIDIsValid() {
177 LLDB_RECORD_METHOD_NO_ARGS(bool, SBAttachInfo, GroupIDIsValid);
179 return m_opaque_sp->GroupIDIsValid();
182 void SBAttachInfo::SetUserID(uint32_t uid) {
183 LLDB_RECORD_METHOD(void, SBAttachInfo, SetUserID, (uint32_t), uid);
185 m_opaque_sp->SetUserID(uid);
188 void SBAttachInfo::SetGroupID(uint32_t gid) {
189 LLDB_RECORD_METHOD(void, SBAttachInfo, SetGroupID, (uint32_t), gid);
191 m_opaque_sp->SetGroupID(gid);
194 uint32_t SBAttachInfo::GetEffectiveUserID() {
195 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBAttachInfo, GetEffectiveUserID);
197 return m_opaque_sp->GetEffectiveUserID();
200 uint32_t SBAttachInfo::GetEffectiveGroupID() {
201 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBAttachInfo, GetEffectiveGroupID);
203 return m_opaque_sp->GetEffectiveGroupID();
206 bool SBAttachInfo::EffectiveUserIDIsValid() {
207 LLDB_RECORD_METHOD_NO_ARGS(bool, SBAttachInfo, EffectiveUserIDIsValid);
209 return m_opaque_sp->EffectiveUserIDIsValid();
212 bool SBAttachInfo::EffectiveGroupIDIsValid() {
213 LLDB_RECORD_METHOD_NO_ARGS(bool, SBAttachInfo, EffectiveGroupIDIsValid);
215 return m_opaque_sp->EffectiveGroupIDIsValid();
218 void SBAttachInfo::SetEffectiveUserID(uint32_t uid) {
219 LLDB_RECORD_METHOD(void, SBAttachInfo, SetEffectiveUserID, (uint32_t), uid);
221 m_opaque_sp->SetEffectiveUserID(uid);
224 void SBAttachInfo::SetEffectiveGroupID(uint32_t gid) {
225 LLDB_RECORD_METHOD(void, SBAttachInfo, SetEffectiveGroupID, (uint32_t), gid);
227 m_opaque_sp->SetEffectiveGroupID(gid);
230 lldb::pid_t SBAttachInfo::GetParentProcessID() {
231 LLDB_RECORD_METHOD_NO_ARGS(lldb::pid_t, SBAttachInfo, GetParentProcessID);
233 return m_opaque_sp->GetParentProcessID();
236 void SBAttachInfo::SetParentProcessID(lldb::pid_t pid) {
237 LLDB_RECORD_METHOD(void, SBAttachInfo, SetParentProcessID, (lldb::pid_t),
238 pid);
240 m_opaque_sp->SetParentProcessID(pid);
243 bool SBAttachInfo::ParentProcessIDIsValid() {
244 LLDB_RECORD_METHOD_NO_ARGS(bool, SBAttachInfo, ParentProcessIDIsValid);
246 return m_opaque_sp->ParentProcessIDIsValid();
249 SBListener SBAttachInfo::GetListener() {
250 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBListener, SBAttachInfo, GetListener);
252 return LLDB_RECORD_RESULT(SBListener(m_opaque_sp->GetListener()));
255 void SBAttachInfo::SetListener(SBListener &listener) {
256 LLDB_RECORD_METHOD(void, SBAttachInfo, SetListener, (lldb::SBListener &),
257 listener);
259 m_opaque_sp->SetListener(listener.GetSP());
262 namespace lldb_private {
263 namespace repro {
265 template <>
266 void RegisterMethods<SBAttachInfo>(Registry &R) {
267 LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, ());
268 LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, (lldb::pid_t));
269 LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, (const char *, bool));
270 LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, (const char *, bool, bool));
271 LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, (const lldb::SBAttachInfo &));
272 LLDB_REGISTER_METHOD(lldb::SBAttachInfo &,
273 SBAttachInfo, operator=,(const lldb::SBAttachInfo &));
274 LLDB_REGISTER_METHOD(lldb::pid_t, SBAttachInfo, GetProcessID, ());
275 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetProcessID, (lldb::pid_t));
276 LLDB_REGISTER_METHOD(uint32_t, SBAttachInfo, GetResumeCount, ());
277 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetResumeCount, (uint32_t));
278 LLDB_REGISTER_METHOD(const char *, SBAttachInfo, GetProcessPluginName, ());
279 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetProcessPluginName,
280 (const char *));
281 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetExecutable, (const char *));
282 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetExecutable, (lldb::SBFileSpec));
283 LLDB_REGISTER_METHOD(bool, SBAttachInfo, GetWaitForLaunch, ());
284 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetWaitForLaunch, (bool));
285 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetWaitForLaunch, (bool, bool));
286 LLDB_REGISTER_METHOD(bool, SBAttachInfo, GetIgnoreExisting, ());
287 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetIgnoreExisting, (bool));
288 LLDB_REGISTER_METHOD(uint32_t, SBAttachInfo, GetUserID, ());
289 LLDB_REGISTER_METHOD(uint32_t, SBAttachInfo, GetGroupID, ());
290 LLDB_REGISTER_METHOD(bool, SBAttachInfo, UserIDIsValid, ());
291 LLDB_REGISTER_METHOD(bool, SBAttachInfo, GroupIDIsValid, ());
292 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetUserID, (uint32_t));
293 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetGroupID, (uint32_t));
294 LLDB_REGISTER_METHOD(uint32_t, SBAttachInfo, GetEffectiveUserID, ());
295 LLDB_REGISTER_METHOD(uint32_t, SBAttachInfo, GetEffectiveGroupID, ());
296 LLDB_REGISTER_METHOD(bool, SBAttachInfo, EffectiveUserIDIsValid, ());
297 LLDB_REGISTER_METHOD(bool, SBAttachInfo, EffectiveGroupIDIsValid, ());
298 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetEffectiveUserID, (uint32_t));
299 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetEffectiveGroupID, (uint32_t));
300 LLDB_REGISTER_METHOD(lldb::pid_t, SBAttachInfo, GetParentProcessID, ());
301 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetParentProcessID, (lldb::pid_t));
302 LLDB_REGISTER_METHOD(bool, SBAttachInfo, ParentProcessIDIsValid, ());
303 LLDB_REGISTER_METHOD(lldb::SBListener, SBAttachInfo, GetListener, ());
304 LLDB_REGISTER_METHOD(void, SBAttachInfo, SetListener, (lldb::SBListener &));