[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / source / API / SBPlatform.cpp
blobf3708d8e084f3f22bd97ff70828713e25e60503d
1 //===-- SBPlatform.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/SBPlatform.h"
10 #include "SBReproducerPrivate.h"
11 #include "lldb/API/SBError.h"
12 #include "lldb/API/SBFileSpec.h"
13 #include "lldb/API/SBLaunchInfo.h"
14 #include "lldb/API/SBUnixSignals.h"
15 #include "lldb/Host/File.h"
16 #include "lldb/Target/Platform.h"
17 #include "lldb/Target/Target.h"
18 #include "lldb/Utility/ArchSpec.h"
19 #include "lldb/Utility/Args.h"
20 #include "lldb/Utility/Status.h"
22 #include "llvm/Support/FileSystem.h"
24 #include <functional>
26 using namespace lldb;
27 using namespace lldb_private;
29 // PlatformConnectOptions
30 struct PlatformConnectOptions {
31 PlatformConnectOptions(const char *url = nullptr)
32 : m_url(), m_rsync_options(), m_rsync_remote_path_prefix(),
33 m_rsync_enabled(false), m_rsync_omit_hostname_from_remote_path(false),
34 m_local_cache_directory() {
35 if (url && url[0])
36 m_url = url;
39 ~PlatformConnectOptions() {}
41 std::string m_url;
42 std::string m_rsync_options;
43 std::string m_rsync_remote_path_prefix;
44 bool m_rsync_enabled;
45 bool m_rsync_omit_hostname_from_remote_path;
46 ConstString m_local_cache_directory;
49 // PlatformShellCommand
50 struct PlatformShellCommand {
51 PlatformShellCommand(const char *shell_command = nullptr)
52 : m_command(), m_working_dir(), m_status(0), m_signo(0) {
53 if (shell_command && shell_command[0])
54 m_command = shell_command;
57 ~PlatformShellCommand() {}
59 std::string m_command;
60 std::string m_working_dir;
61 std::string m_output;
62 int m_status;
63 int m_signo;
64 Timeout<std::ratio<1>> m_timeout = llvm::None;
66 // SBPlatformConnectOptions
67 SBPlatformConnectOptions::SBPlatformConnectOptions(const char *url)
68 : m_opaque_ptr(new PlatformConnectOptions(url)) {
69 LLDB_RECORD_CONSTRUCTOR(SBPlatformConnectOptions, (const char *), url);
72 SBPlatformConnectOptions::SBPlatformConnectOptions(
73 const SBPlatformConnectOptions &rhs)
74 : m_opaque_ptr(new PlatformConnectOptions()) {
75 LLDB_RECORD_CONSTRUCTOR(SBPlatformConnectOptions,
76 (const lldb::SBPlatformConnectOptions &), rhs);
78 *m_opaque_ptr = *rhs.m_opaque_ptr;
81 SBPlatformConnectOptions::~SBPlatformConnectOptions() { delete m_opaque_ptr; }
83 void SBPlatformConnectOptions::operator=(const SBPlatformConnectOptions &rhs) {
84 LLDB_RECORD_METHOD(
85 void,
86 SBPlatformConnectOptions, operator=,(
87 const lldb::SBPlatformConnectOptions &),
88 rhs);
90 *m_opaque_ptr = *rhs.m_opaque_ptr;
93 const char *SBPlatformConnectOptions::GetURL() {
94 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformConnectOptions, GetURL);
96 if (m_opaque_ptr->m_url.empty())
97 return nullptr;
98 return m_opaque_ptr->m_url.c_str();
101 void SBPlatformConnectOptions::SetURL(const char *url) {
102 LLDB_RECORD_METHOD(void, SBPlatformConnectOptions, SetURL, (const char *),
103 url);
105 if (url && url[0])
106 m_opaque_ptr->m_url = url;
107 else
108 m_opaque_ptr->m_url.clear();
111 bool SBPlatformConnectOptions::GetRsyncEnabled() {
112 LLDB_RECORD_METHOD_NO_ARGS(bool, SBPlatformConnectOptions, GetRsyncEnabled);
114 return m_opaque_ptr->m_rsync_enabled;
117 void SBPlatformConnectOptions::EnableRsync(
118 const char *options, const char *remote_path_prefix,
119 bool omit_hostname_from_remote_path) {
120 LLDB_RECORD_METHOD(void, SBPlatformConnectOptions, EnableRsync,
121 (const char *, const char *, bool), options,
122 remote_path_prefix, omit_hostname_from_remote_path);
124 m_opaque_ptr->m_rsync_enabled = true;
125 m_opaque_ptr->m_rsync_omit_hostname_from_remote_path =
126 omit_hostname_from_remote_path;
127 if (remote_path_prefix && remote_path_prefix[0])
128 m_opaque_ptr->m_rsync_remote_path_prefix = remote_path_prefix;
129 else
130 m_opaque_ptr->m_rsync_remote_path_prefix.clear();
132 if (options && options[0])
133 m_opaque_ptr->m_rsync_options = options;
134 else
135 m_opaque_ptr->m_rsync_options.clear();
138 void SBPlatformConnectOptions::DisableRsync() {
139 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatformConnectOptions, DisableRsync);
141 m_opaque_ptr->m_rsync_enabled = false;
144 const char *SBPlatformConnectOptions::GetLocalCacheDirectory() {
145 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformConnectOptions,
146 GetLocalCacheDirectory);
148 return m_opaque_ptr->m_local_cache_directory.GetCString();
151 void SBPlatformConnectOptions::SetLocalCacheDirectory(const char *path) {
152 LLDB_RECORD_METHOD(void, SBPlatformConnectOptions, SetLocalCacheDirectory,
153 (const char *), path);
155 if (path && path[0])
156 m_opaque_ptr->m_local_cache_directory.SetCString(path);
157 else
158 m_opaque_ptr->m_local_cache_directory = ConstString();
161 // SBPlatformShellCommand
162 SBPlatformShellCommand::SBPlatformShellCommand(const char *shell_command)
163 : m_opaque_ptr(new PlatformShellCommand(shell_command)) {
164 LLDB_RECORD_CONSTRUCTOR(SBPlatformShellCommand, (const char *),
165 shell_command);
168 SBPlatformShellCommand::SBPlatformShellCommand(
169 const SBPlatformShellCommand &rhs)
170 : m_opaque_ptr(new PlatformShellCommand()) {
171 LLDB_RECORD_CONSTRUCTOR(SBPlatformShellCommand,
172 (const lldb::SBPlatformShellCommand &), rhs);
174 *m_opaque_ptr = *rhs.m_opaque_ptr;
177 SBPlatformShellCommand::~SBPlatformShellCommand() { delete m_opaque_ptr; }
179 void SBPlatformShellCommand::Clear() {
180 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatformShellCommand, Clear);
182 m_opaque_ptr->m_output = std::string();
183 m_opaque_ptr->m_status = 0;
184 m_opaque_ptr->m_signo = 0;
187 const char *SBPlatformShellCommand::GetCommand() {
188 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetCommand);
190 if (m_opaque_ptr->m_command.empty())
191 return nullptr;
192 return m_opaque_ptr->m_command.c_str();
195 void SBPlatformShellCommand::SetCommand(const char *shell_command) {
196 LLDB_RECORD_METHOD(void, SBPlatformShellCommand, SetCommand, (const char *),
197 shell_command);
199 if (shell_command && shell_command[0])
200 m_opaque_ptr->m_command = shell_command;
201 else
202 m_opaque_ptr->m_command.clear();
205 const char *SBPlatformShellCommand::GetWorkingDirectory() {
206 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand,
207 GetWorkingDirectory);
209 if (m_opaque_ptr->m_working_dir.empty())
210 return nullptr;
211 return m_opaque_ptr->m_working_dir.c_str();
214 void SBPlatformShellCommand::SetWorkingDirectory(const char *path) {
215 LLDB_RECORD_METHOD(void, SBPlatformShellCommand, SetWorkingDirectory,
216 (const char *), path);
218 if (path && path[0])
219 m_opaque_ptr->m_working_dir = path;
220 else
221 m_opaque_ptr->m_working_dir.clear();
224 uint32_t SBPlatformShellCommand::GetTimeoutSeconds() {
225 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatformShellCommand,
226 GetTimeoutSeconds);
228 if (m_opaque_ptr->m_timeout)
229 return m_opaque_ptr->m_timeout->count();
230 return UINT32_MAX;
233 void SBPlatformShellCommand::SetTimeoutSeconds(uint32_t sec) {
234 LLDB_RECORD_METHOD(void, SBPlatformShellCommand, SetTimeoutSeconds,
235 (uint32_t), sec);
237 if (sec == UINT32_MAX)
238 m_opaque_ptr->m_timeout = llvm::None;
239 else
240 m_opaque_ptr->m_timeout = std::chrono::seconds(sec);
243 int SBPlatformShellCommand::GetSignal() {
244 LLDB_RECORD_METHOD_NO_ARGS(int, SBPlatformShellCommand, GetSignal);
246 return m_opaque_ptr->m_signo;
249 int SBPlatformShellCommand::GetStatus() {
250 LLDB_RECORD_METHOD_NO_ARGS(int, SBPlatformShellCommand, GetStatus);
252 return m_opaque_ptr->m_status;
255 const char *SBPlatformShellCommand::GetOutput() {
256 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetOutput);
258 if (m_opaque_ptr->m_output.empty())
259 return nullptr;
260 return m_opaque_ptr->m_output.c_str();
263 // SBPlatform
264 SBPlatform::SBPlatform() : m_opaque_sp() {
265 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBPlatform);
268 SBPlatform::SBPlatform(const char *platform_name) : m_opaque_sp() {
269 LLDB_RECORD_CONSTRUCTOR(SBPlatform, (const char *), platform_name);
271 Status error;
272 if (platform_name && platform_name[0])
273 m_opaque_sp = Platform::Create(ConstString(platform_name), error);
276 SBPlatform::~SBPlatform() {}
278 bool SBPlatform::IsValid() const {
279 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBPlatform, IsValid);
280 return this->operator bool();
282 SBPlatform::operator bool() const {
283 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBPlatform, operator bool);
285 return m_opaque_sp.get() != nullptr;
288 void SBPlatform::Clear() {
289 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatform, Clear);
291 m_opaque_sp.reset();
294 const char *SBPlatform::GetName() {
295 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetName);
297 PlatformSP platform_sp(GetSP());
298 if (platform_sp)
299 return platform_sp->GetName().GetCString();
300 return nullptr;
303 lldb::PlatformSP SBPlatform::GetSP() const { return m_opaque_sp; }
305 void SBPlatform::SetSP(const lldb::PlatformSP &platform_sp) {
306 m_opaque_sp = platform_sp;
309 const char *SBPlatform::GetWorkingDirectory() {
310 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetWorkingDirectory);
312 PlatformSP platform_sp(GetSP());
313 if (platform_sp)
314 return platform_sp->GetWorkingDirectory().GetCString();
315 return nullptr;
318 bool SBPlatform::SetWorkingDirectory(const char *path) {
319 LLDB_RECORD_METHOD(bool, SBPlatform, SetWorkingDirectory, (const char *),
320 path);
322 PlatformSP platform_sp(GetSP());
323 if (platform_sp) {
324 if (path)
325 platform_sp->SetWorkingDirectory(FileSpec(path));
326 else
327 platform_sp->SetWorkingDirectory(FileSpec());
328 return true;
330 return false;
333 SBError SBPlatform::ConnectRemote(SBPlatformConnectOptions &connect_options) {
334 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, ConnectRemote,
335 (lldb::SBPlatformConnectOptions &), connect_options);
337 SBError sb_error;
338 PlatformSP platform_sp(GetSP());
339 if (platform_sp && connect_options.GetURL()) {
340 Args args;
341 args.AppendArgument(
342 llvm::StringRef::withNullAsEmpty(connect_options.GetURL()));
343 sb_error.ref() = platform_sp->ConnectRemote(args);
344 } else {
345 sb_error.SetErrorString("invalid platform");
347 return LLDB_RECORD_RESULT(sb_error);
350 void SBPlatform::DisconnectRemote() {
351 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatform, DisconnectRemote);
353 PlatformSP platform_sp(GetSP());
354 if (platform_sp)
355 platform_sp->DisconnectRemote();
358 bool SBPlatform::IsConnected() {
359 LLDB_RECORD_METHOD_NO_ARGS(bool, SBPlatform, IsConnected);
361 PlatformSP platform_sp(GetSP());
362 if (platform_sp)
363 return platform_sp->IsConnected();
364 return false;
367 const char *SBPlatform::GetTriple() {
368 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetTriple);
370 PlatformSP platform_sp(GetSP());
371 if (platform_sp) {
372 ArchSpec arch(platform_sp->GetSystemArchitecture());
373 if (arch.IsValid()) {
374 // Const-ify the string so we don't need to worry about the lifetime of
375 // the string
376 return ConstString(arch.GetTriple().getTriple().c_str()).GetCString();
379 return nullptr;
382 const char *SBPlatform::GetOSBuild() {
383 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetOSBuild);
385 PlatformSP platform_sp(GetSP());
386 if (platform_sp) {
387 std::string s;
388 if (platform_sp->GetOSBuildString(s)) {
389 if (!s.empty()) {
390 // Const-ify the string so we don't need to worry about the lifetime of
391 // the string
392 return ConstString(s.c_str()).GetCString();
396 return nullptr;
399 const char *SBPlatform::GetOSDescription() {
400 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetOSDescription);
402 PlatformSP platform_sp(GetSP());
403 if (platform_sp) {
404 std::string s;
405 if (platform_sp->GetOSKernelDescription(s)) {
406 if (!s.empty()) {
407 // Const-ify the string so we don't need to worry about the lifetime of
408 // the string
409 return ConstString(s.c_str()).GetCString();
413 return nullptr;
416 const char *SBPlatform::GetHostname() {
417 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetHostname);
419 PlatformSP platform_sp(GetSP());
420 if (platform_sp)
421 return platform_sp->GetHostname();
422 return nullptr;
425 uint32_t SBPlatform::GetOSMajorVersion() {
426 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatform, GetOSMajorVersion);
428 llvm::VersionTuple version;
429 if (PlatformSP platform_sp = GetSP())
430 version = platform_sp->GetOSVersion();
431 return version.empty() ? UINT32_MAX : version.getMajor();
434 uint32_t SBPlatform::GetOSMinorVersion() {
435 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatform, GetOSMinorVersion);
437 llvm::VersionTuple version;
438 if (PlatformSP platform_sp = GetSP())
439 version = platform_sp->GetOSVersion();
440 return version.getMinor().getValueOr(UINT32_MAX);
443 uint32_t SBPlatform::GetOSUpdateVersion() {
444 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatform, GetOSUpdateVersion);
446 llvm::VersionTuple version;
447 if (PlatformSP platform_sp = GetSP())
448 version = platform_sp->GetOSVersion();
449 return version.getSubminor().getValueOr(UINT32_MAX);
452 SBError SBPlatform::Get(SBFileSpec &src, SBFileSpec &dst) {
453 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Get,
454 (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
456 SBError sb_error;
457 PlatformSP platform_sp(GetSP());
458 if (platform_sp) {
459 sb_error.ref() = platform_sp->GetFile(src.ref(), dst.ref());
460 } else {
461 sb_error.SetErrorString("invalid platform");
463 return LLDB_RECORD_RESULT(sb_error);
466 SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) {
467 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Put,
468 (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
469 return LLDB_RECORD_RESULT(
470 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
471 if (src.Exists()) {
472 uint32_t permissions =
473 FileSystem::Instance().GetPermissions(src.ref());
474 if (permissions == 0) {
475 if (FileSystem::Instance().IsDirectory(src.ref()))
476 permissions = eFilePermissionsDirectoryDefault;
477 else
478 permissions = eFilePermissionsFileDefault;
481 return platform_sp->PutFile(src.ref(), dst.ref(), permissions);
484 Status error;
485 error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
486 src.ref().GetPath().c_str());
487 return error;
488 }));
491 SBError SBPlatform::Install(SBFileSpec &src, SBFileSpec &dst) {
492 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Install,
493 (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
494 return LLDB_RECORD_RESULT(
495 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
496 if (src.Exists())
497 return platform_sp->Install(src.ref(), dst.ref());
499 Status error;
500 error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
501 src.ref().GetPath().c_str());
502 return error;
503 }));
506 SBError SBPlatform::Run(SBPlatformShellCommand &shell_command) {
507 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Run,
508 (lldb::SBPlatformShellCommand &), shell_command);
509 return LLDB_RECORD_RESULT(ExecuteConnected([&](const lldb::PlatformSP
510 &platform_sp) {
511 const char *command = shell_command.GetCommand();
512 if (!command)
513 return Status("invalid shell command (empty)");
515 const char *working_dir = shell_command.GetWorkingDirectory();
516 if (working_dir == nullptr) {
517 working_dir = platform_sp->GetWorkingDirectory().GetCString();
518 if (working_dir)
519 shell_command.SetWorkingDirectory(working_dir);
521 return platform_sp->RunShellCommand(command, FileSpec(working_dir),
522 &shell_command.m_opaque_ptr->m_status,
523 &shell_command.m_opaque_ptr->m_signo,
524 &shell_command.m_opaque_ptr->m_output,
525 shell_command.m_opaque_ptr->m_timeout);
526 }));
529 SBError SBPlatform::Launch(SBLaunchInfo &launch_info) {
530 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Launch, (lldb::SBLaunchInfo &),
531 launch_info);
532 return LLDB_RECORD_RESULT(
533 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
534 ProcessLaunchInfo info = launch_info.ref();
535 Status error = platform_sp->LaunchProcess(info);
536 launch_info.set_ref(info);
537 return error;
538 }));
541 SBError SBPlatform::Kill(const lldb::pid_t pid) {
542 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Kill, (const lldb::pid_t), pid);
543 return LLDB_RECORD_RESULT(
544 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
545 return platform_sp->KillProcess(pid);
546 }));
549 SBError SBPlatform::ExecuteConnected(
550 const std::function<Status(const lldb::PlatformSP &)> &func) {
551 SBError sb_error;
552 const auto platform_sp(GetSP());
553 if (platform_sp) {
554 if (platform_sp->IsConnected())
555 sb_error.ref() = func(platform_sp);
556 else
557 sb_error.SetErrorString("not connected");
558 } else
559 sb_error.SetErrorString("invalid platform");
561 return sb_error;
564 SBError SBPlatform::MakeDirectory(const char *path, uint32_t file_permissions) {
565 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, MakeDirectory,
566 (const char *, uint32_t), path, file_permissions);
568 SBError sb_error;
569 PlatformSP platform_sp(GetSP());
570 if (platform_sp) {
571 sb_error.ref() =
572 platform_sp->MakeDirectory(FileSpec(path), file_permissions);
573 } else {
574 sb_error.SetErrorString("invalid platform");
576 return LLDB_RECORD_RESULT(sb_error);
579 uint32_t SBPlatform::GetFilePermissions(const char *path) {
580 LLDB_RECORD_METHOD(uint32_t, SBPlatform, GetFilePermissions, (const char *),
581 path);
583 PlatformSP platform_sp(GetSP());
584 if (platform_sp) {
585 uint32_t file_permissions = 0;
586 platform_sp->GetFilePermissions(FileSpec(path), file_permissions);
587 return file_permissions;
589 return 0;
592 SBError SBPlatform::SetFilePermissions(const char *path,
593 uint32_t file_permissions) {
594 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, SetFilePermissions,
595 (const char *, uint32_t), path, file_permissions);
597 SBError sb_error;
598 PlatformSP platform_sp(GetSP());
599 if (platform_sp) {
600 sb_error.ref() =
601 platform_sp->SetFilePermissions(FileSpec(path), file_permissions);
602 } else {
603 sb_error.SetErrorString("invalid platform");
605 return LLDB_RECORD_RESULT(sb_error);
608 SBUnixSignals SBPlatform::GetUnixSignals() const {
609 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBUnixSignals, SBPlatform,
610 GetUnixSignals);
612 if (auto platform_sp = GetSP())
613 return LLDB_RECORD_RESULT(SBUnixSignals{platform_sp});
615 return LLDB_RECORD_RESULT(SBUnixSignals());
618 namespace lldb_private {
619 namespace repro {
621 template <>
622 void RegisterMethods<SBPlatformConnectOptions>(Registry &R) {
623 LLDB_REGISTER_CONSTRUCTOR(SBPlatformConnectOptions, (const char *));
624 LLDB_REGISTER_CONSTRUCTOR(SBPlatformConnectOptions,
625 (const lldb::SBPlatformConnectOptions &));
626 LLDB_REGISTER_METHOD(
627 void,
628 SBPlatformConnectOptions, operator=,(
629 const lldb::SBPlatformConnectOptions &));
630 LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions, GetURL, ());
631 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetURL,
632 (const char *));
633 LLDB_REGISTER_METHOD(bool, SBPlatformConnectOptions, GetRsyncEnabled, ());
634 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, EnableRsync,
635 (const char *, const char *, bool));
636 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, DisableRsync, ());
637 LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions,
638 GetLocalCacheDirectory, ());
639 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetLocalCacheDirectory,
640 (const char *));
643 template <>
644 void RegisterMethods<SBPlatformShellCommand>(Registry &R) {
645 LLDB_REGISTER_CONSTRUCTOR(SBPlatformShellCommand, (const char *));
646 LLDB_REGISTER_CONSTRUCTOR(SBPlatformShellCommand,
647 (const lldb::SBPlatformShellCommand &));
648 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, Clear, ());
649 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetCommand, ());
650 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetCommand,
651 (const char *));
652 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand,
653 GetWorkingDirectory, ());
654 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetWorkingDirectory,
655 (const char *));
656 LLDB_REGISTER_METHOD(uint32_t, SBPlatformShellCommand, GetTimeoutSeconds,
657 ());
658 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetTimeoutSeconds,
659 (uint32_t));
660 LLDB_REGISTER_METHOD(int, SBPlatformShellCommand, GetSignal, ());
661 LLDB_REGISTER_METHOD(int, SBPlatformShellCommand, GetStatus, ());
662 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetOutput, ());
665 template <>
666 void RegisterMethods<SBPlatform>(Registry &R) {
667 LLDB_REGISTER_CONSTRUCTOR(SBPlatform, ());
668 LLDB_REGISTER_CONSTRUCTOR(SBPlatform, (const char *));
669 LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, IsValid, ());
670 LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, operator bool, ());
671 LLDB_REGISTER_METHOD(void, SBPlatform, Clear, ());
672 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetName, ());
673 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetWorkingDirectory, ());
674 LLDB_REGISTER_METHOD(bool, SBPlatform, SetWorkingDirectory, (const char *));
675 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, ConnectRemote,
676 (lldb::SBPlatformConnectOptions &));
677 LLDB_REGISTER_METHOD(void, SBPlatform, DisconnectRemote, ());
678 LLDB_REGISTER_METHOD(bool, SBPlatform, IsConnected, ());
679 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetTriple, ());
680 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetOSBuild, ());
681 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetOSDescription, ());
682 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetHostname, ());
683 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSMajorVersion, ());
684 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSMinorVersion, ());
685 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSUpdateVersion, ());
686 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Get,
687 (lldb::SBFileSpec &, lldb::SBFileSpec &));
688 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Put,
689 (lldb::SBFileSpec &, lldb::SBFileSpec &));
690 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Install,
691 (lldb::SBFileSpec &, lldb::SBFileSpec &));
692 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Run,
693 (lldb::SBPlatformShellCommand &));
694 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Launch,
695 (lldb::SBLaunchInfo &));
696 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Kill, (const lldb::pid_t));
697 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, MakeDirectory,
698 (const char *, uint32_t));
699 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetFilePermissions,
700 (const char *));
701 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, SetFilePermissions,
702 (const char *, uint32_t));
703 LLDB_REGISTER_METHOD_CONST(lldb::SBUnixSignals, SBPlatform, GetUnixSignals,
704 ());