1 //===-- SBPlatform.cpp ------------------------------------------*- C++ -*-===//
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/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"
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() {
39 ~PlatformConnectOptions() {}
42 std::string m_rsync_options
;
43 std::string m_rsync_remote_path_prefix
;
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
;
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
) {
86 SBPlatformConnectOptions
, operator=,(
87 const lldb::SBPlatformConnectOptions
&),
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())
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 *),
106 m_opaque_ptr
->m_url
= url
;
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
;
130 m_opaque_ptr
->m_rsync_remote_path_prefix
.clear();
132 if (options
&& options
[0])
133 m_opaque_ptr
->m_rsync_options
= options
;
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
);
156 m_opaque_ptr
->m_local_cache_directory
.SetCString(path
);
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 *),
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())
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 *),
199 if (shell_command
&& shell_command
[0])
200 m_opaque_ptr
->m_command
= shell_command
;
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())
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
);
219 m_opaque_ptr
->m_working_dir
= path
;
221 m_opaque_ptr
->m_working_dir
.clear();
224 uint32_t SBPlatformShellCommand::GetTimeoutSeconds() {
225 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBPlatformShellCommand
,
228 if (m_opaque_ptr
->m_timeout
)
229 return m_opaque_ptr
->m_timeout
->count();
233 void SBPlatformShellCommand::SetTimeoutSeconds(uint32_t sec
) {
234 LLDB_RECORD_METHOD(void, SBPlatformShellCommand
, SetTimeoutSeconds
,
237 if (sec
== UINT32_MAX
)
238 m_opaque_ptr
->m_timeout
= llvm::None
;
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())
260 return m_opaque_ptr
->m_output
.c_str();
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
);
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
);
294 const char *SBPlatform::GetName() {
295 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform
, GetName
);
297 PlatformSP
platform_sp(GetSP());
299 return platform_sp
->GetName().GetCString();
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());
314 return platform_sp
->GetWorkingDirectory().GetCString();
318 bool SBPlatform::SetWorkingDirectory(const char *path
) {
319 LLDB_RECORD_METHOD(bool, SBPlatform
, SetWorkingDirectory
, (const char *),
322 PlatformSP
platform_sp(GetSP());
325 platform_sp
->SetWorkingDirectory(FileSpec(path
));
327 platform_sp
->SetWorkingDirectory(FileSpec());
333 SBError
SBPlatform::ConnectRemote(SBPlatformConnectOptions
&connect_options
) {
334 LLDB_RECORD_METHOD(lldb::SBError
, SBPlatform
, ConnectRemote
,
335 (lldb::SBPlatformConnectOptions
&), connect_options
);
338 PlatformSP
platform_sp(GetSP());
339 if (platform_sp
&& connect_options
.GetURL()) {
342 llvm::StringRef::withNullAsEmpty(connect_options
.GetURL()));
343 sb_error
.ref() = platform_sp
->ConnectRemote(args
);
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());
355 platform_sp
->DisconnectRemote();
358 bool SBPlatform::IsConnected() {
359 LLDB_RECORD_METHOD_NO_ARGS(bool, SBPlatform
, IsConnected
);
361 PlatformSP
platform_sp(GetSP());
363 return platform_sp
->IsConnected();
367 const char *SBPlatform::GetTriple() {
368 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform
, GetTriple
);
370 PlatformSP
platform_sp(GetSP());
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
376 return ConstString(arch
.GetTriple().getTriple().c_str()).GetCString();
382 const char *SBPlatform::GetOSBuild() {
383 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform
, GetOSBuild
);
385 PlatformSP
platform_sp(GetSP());
388 if (platform_sp
->GetOSBuildString(s
)) {
390 // Const-ify the string so we don't need to worry about the lifetime of
392 return ConstString(s
.c_str()).GetCString();
399 const char *SBPlatform::GetOSDescription() {
400 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform
, GetOSDescription
);
402 PlatformSP
platform_sp(GetSP());
405 if (platform_sp
->GetOSKernelDescription(s
)) {
407 // Const-ify the string so we don't need to worry about the lifetime of
409 return ConstString(s
.c_str()).GetCString();
416 const char *SBPlatform::GetHostname() {
417 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatform
, GetHostname
);
419 PlatformSP
platform_sp(GetSP());
421 return platform_sp
->GetHostname();
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
);
457 PlatformSP
platform_sp(GetSP());
459 sb_error
.ref() = platform_sp
->GetFile(src
.ref(), dst
.ref());
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
) {
472 uint32_t permissions
=
473 FileSystem::Instance().GetPermissions(src
.ref());
474 if (permissions
== 0) {
475 if (FileSystem::Instance().IsDirectory(src
.ref()))
476 permissions
= eFilePermissionsDirectoryDefault
;
478 permissions
= eFilePermissionsFileDefault
;
481 return platform_sp
->PutFile(src
.ref(), dst
.ref(), permissions
);
485 error
.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
486 src
.ref().GetPath().c_str());
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
) {
497 return platform_sp
->Install(src
.ref(), dst
.ref());
500 error
.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
501 src
.ref().GetPath().c_str());
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
511 const char *command
= shell_command
.GetCommand();
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();
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
);
529 SBError
SBPlatform::Launch(SBLaunchInfo
&launch_info
) {
530 LLDB_RECORD_METHOD(lldb::SBError
, SBPlatform
, Launch
, (lldb::SBLaunchInfo
&),
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
);
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
);
549 SBError
SBPlatform::ExecuteConnected(
550 const std::function
<Status(const lldb::PlatformSP
&)> &func
) {
552 const auto platform_sp(GetSP());
554 if (platform_sp
->IsConnected())
555 sb_error
.ref() = func(platform_sp
);
557 sb_error
.SetErrorString("not connected");
559 sb_error
.SetErrorString("invalid platform");
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
);
569 PlatformSP
platform_sp(GetSP());
572 platform_sp
->MakeDirectory(FileSpec(path
), file_permissions
);
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 *),
583 PlatformSP
platform_sp(GetSP());
585 uint32_t file_permissions
= 0;
586 platform_sp
->GetFilePermissions(FileSpec(path
), file_permissions
);
587 return file_permissions
;
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
);
598 PlatformSP
platform_sp(GetSP());
601 platform_sp
->SetFilePermissions(FileSpec(path
), file_permissions
);
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
,
612 if (auto platform_sp
= GetSP())
613 return LLDB_RECORD_RESULT(SBUnixSignals
{platform_sp
});
615 return LLDB_RECORD_RESULT(SBUnixSignals());
618 namespace lldb_private
{
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(
628 SBPlatformConnectOptions
, operator=,(
629 const lldb::SBPlatformConnectOptions
&));
630 LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions
, GetURL
, ());
631 LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions
, SetURL
,
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
,
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
,
652 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand
,
653 GetWorkingDirectory
, ());
654 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand
, SetWorkingDirectory
,
656 LLDB_REGISTER_METHOD(uint32_t, SBPlatformShellCommand
, GetTimeoutSeconds
,
658 LLDB_REGISTER_METHOD(void, SBPlatformShellCommand
, SetTimeoutSeconds
,
660 LLDB_REGISTER_METHOD(int, SBPlatformShellCommand
, GetSignal
, ());
661 LLDB_REGISTER_METHOD(int, SBPlatformShellCommand
, GetStatus
, ());
662 LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand
, GetOutput
, ());
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
,
701 LLDB_REGISTER_METHOD(lldb::SBError
, SBPlatform
, SetFilePermissions
,
702 (const char *, uint32_t));
703 LLDB_REGISTER_METHOD_CONST(lldb::SBUnixSignals
, SBPlatform
, GetUnixSignals
,