1 //===-- SBPlatform.cpp ----------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/API/SBPlatform.h"
10 #include "SBReproducerPrivate.h"
11 #include "lldb/API/SBEnvironment.h"
12 #include "lldb/API/SBError.h"
13 #include "lldb/API/SBFileSpec.h"
14 #include "lldb/API/SBLaunchInfo.h"
15 #include "lldb/API/SBPlatform.h"
16 #include "lldb/API/SBUnixSignals.h"
17 #include "lldb/Host/File.h"
18 #include "lldb/Target/Platform.h"
19 #include "lldb/Target/Target.h"
20 #include "lldb/Utility/ArchSpec.h"
21 #include "lldb/Utility/Args.h"
22 #include "lldb/Utility/Status.h"
24 #include "llvm/Support/FileSystem.h"
29 using namespace lldb_private;
31 // PlatformConnectOptions
32 struct PlatformConnectOptions {
33 PlatformConnectOptions(const char *url = nullptr)
34 : m_url(), m_rsync_options(), m_rsync_remote_path_prefix(),
35 m_rsync_enabled(false), m_rsync_omit_hostname_from_remote_path(false),
36 m_local_cache_directory() {
41 ~PlatformConnectOptions() = default;
44 std::string m_rsync_options;
45 std::string m_rsync_remote_path_prefix;
47 bool m_rsync_omit_hostname_from_remote_path;
48 ConstString m_local_cache_directory;
51 // PlatformShellCommand
52 struct PlatformShellCommand {
53 PlatformShellCommand(const char *shell_command = nullptr)
54 : m_command(), m_working_dir(), m_status(0), m_signo(0) {
55 if (shell_command && shell_command[0])
56 m_command = shell_command;
59 ~PlatformShellCommand() = default;
61 std::string m_command;
62 std::string m_working_dir;
66 Timeout<std::ratio<1>> m_timeout = llvm::None;
68 // SBPlatformConnectOptions
69 SBPlatformConnectOptions::SBPlatformConnectOptions(const char *url)
70 : m_opaque_ptr(new PlatformConnectOptions(url)) {
71 LLDB_RECORD_CONSTRUCTOR(SBPlatformConnectOptions, (const char *), url);
74 SBPlatformConnectOptions::SBPlatformConnectOptions(
75 const SBPlatformConnectOptions &rhs)
76 : m_opaque_ptr(new PlatformConnectOptions()) {
77 LLDB_RECORD_CONSTRUCTOR(SBPlatformConnectOptions,
78 (const lldb::SBPlatformConnectOptions &), rhs);
80 *m_opaque_ptr = *rhs.m_opaque_ptr;
83 SBPlatformConnectOptions::~SBPlatformConnectOptions() { delete m_opaque_ptr; }
85 SBPlatformConnectOptions &SBPlatformConnectOptions::
86 operator=(const SBPlatformConnectOptions &rhs) {
88 SBPlatformConnectOptions &,
89 SBPlatformConnectOptions, operator=,(
90 const lldb::SBPlatformConnectOptions &),
93 *m_opaque_ptr = *rhs.m_opaque_ptr;
94 return LLDB_RECORD_RESULT(*this);
97 const char *SBPlatformConnectOptions::GetURL() {
98 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformConnectOptions, GetURL);
100 if (m_opaque_ptr->m_url.empty())
102 return m_opaque_ptr->m_url.c_str();
105 void SBPlatformConnectOptions::SetURL(const char *url) {
106 LLDB_RECORD_METHOD(void, SBPlatformConnectOptions, SetURL, (const char *),
110 m_opaque_ptr->m_url = url;
112 m_opaque_ptr->m_url.clear();
115 bool SBPlatformConnectOptions::GetRsyncEnabled() {
116 LLDB_RECORD_METHOD_NO_ARGS(bool, SBPlatformConnectOptions, GetRsyncEnabled);
118 return m_opaque_ptr->m_rsync_enabled;
121 void SBPlatformConnectOptions::EnableRsync(
122 const char *options, const char *remote_path_prefix,
123 bool omit_hostname_from_remote_path) {
124 LLDB_RECORD_METHOD(void, SBPlatformConnectOptions, EnableRsync,
125 (const char *, const char *, bool), options,
126 remote_path_prefix, omit_hostname_from_remote_path);
128 m_opaque_ptr->m_rsync_enabled = true;
129 m_opaque_ptr->m_rsync_omit_hostname_from_remote_path =
130 omit_hostname_from_remote_path;
131 if (remote_path_prefix && remote_path_prefix[0])
132 m_opaque_ptr->m_rsync_remote_path_prefix = remote_path_prefix;
134 m_opaque_ptr->m_rsync_remote_path_prefix.clear();
136 if (options && options[0])
137 m_opaque_ptr->m_rsync_options = options;
139 m_opaque_ptr->m_rsync_options.clear();
142 void SBPlatformConnectOptions::DisableRsync() {
143 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatformConnectOptions, DisableRsync);
145 m_opaque_ptr->m_rsync_enabled = false;
148 const char *SBPlatformConnectOptions::GetLocalCacheDirectory() {
149 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformConnectOptions,
150 GetLocalCacheDirectory);
152 return m_opaque_ptr->m_local_cache_directory.GetCString();
155 void SBPlatformConnectOptions::SetLocalCacheDirectory(const char *path) {
156 LLDB_RECORD_METHOD(void, SBPlatformConnectOptions, SetLocalCacheDirectory,
157 (const char *), path);
160 m_opaque_ptr->m_local_cache_directory.SetCString(path);
162 m_opaque_ptr->m_local_cache_directory = ConstString();
165 // SBPlatformShellCommand
166 SBPlatformShellCommand::SBPlatformShellCommand(const char *shell_command)
167 : m_opaque_ptr(new PlatformShellCommand(shell_command)) {
168 LLDB_RECORD_CONSTRUCTOR(SBPlatformShellCommand, (const char *),
172 SBPlatformShellCommand::SBPlatformShellCommand(
173 const SBPlatformShellCommand &rhs)
174 : m_opaque_ptr(new PlatformShellCommand()) {
175 LLDB_RECORD_CONSTRUCTOR(SBPlatformShellCommand,
176 (const lldb::SBPlatformShellCommand &), rhs);
178 *m_opaque_ptr = *rhs.m_opaque_ptr;
181 SBPlatformShellCommand &SBPlatformShellCommand::
182 operator=(const SBPlatformShellCommand &rhs) {
185 SBPlatformShellCommand &,
186 SBPlatformShellCommand, operator=,(const lldb::SBPlatformShellCommand &),
189 *m_opaque_ptr = *rhs.m_opaque_ptr;
190 return LLDB_RECORD_RESULT(*this);
193 SBPlatformShellCommand::~SBPlatformShellCommand() { delete m_opaque_ptr; }
195 void SBPlatformShellCommand::Clear() {
196 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatformShellCommand, Clear);
198 m_opaque_ptr->m_output = std::string();
199 m_opaque_ptr->m_status = 0;
200 m_opaque_ptr->m_signo = 0;
203 const char *SBPlatformShellCommand::GetCommand() {
204 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetCommand);
206 if (m_opaque_ptr->m_command.empty())
208 return m_opaque_ptr->m_command.c_str();
211 void SBPlatformShellCommand::SetCommand(const char *shell_command) {
212 LLDB_RECORD_METHOD(void, SBPlatformShellCommand, SetCommand, (const char *),
215 if (shell_command && shell_command[0])
216 m_opaque_ptr->m_command = shell_command;
218 m_opaque_ptr->m_command.clear();
221 const char *SBPlatformShellCommand::GetWorkingDirectory() {
222 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand,
223 GetWorkingDirectory);
225 if (m_opaque_ptr->m_working_dir.empty())
227 return m_opaque_ptr->m_working_dir.c_str();
230 void SBPlatformShellCommand::SetWorkingDirectory(const char *path) {
231 LLDB_RECORD_METHOD(void, SBPlatformShellCommand, SetWorkingDirectory,
232 (const char *), path);
235 m_opaque_ptr->m_working_dir = path;
237 m_opaque_ptr->m_working_dir.clear();
240 uint32_t SBPlatformShellCommand::GetTimeoutSeconds() {
241 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatformShellCommand,
244 if (m_opaque_ptr->m_timeout)
245 return m_opaque_ptr->m_timeout->count();
249 void SBPlatformShellCommand::SetTimeoutSeconds(uint32_t sec) {
250 LLDB_RECORD_METHOD(void, SBPlatformShellCommand, SetTimeoutSeconds,
253 if (sec == UINT32_MAX)
254 m_opaque_ptr->m_timeout = llvm::None;
256 m_opaque_ptr->m_timeout = std::chrono::seconds(sec);
259 int SBPlatformShellCommand::GetSignal() {
260 LLDB_RECORD_METHOD_NO_ARGS(int, SBPlatformShellCommand, GetSignal);
262 return m_opaque_ptr->m_signo;
265 int SBPlatformShellCommand::GetStatus() {
266 LLDB_RECORD_METHOD_NO_ARGS(int, SBPlatformShellCommand, GetStatus);
268 return m_opaque_ptr->m_status;
271 const char *SBPlatformShellCommand::GetOutput() {
272 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetOutput);
274 if (m_opaque_ptr->m_output.empty())
276 return m_opaque_ptr->m_output.c_str();
280 SBPlatform::SBPlatform() : m_opaque_sp() {
281 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBPlatform);
284 SBPlatform::SBPlatform(const char *platform_name) : m_opaque_sp() {
285 LLDB_RECORD_CONSTRUCTOR(SBPlatform, (const char *), platform_name);
288 if (platform_name && platform_name[0])
289 m_opaque_sp = Platform::Create(ConstString(platform_name), error);
292 SBPlatform::SBPlatform(const SBPlatform &rhs) {
293 LLDB_RECORD_CONSTRUCTOR(SBPlatform, (const lldb::SBPlatform &), rhs);
295 m_opaque_sp = rhs.m_opaque_sp;
298 SBPlatform &SBPlatform::operator=(const SBPlatform &rhs) {
299 LLDB_RECORD_METHOD(SBPlatform &,
300 SBPlatform, operator=,(const lldb::SBPlatform &), rhs);
302 m_opaque_sp = rhs.m_opaque_sp;
303 return LLDB_RECORD_RESULT(*this);
306 SBPlatform::~SBPlatform() = default;
308 SBPlatform SBPlatform::GetHostPlatform() {
309 LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBPlatform, SBPlatform,
312 SBPlatform host_platform;
313 host_platform.m_opaque_sp = Platform::GetHostPlatform();
314 return LLDB_RECORD_RESULT(host_platform);
317 bool SBPlatform::IsValid() const {
318 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBPlatform, IsValid);
319 return this->operator bool();
321 SBPlatform::operator bool() const {
322 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBPlatform, operator bool);
324 return m_opaque_sp.get() != nullptr;
327 void SBPlatform::Clear() {
328 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatform, Clear);
333 const char *SBPlatform::GetName() {
334 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetName);
336 PlatformSP platform_sp(GetSP());
338 return platform_sp->GetName().GetCString();
342 lldb::PlatformSP SBPlatform::GetSP() const { return m_opaque_sp; }
344 void SBPlatform::SetSP(const lldb::PlatformSP &platform_sp) {
345 m_opaque_sp = platform_sp;
348 const char *SBPlatform::GetWorkingDirectory() {
349 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetWorkingDirectory);
351 PlatformSP platform_sp(GetSP());
353 return platform_sp->GetWorkingDirectory().GetCString();
357 bool SBPlatform::SetWorkingDirectory(const char *path) {
358 LLDB_RECORD_METHOD(bool, SBPlatform, SetWorkingDirectory, (const char *),
361 PlatformSP platform_sp(GetSP());
364 platform_sp->SetWorkingDirectory(FileSpec(path));
366 platform_sp->SetWorkingDirectory(FileSpec());
372 SBError SBPlatform::ConnectRemote(SBPlatformConnectOptions &connect_options) {
373 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, ConnectRemote,
374 (lldb::SBPlatformConnectOptions &), connect_options);
377 PlatformSP platform_sp(GetSP());
378 if (platform_sp && connect_options.GetURL()) {
381 llvm::StringRef::withNullAsEmpty(connect_options.GetURL()));
382 sb_error.ref() = platform_sp->ConnectRemote(args);
384 sb_error.SetErrorString("invalid platform");
386 return LLDB_RECORD_RESULT(sb_error);
389 void SBPlatform::DisconnectRemote() {
390 LLDB_RECORD_METHOD_NO_ARGS(void, SBPlatform, DisconnectRemote);
392 PlatformSP platform_sp(GetSP());
394 platform_sp->DisconnectRemote();
397 bool SBPlatform::IsConnected() {
398 LLDB_RECORD_METHOD_NO_ARGS(bool, SBPlatform, IsConnected);
400 PlatformSP platform_sp(GetSP());
402 return platform_sp->IsConnected();
406 const char *SBPlatform::GetTriple() {
407 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetTriple);
409 PlatformSP platform_sp(GetSP());
411 ArchSpec arch(platform_sp->GetSystemArchitecture());
412 if (arch.IsValid()) {
413 // Const-ify the string so we don't need to worry about the lifetime of
415 return ConstString(arch.GetTriple().getTriple().c_str()).GetCString();
421 const char *SBPlatform::GetOSBuild() {
422 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetOSBuild);
424 PlatformSP platform_sp(GetSP());
427 if (platform_sp->GetOSBuildString(s)) {
429 // Const-ify the string so we don't need to worry about the lifetime of
431 return ConstString(s.c_str()).GetCString();
438 const char *SBPlatform::GetOSDescription() {
439 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetOSDescription);
441 PlatformSP platform_sp(GetSP());
444 if (platform_sp->GetOSKernelDescription(s)) {
446 // Const-ify the string so we don't need to worry about the lifetime of
448 return ConstString(s.c_str()).GetCString();
455 const char *SBPlatform::GetHostname() {
456 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform, GetHostname);
458 PlatformSP platform_sp(GetSP());
460 return platform_sp->GetHostname();
464 uint32_t SBPlatform::GetOSMajorVersion() {
465 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatform, GetOSMajorVersion);
467 llvm::VersionTuple version;
468 if (PlatformSP platform_sp = GetSP())
469 version = platform_sp->GetOSVersion();
470 return version.empty() ? UINT32_MAX : version.getMajor();
473 uint32_t SBPlatform::GetOSMinorVersion() {
474 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatform, GetOSMinorVersion);
476 llvm::VersionTuple version;
477 if (PlatformSP platform_sp = GetSP())
478 version = platform_sp->GetOSVersion();
479 return version.getMinor().getValueOr(UINT32_MAX);
482 uint32_t SBPlatform::GetOSUpdateVersion() {
483 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatform, GetOSUpdateVersion);
485 llvm::VersionTuple version;
486 if (PlatformSP platform_sp = GetSP())
487 version = platform_sp->GetOSVersion();
488 return version.getSubminor().getValueOr(UINT32_MAX);
491 SBError SBPlatform::Get(SBFileSpec &src, SBFileSpec &dst) {
492 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Get,
493 (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
496 PlatformSP platform_sp(GetSP());
498 sb_error.ref() = platform_sp->GetFile(src.ref(), dst.ref());
500 sb_error.SetErrorString("invalid platform");
502 return LLDB_RECORD_RESULT(sb_error);
505 SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) {
506 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Put,
507 (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
508 return LLDB_RECORD_RESULT(
509 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
511 uint32_t permissions =
512 FileSystem::Instance().GetPermissions(src.ref());
513 if (permissions == 0) {
514 if (FileSystem::Instance().IsDirectory(src.ref()))
515 permissions = eFilePermissionsDirectoryDefault;
517 permissions = eFilePermissionsFileDefault;
520 return platform_sp->PutFile(src.ref(), dst.ref(), permissions);
524 error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
525 src.ref().GetPath().c_str());
530 SBError SBPlatform::Install(SBFileSpec &src, SBFileSpec &dst) {
531 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Install,
532 (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
533 return LLDB_RECORD_RESULT(
534 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
536 return platform_sp->Install(src.ref(), dst.ref());
539 error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
540 src.ref().GetPath().c_str());
545 SBError SBPlatform::Run(SBPlatformShellCommand &shell_command) {
546 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Run,
547 (lldb::SBPlatformShellCommand &), shell_command);
548 return LLDB_RECORD_RESULT(ExecuteConnected([&](const lldb::PlatformSP
550 const char *command = shell_command.GetCommand();
552 return Status("invalid shell command (empty)");
554 const char *working_dir = shell_command.GetWorkingDirectory();
555 if (working_dir == nullptr) {
556 working_dir = platform_sp->GetWorkingDirectory().GetCString();
558 shell_command.SetWorkingDirectory(working_dir);
560 return platform_sp->RunShellCommand(command, FileSpec(working_dir),
561 &shell_command.m_opaque_ptr->m_status,
562 &shell_command.m_opaque_ptr->m_signo,
563 &shell_command.m_opaque_ptr->m_output,
564 shell_command.m_opaque_ptr->m_timeout);
568 SBError SBPlatform::Launch(SBLaunchInfo &launch_info) {
569 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Launch, (lldb::SBLaunchInfo &),
571 return LLDB_RECORD_RESULT(
572 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
573 ProcessLaunchInfo info = launch_info.ref();
574 Status error = platform_sp->LaunchProcess(info);
575 launch_info.set_ref(info);
580 SBError SBPlatform::Kill(const lldb::pid_t pid) {
581 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Kill, (const lldb::pid_t), pid);
582 return LLDB_RECORD_RESULT(
583 ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
584 return platform_sp->KillProcess(pid);
588 SBError SBPlatform::ExecuteConnected(
589 const std::function<Status(const lldb::PlatformSP &)> &func) {
591 const auto platform_sp(GetSP());
593 if (platform_sp->IsConnected())
594 sb_error.ref() = func(platform_sp);
596 sb_error.SetErrorString("not connected");
598 sb_error.SetErrorString("invalid platform");
603 SBError SBPlatform::MakeDirectory(const char *path, uint32_t file_permissions) {
604 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, MakeDirectory,
605 (const char *, uint32_t), path, file_permissions);
608 PlatformSP platform_sp(GetSP());
611 platform_sp->MakeDirectory(FileSpec(path), file_permissions);
613 sb_error.SetErrorString("invalid platform");
615 return LLDB_RECORD_RESULT(sb_error);
618 uint32_t SBPlatform::GetFilePermissions(const char *path) {
619 LLDB_RECORD_METHOD(uint32_t, SBPlatform, GetFilePermissions, (const char *),
622 PlatformSP platform_sp(GetSP());
624 uint32_t file_permissions = 0;
625 platform_sp->GetFilePermissions(FileSpec(path), file_permissions);
626 return file_permissions;
631 SBError SBPlatform::SetFilePermissions(const char *path,
632 uint32_t file_permissions) {
633 LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, SetFilePermissions,
634 (const char *, uint32_t), path, file_permissions);
637 PlatformSP platform_sp(GetSP());
640 platform_sp->SetFilePermissions(FileSpec(path), file_permissions);
642 sb_error.SetErrorString("invalid platform");
644 return LLDB_RECORD_RESULT(sb_error);
647 SBUnixSignals SBPlatform::GetUnixSignals() const {
648 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBUnixSignals, SBPlatform,
651 if (auto platform_sp = GetSP())
652 return LLDB_RECORD_RESULT(SBUnixSignals{platform_sp});
654 return LLDB_RECORD_RESULT(SBUnixSignals());
657 SBEnvironment SBPlatform::GetEnvironment() {
658 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBEnvironment, SBPlatform, GetEnvironment);
659 PlatformSP platform_sp(GetSP());
662 return LLDB_RECORD_RESULT(SBEnvironment(platform_sp->GetEnvironment()));
665 return LLDB_RECORD_RESULT(SBEnvironment());
668 namespace lldb_private {
672 void RegisterMethods<SBPlatformConnectOptions>(Registry &R) {
673 LLDB_REGISTER_CONSTRUCTOR(SBPlatformConnectOptions, (const char *));
674 LLDB_REGISTER_CONSTRUCTOR(SBPlatformConnectOptions,
675 (const lldb::SBPlatformConnectOptions &));
676 LLDB_REGISTER_METHOD(
677 SBPlatformConnectOptions &,
678 SBPlatformConnectOptions, operator=,(
679 const lldb::SBPlatformConnectOptions &));
680 LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions, GetURL, ());
681 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetURL,
683 LLDB_REGISTER_METHOD(bool, SBPlatformConnectOptions, GetRsyncEnabled, ());
684 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, EnableRsync,
685 (const char *, const char *, bool));
686 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, DisableRsync, ());
687 LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions,
688 GetLocalCacheDirectory, ());
689 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetLocalCacheDirectory,
694 void RegisterMethods<SBPlatformShellCommand>(Registry &R) {
695 LLDB_REGISTER_CONSTRUCTOR(SBPlatformShellCommand, (const char *));
696 LLDB_REGISTER_CONSTRUCTOR(SBPlatformShellCommand,
697 (const lldb::SBPlatformShellCommand &));
698 LLDB_REGISTER_METHOD(
699 SBPlatformShellCommand &,
700 SBPlatformShellCommand, operator=,(const lldb::SBPlatformShellCommand &));
701 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, Clear, ());
702 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetCommand, ());
703 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetCommand,
705 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand,
706 GetWorkingDirectory, ());
707 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetWorkingDirectory,
709 LLDB_REGISTER_METHOD(uint32_t, SBPlatformShellCommand, GetTimeoutSeconds,
711 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetTimeoutSeconds,
713 LLDB_REGISTER_METHOD(int, SBPlatformShellCommand, GetSignal, ());
714 LLDB_REGISTER_METHOD(int, SBPlatformShellCommand, GetStatus, ());
715 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetOutput, ());
719 void RegisterMethods<SBPlatform>(Registry &R) {
720 LLDB_REGISTER_CONSTRUCTOR(SBPlatform, ());
721 LLDB_REGISTER_CONSTRUCTOR(SBPlatform, (const char *));
722 LLDB_REGISTER_CONSTRUCTOR(SBPlatform, (const lldb::SBPlatform &));
723 LLDB_REGISTER_METHOD(SBPlatform &,
724 SBPlatform, operator=,(const lldb::SBPlatform &));
725 LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, IsValid, ());
726 LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, operator bool, ());
727 LLDB_REGISTER_METHOD(void, SBPlatform, Clear, ());
728 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetName, ());
729 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetWorkingDirectory, ());
730 LLDB_REGISTER_METHOD(bool, SBPlatform, SetWorkingDirectory, (const char *));
731 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, ConnectRemote,
732 (lldb::SBPlatformConnectOptions &));
733 LLDB_REGISTER_METHOD(void, SBPlatform, DisconnectRemote, ());
734 LLDB_REGISTER_METHOD(bool, SBPlatform, IsConnected, ());
735 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetTriple, ());
736 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetOSBuild, ());
737 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetOSDescription, ());
738 LLDB_REGISTER_METHOD(const char *, SBPlatform, GetHostname, ());
739 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSMajorVersion, ());
740 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSMinorVersion, ());
741 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSUpdateVersion, ());
742 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Get,
743 (lldb::SBFileSpec &, lldb::SBFileSpec &));
744 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Put,
745 (lldb::SBFileSpec &, lldb::SBFileSpec &));
746 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Install,
747 (lldb::SBFileSpec &, lldb::SBFileSpec &));
748 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Run,
749 (lldb::SBPlatformShellCommand &));
750 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Launch,
751 (lldb::SBLaunchInfo &));
752 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, Kill, (const lldb::pid_t));
753 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, MakeDirectory,
754 (const char *, uint32_t));
755 LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetFilePermissions,
757 LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, SetFilePermissions,
758 (const char *, uint32_t));
759 LLDB_REGISTER_METHOD(lldb::SBEnvironment, SBPlatform, GetEnvironment, ());
760 LLDB_REGISTER_METHOD_CONST(lldb::SBUnixSignals, SBPlatform, GetUnixSignals,
762 LLDB_REGISTER_STATIC_METHOD(lldb::SBPlatform, SBPlatform, GetHostPlatform,