LLDB mainline
SBPlatform.cpp
Go to the documentation of this file.
1//===-- SBPlatform.cpp ----------------------------------------------------===//
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 "lldb/API/SBDebugger.h"
12#include "lldb/API/SBError.h"
13#include "lldb/API/SBFileSpec.h"
16#include "lldb/API/SBPlatform.h"
18#include "lldb/API/SBTarget.h"
20#include "lldb/Host/File.h"
22#include "lldb/Target/Target.h"
24#include "lldb/Utility/Args.h"
26#include "lldb/Utility/Status.h"
27
28#include "llvm/Support/FileSystem.h"
29
30#include <functional>
31
32using namespace lldb;
33using namespace lldb_private;
34
35// PlatformConnectOptions
37 PlatformConnectOptions(const char *url = nullptr) {
38 if (url && url[0])
39 m_url = url;
40 }
41
43
44 std::string m_url;
45 std::string m_rsync_options;
47 bool m_rsync_enabled = false;
50};
51
52// PlatformShellCommand
54 PlatformShellCommand(llvm::StringRef shell_interpreter,
55 llvm::StringRef shell_command) {
56 if (!shell_interpreter.empty())
57 m_shell = shell_interpreter.str();
58
59 if (!m_shell.empty() && !shell_command.empty())
60 m_command = shell_command.str();
61 }
62
63 PlatformShellCommand(llvm::StringRef shell_command = llvm::StringRef()) {
64 if (!shell_command.empty())
65 m_command = shell_command.str();
66 }
67
69
70 std::string m_shell;
71 std::string m_command;
72 std::string m_working_dir;
73 std::string m_output;
74 int m_status = 0;
75 int m_signo = 0;
77};
78// SBPlatformConnectOptions
80 : m_opaque_ptr(new PlatformConnectOptions(url)) {
81 LLDB_INSTRUMENT_VA(this, url);
82}
83
85 const SBPlatformConnectOptions &rhs)
86 : m_opaque_ptr(new PlatformConnectOptions()) {
87 LLDB_INSTRUMENT_VA(this, rhs);
88
90}
91
93
96 LLDB_INSTRUMENT_VA(this, rhs);
97
99 return *this;
100}
101
103 LLDB_INSTRUMENT_VA(this);
104
105 if (m_opaque_ptr->m_url.empty())
106 return nullptr;
107 return ConstString(m_opaque_ptr->m_url.c_str()).GetCString();
108}
109
110void SBPlatformConnectOptions::SetURL(const char *url) {
111 LLDB_INSTRUMENT_VA(this, url);
112
113 if (url && url[0])
114 m_opaque_ptr->m_url = url;
115 else
116 m_opaque_ptr->m_url.clear();
117}
118
120 LLDB_INSTRUMENT_VA(this);
121
123}
124
126 const char *options, const char *remote_path_prefix,
127 bool omit_hostname_from_remote_path) {
128 LLDB_INSTRUMENT_VA(this, options, remote_path_prefix,
129 omit_hostname_from_remote_path);
130
133 omit_hostname_from_remote_path;
134 if (remote_path_prefix && remote_path_prefix[0])
135 m_opaque_ptr->m_rsync_remote_path_prefix = remote_path_prefix;
136 else
138
139 if (options && options[0])
140 m_opaque_ptr->m_rsync_options = options;
141 else
143}
144
146 LLDB_INSTRUMENT_VA(this);
147
149}
150
152 LLDB_INSTRUMENT_VA(this);
153
155}
156
158 LLDB_INSTRUMENT_VA(this, path);
159
160 if (path && path[0])
162 else
164}
165
166// SBPlatformShellCommand
168 const char *shell_command)
169 : m_opaque_ptr(new PlatformShellCommand(shell_interpreter, shell_command)) {
170 LLDB_INSTRUMENT_VA(this, shell_interpreter, shell_command);
171}
172
174 : m_opaque_ptr(new PlatformShellCommand(shell_command)) {
175 LLDB_INSTRUMENT_VA(this, shell_command);
176}
177
179 const SBPlatformShellCommand &rhs)
180 : m_opaque_ptr(new PlatformShellCommand()) {
181 LLDB_INSTRUMENT_VA(this, rhs);
182
184}
185
188
189 LLDB_INSTRUMENT_VA(this, rhs);
190
192 return *this;
193}
194
196
198 LLDB_INSTRUMENT_VA(this);
199
200 m_opaque_ptr->m_output = std::string();
203}
204
206 LLDB_INSTRUMENT_VA(this);
207
208 if (m_opaque_ptr->m_shell.empty())
209 return nullptr;
210 return ConstString(m_opaque_ptr->m_shell.c_str()).GetCString();
211}
212
213void SBPlatformShellCommand::SetShell(const char *shell_interpreter) {
214 LLDB_INSTRUMENT_VA(this, shell_interpreter);
215
216 if (shell_interpreter && shell_interpreter[0])
217 m_opaque_ptr->m_shell = shell_interpreter;
218 else
219 m_opaque_ptr->m_shell.clear();
220}
221
223 LLDB_INSTRUMENT_VA(this);
224
225 if (m_opaque_ptr->m_command.empty())
226 return nullptr;
227 return ConstString(m_opaque_ptr->m_command.c_str()).GetCString();
228}
229
230void SBPlatformShellCommand::SetCommand(const char *shell_command) {
231 LLDB_INSTRUMENT_VA(this, shell_command);
232
233 if (shell_command && shell_command[0])
234 m_opaque_ptr->m_command = shell_command;
235 else
236 m_opaque_ptr->m_command.clear();
237}
238
240 LLDB_INSTRUMENT_VA(this);
241
242 if (m_opaque_ptr->m_working_dir.empty())
243 return nullptr;
245}
246
248 LLDB_INSTRUMENT_VA(this, path);
249
250 if (path && path[0])
252 else
254}
255
257 LLDB_INSTRUMENT_VA(this);
258
260 return m_opaque_ptr->m_timeout->count();
261 return UINT32_MAX;
262}
263
265 LLDB_INSTRUMENT_VA(this, sec);
266
267 if (sec == UINT32_MAX)
268 m_opaque_ptr->m_timeout = std::nullopt;
269 else
270 m_opaque_ptr->m_timeout = std::chrono::seconds(sec);
271}
272
274 LLDB_INSTRUMENT_VA(this);
275
276 return m_opaque_ptr->m_signo;
277}
278
280 LLDB_INSTRUMENT_VA(this);
281
282 return m_opaque_ptr->m_status;
283}
284
286 LLDB_INSTRUMENT_VA(this);
287
288 if (m_opaque_ptr->m_output.empty())
289 return nullptr;
290 return ConstString(m_opaque_ptr->m_output.c_str()).GetCString();
291}
292
293// SBPlatform
295
296SBPlatform::SBPlatform(const char *platform_name) {
297 LLDB_INSTRUMENT_VA(this, platform_name);
298
299 m_opaque_sp = Platform::Create(platform_name);
300}
301
303 LLDB_INSTRUMENT_VA(this, rhs);
304
306}
307
309 LLDB_INSTRUMENT_VA(this, rhs);
310
312 return *this;
313}
314
315SBPlatform::~SBPlatform() = default;
316
319
320 SBPlatform host_platform;
321 host_platform.m_opaque_sp = Platform::GetHostPlatform();
322 return host_platform;
323}
324
326 LLDB_INSTRUMENT_VA(this);
327 return this->operator bool();
328}
329SBPlatform::operator bool() const {
330 LLDB_INSTRUMENT_VA(this);
331
332 return m_opaque_sp.get() != nullptr;
333}
334
336 LLDB_INSTRUMENT_VA(this);
337
338 m_opaque_sp.reset();
339}
340
341const char *SBPlatform::GetName() {
342 LLDB_INSTRUMENT_VA(this);
343
344 PlatformSP platform_sp(GetSP());
345 if (platform_sp)
346 return ConstString(platform_sp->GetName()).AsCString();
347 return nullptr;
348}
349
351
352void SBPlatform::SetSP(const lldb::PlatformSP &platform_sp) {
353 m_opaque_sp = platform_sp;
354}
355
357 LLDB_INSTRUMENT_VA(this);
358
359 PlatformSP platform_sp(GetSP());
360 if (platform_sp)
361 return platform_sp->GetWorkingDirectory().GetPathAsConstString().AsCString();
362 return nullptr;
363}
364
365bool SBPlatform::SetWorkingDirectory(const char *path) {
366 LLDB_INSTRUMENT_VA(this, path);
367
368 PlatformSP platform_sp(GetSP());
369 if (platform_sp) {
370 if (path)
371 platform_sp->SetWorkingDirectory(FileSpec(path));
372 else
373 platform_sp->SetWorkingDirectory(FileSpec());
374 return true;
375 }
376 return false;
377}
378
380 LLDB_INSTRUMENT_VA(this, connect_options);
381
382 SBError sb_error;
383 PlatformSP platform_sp(GetSP());
384 if (platform_sp && connect_options.GetURL()) {
385 Args args;
386 args.AppendArgument(connect_options.GetURL());
387 sb_error.ref() = platform_sp->ConnectRemote(args);
388 } else {
389 sb_error.SetErrorString("invalid platform");
390 }
391 return sb_error;
392}
393
395 LLDB_INSTRUMENT_VA(this);
396
397 PlatformSP platform_sp(GetSP());
398 if (platform_sp)
399 platform_sp->DisconnectRemote();
400}
401
403 LLDB_INSTRUMENT_VA(this);
404
405 PlatformSP platform_sp(GetSP());
406 if (platform_sp)
407 return platform_sp->IsConnected();
408 return false;
409}
410
412 LLDB_INSTRUMENT_VA(this);
413
414 PlatformSP platform_sp(GetSP());
415 if (platform_sp) {
416 ArchSpec arch(platform_sp->GetSystemArchitecture());
417 if (arch.IsValid()) {
418 // Const-ify the string so we don't need to worry about the lifetime of
419 // the string
420 return ConstString(arch.GetTriple().getTriple().c_str()).GetCString();
421 }
422 }
423 return nullptr;
424}
425
427 LLDB_INSTRUMENT_VA(this);
428
429 PlatformSP platform_sp(GetSP());
430 if (platform_sp) {
431 std::string s = platform_sp->GetOSBuildString().value_or("");
432 if (!s.empty()) {
433 // Const-ify the string so we don't need to worry about the lifetime of
434 // the string
435 return ConstString(s).GetCString();
436 }
437 }
438 return nullptr;
439}
440
442 LLDB_INSTRUMENT_VA(this);
443
444 PlatformSP platform_sp(GetSP());
445 if (platform_sp) {
446 std::string s = platform_sp->GetOSKernelDescription().value_or("");
447 if (!s.empty()) {
448 // Const-ify the string so we don't need to worry about the lifetime of
449 // the string
450 return ConstString(s.c_str()).GetCString();
451 }
452 }
453 return nullptr;
454}
455
457 LLDB_INSTRUMENT_VA(this);
458
459 PlatformSP platform_sp(GetSP());
460 if (platform_sp)
461 return ConstString(platform_sp->GetHostname()).GetCString();
462 return nullptr;
463}
464
466 LLDB_INSTRUMENT_VA(this);
467
468 llvm::VersionTuple version;
469 if (PlatformSP platform_sp = GetSP())
470 version = platform_sp->GetOSVersion();
471 return version.empty() ? UINT32_MAX : version.getMajor();
472}
473
475 LLDB_INSTRUMENT_VA(this);
476
477 llvm::VersionTuple version;
478 if (PlatformSP platform_sp = GetSP())
479 version = platform_sp->GetOSVersion();
480 return version.getMinor().value_or(UINT32_MAX);
481}
482
484 LLDB_INSTRUMENT_VA(this);
485
486 llvm::VersionTuple version;
487 if (PlatformSP platform_sp = GetSP())
488 version = platform_sp->GetOSVersion();
489 return version.getSubminor().value_or(UINT32_MAX);
490}
491
492void SBPlatform::SetSDKRoot(const char *sysroot) {
493 LLDB_INSTRUMENT_VA(this, sysroot);
494 if (PlatformSP platform_sp = GetSP())
495 platform_sp->SetSDKRootDirectory(llvm::StringRef(sysroot).str());
496}
497
499 LLDB_INSTRUMENT_VA(this, src, dst);
500
501 SBError sb_error;
502 PlatformSP platform_sp(GetSP());
503 if (platform_sp) {
504 sb_error.ref() = platform_sp->GetFile(src.ref(), dst.ref());
505 } else {
506 sb_error.SetErrorString("invalid platform");
507 }
508 return sb_error;
509}
510
512 LLDB_INSTRUMENT_VA(this, src, dst);
513 return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
514 if (src.Exists()) {
515 uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref());
516 if (permissions == 0) {
517 if (FileSystem::Instance().IsDirectory(src.ref()))
518 permissions = eFilePermissionsDirectoryDefault;
519 else
520 permissions = eFilePermissionsFileDefault;
521 }
522
523 return platform_sp->PutFile(src.ref(), dst.ref(), permissions);
524 }
525
527 error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
528 src.ref().GetPath().c_str());
529 return error;
530 });
531}
532
534 LLDB_INSTRUMENT_VA(this, src, dst);
535 return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
536 if (src.Exists())
537 return platform_sp->Install(src.ref(), dst.ref());
538
540 error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
541 src.ref().GetPath().c_str());
542 return error;
543 });
544}
545
547 LLDB_INSTRUMENT_VA(this, shell_command);
548 return ExecuteConnected(
549 [&](const lldb::PlatformSP &platform_sp) {
550 const char *command = shell_command.GetCommand();
551 if (!command)
552 return Status("invalid shell command (empty)");
553
554 if (shell_command.GetWorkingDirectory() == nullptr) {
555 std::string platform_working_dir =
556 platform_sp->GetWorkingDirectory().GetPath();
557 if (!platform_working_dir.empty())
558 shell_command.SetWorkingDirectory(platform_working_dir.c_str());
559 }
560 return platform_sp->RunShellCommand(
561 shell_command.m_opaque_ptr->m_shell, command,
562 FileSpec(shell_command.GetWorkingDirectory()),
563 &shell_command.m_opaque_ptr->m_status,
564 &shell_command.m_opaque_ptr->m_signo,
565 &shell_command.m_opaque_ptr->m_output,
566 shell_command.m_opaque_ptr->m_timeout);
567 });
568}
569
571 LLDB_INSTRUMENT_VA(this, launch_info);
572 return 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);
576 return error;
577 });
578}
579
581 const SBDebugger &debugger, SBTarget &target,
582 SBError &error) {
583 LLDB_INSTRUMENT_VA(this, attach_info, debugger, target, error);
584
585 if (PlatformSP platform_sp = GetSP()) {
586 if (platform_sp->IsConnected()) {
587 ProcessAttachInfo &info = attach_info.ref();
588 Status status;
589 ProcessSP process_sp = platform_sp->Attach(info, debugger.ref(),
590 target.GetSP().get(), status);
591 error.SetError(status);
592 return SBProcess(process_sp);
593 }
594
595 error.SetErrorString("not connected");
596 return {};
597 }
598
599 error.SetErrorString("invalid platform");
600 return {};
601}
602
604 if (PlatformSP platform_sp = GetSP()) {
605 if (platform_sp->IsConnected()) {
606 ProcessInstanceInfoList list = platform_sp->GetAllProcesses();
607 return SBProcessInfoList(list);
608 }
609 error.SetErrorString("not connected");
610 return {};
611 }
612
613 error.SetErrorString("invalid platform");
614 return {};
615}
616
618 LLDB_INSTRUMENT_VA(this, pid);
619 return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
620 return platform_sp->KillProcess(pid);
621 });
622}
623
625 const std::function<Status(const lldb::PlatformSP &)> &func) {
626 SBError sb_error;
627 const auto platform_sp(GetSP());
628 if (platform_sp) {
629 if (platform_sp->IsConnected())
630 sb_error.ref() = func(platform_sp);
631 else
632 sb_error.SetErrorString("not connected");
633 } else
634 sb_error.SetErrorString("invalid platform");
635
636 return sb_error;
637}
638
639SBError SBPlatform::MakeDirectory(const char *path, uint32_t file_permissions) {
640 LLDB_INSTRUMENT_VA(this, path, file_permissions);
641
642 SBError sb_error;
643 PlatformSP platform_sp(GetSP());
644 if (platform_sp) {
645 sb_error.ref() =
646 platform_sp->MakeDirectory(FileSpec(path), file_permissions);
647 } else {
648 sb_error.SetErrorString("invalid platform");
649 }
650 return sb_error;
651}
652
653uint32_t SBPlatform::GetFilePermissions(const char *path) {
654 LLDB_INSTRUMENT_VA(this, path);
655
656 PlatformSP platform_sp(GetSP());
657 if (platform_sp) {
658 uint32_t file_permissions = 0;
659 platform_sp->GetFilePermissions(FileSpec(path), file_permissions);
660 return file_permissions;
661 }
662 return 0;
663}
664
666 uint32_t file_permissions) {
667 LLDB_INSTRUMENT_VA(this, path, file_permissions);
668
669 SBError sb_error;
670 PlatformSP platform_sp(GetSP());
671 if (platform_sp) {
672 sb_error.ref() =
673 platform_sp->SetFilePermissions(FileSpec(path), file_permissions);
674 } else {
675 sb_error.SetErrorString("invalid platform");
676 }
677 return sb_error;
678}
679
681 LLDB_INSTRUMENT_VA(this);
682
683 if (auto platform_sp = GetSP())
684 return SBUnixSignals{platform_sp};
685
686 return SBUnixSignals();
687}
688
690 LLDB_INSTRUMENT_VA(this);
691 PlatformSP platform_sp(GetSP());
692
693 if (platform_sp) {
694 return SBEnvironment(platform_sp->GetEnvironment());
695 }
696
697 return SBEnvironment();
698}
699
701 lldb::SBPlatformLocateModuleCallback callback, void *callback_baton) {
702 LLDB_INSTRUMENT_VA(this, callback, callback_baton);
703 PlatformSP platform_sp(GetSP());
704 if (!platform_sp)
705 return SBError("invalid platform");
706
707 if (!callback) {
708 // Clear the callback.
709 platform_sp->SetLocateModuleCallback(nullptr);
710 return SBError();
711 }
712
713 // Platform.h does not accept lldb::SBPlatformLocateModuleCallback directly
714 // because of the SBModuleSpec and SBFileSpec dependencies. Use a lambda to
715 // convert ModuleSpec/FileSpec <--> SBModuleSpec/SBFileSpec for the callback
716 // arguments.
717 platform_sp->SetLocateModuleCallback(
718 [callback, callback_baton](const ModuleSpec &module_spec,
719 FileSpec &module_file_spec,
720 FileSpec &symbol_file_spec) {
721 SBModuleSpec module_spec_sb(module_spec);
722 SBFileSpec module_file_spec_sb;
723 SBFileSpec symbol_file_spec_sb;
724
725 SBError error = callback(callback_baton, module_spec_sb,
726 module_file_spec_sb, symbol_file_spec_sb);
727
728 if (error.Success()) {
729 module_file_spec = module_file_spec_sb.ref();
730 symbol_file_spec = symbol_file_spec_sb.ref();
731 }
732
733 return error.ref();
734 });
735 return SBError();
736}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
lldb_private::ProcessAttachInfo & ref()
lldb_private::Debugger & ref() const
void SetErrorString(const char *err_str)
Definition: SBError.cpp:132
lldb_private::Status & ref()
Definition: SBError.cpp:167
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:162
bool Exists() const
Definition: SBFileSpec.cpp:86
void set_ref(const lldb_private::ProcessLaunchInfo &info)
const lldb_private::ProcessLaunchInfo & ref() const
PlatformConnectOptions * m_opaque_ptr
Definition: SBPlatform.h:53
const char * GetLocalCacheDirectory()
Definition: SBPlatform.cpp:151
SBPlatformConnectOptions(const char *url)
Definition: SBPlatform.cpp:79
void EnableRsync(const char *options, const char *remote_path_prefix, bool omit_remote_hostname)
Definition: SBPlatform.cpp:125
SBPlatformConnectOptions & operator=(const SBPlatformConnectOptions &rhs)
Definition: SBPlatform.cpp:95
void SetURL(const char *url)
Definition: SBPlatform.cpp:110
void SetLocalCacheDirectory(const char *path)
Definition: SBPlatform.cpp:157
SBPlatformShellCommand & operator=(const SBPlatformShellCommand &rhs)
Definition: SBPlatform.cpp:187
void SetCommand(const char *shell_command)
Definition: SBPlatform.cpp:230
void SetShell(const char *shell)
Definition: SBPlatform.cpp:213
PlatformShellCommand * m_opaque_ptr
Definition: SBPlatform.h:94
void SetTimeoutSeconds(uint32_t sec)
Definition: SBPlatform.cpp:264
void SetWorkingDirectory(const char *path)
Definition: SBPlatform.cpp:247
const char * GetWorkingDirectory()
Definition: SBPlatform.cpp:239
SBPlatformShellCommand(const char *shell, const char *shell_command)
Definition: SBPlatform.cpp:167
SBError ExecuteConnected(const std::function< lldb_private::Status(const lldb::PlatformSP &)> &func)
Definition: SBPlatform.cpp:624
const char * GetName()
Definition: SBPlatform.cpp:341
SBError Kill(const lldb::pid_t pid)
Definition: SBPlatform.cpp:617
lldb::PlatformSP GetSP() const
Definition: SBPlatform.cpp:350
SBError Launch(SBLaunchInfo &launch_info)
Definition: SBPlatform.cpp:570
uint32_t GetOSMinorVersion()
Definition: SBPlatform.cpp:474
uint32_t GetOSUpdateVersion()
Definition: SBPlatform.cpp:483
bool IsValid() const
Definition: SBPlatform.cpp:325
const char * GetTriple()
Definition: SBPlatform.cpp:411
SBProcessInfoList GetAllProcesses(SBError &error)
Definition: SBPlatform.cpp:603
uint32_t GetOSMajorVersion()
Definition: SBPlatform.cpp:465
SBError ConnectRemote(SBPlatformConnectOptions &connect_options)
Definition: SBPlatform.cpp:379
void SetSDKRoot(const char *sysroot)
Definition: SBPlatform.cpp:492
static SBPlatform GetHostPlatform()
Definition: SBPlatform.cpp:317
SBEnvironment GetEnvironment()
Return the environment variables of the remote platform connection process.
Definition: SBPlatform.cpp:689
SBError SetFilePermissions(const char *path, uint32_t file_permissions)
Definition: SBPlatform.cpp:665
SBError MakeDirectory(const char *path, uint32_t file_permissions=eFilePermissionsDirectoryDefault)
Definition: SBPlatform.cpp:639
SBUnixSignals GetUnixSignals() const
Definition: SBPlatform.cpp:680
SBError Run(SBPlatformShellCommand &shell_command)
Definition: SBPlatform.cpp:546
SBError SetLocateModuleCallback(lldb::SBPlatformLocateModuleCallback callback, void *callback_baton)
Set a callback as an implementation for locating module in order to implement own module cache system...
Definition: SBPlatform.cpp:700
SBPlatform & operator=(const SBPlatform &rhs)
Definition: SBPlatform.cpp:308
const char * GetOSDescription()
Definition: SBPlatform.cpp:441
SBProcess Attach(SBAttachInfo &attach_info, const SBDebugger &debugger, SBTarget &target, SBError &error)
Definition: SBPlatform.cpp:580
void SetSP(const lldb::PlatformSP &platform_sp)
Definition: SBPlatform.cpp:352
const char * GetHostname()
Definition: SBPlatform.cpp:456
void DisconnectRemote()
Definition: SBPlatform.cpp:394
lldb::PlatformSP m_opaque_sp
Definition: SBPlatform.h:205
SBError Put(SBFileSpec &src, SBFileSpec &dst)
Definition: SBPlatform.cpp:511
uint32_t GetFilePermissions(const char *path)
Definition: SBPlatform.cpp:653
const char * GetWorkingDirectory()
Definition: SBPlatform.cpp:356
SBError Get(SBFileSpec &src, SBFileSpec &dst)
Definition: SBPlatform.cpp:498
const char * GetOSBuild()
Definition: SBPlatform.cpp:426
SBError Install(SBFileSpec &src, SBFileSpec &dst)
Definition: SBPlatform.cpp:533
bool SetWorkingDirectory(const char *path)
Definition: SBPlatform.cpp:365
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:585
An architecture specification class.
Definition: ArchSpec.h:31
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:348
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:450
A command line argument class.
Definition: Args.h:33
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
Definition: Args.cpp:322
A uniqued constant string class.
Definition: ConstString.h:40
void SetCString(const char *cstr)
Set the C string value.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:188
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:214
A file utility class.
Definition: FileSpec.h:56
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:367
static lldb::PlatformSP Create(llvm::StringRef name)
Definition: Platform.cpp:250
static lldb::PlatformSP GetHostPlatform()
Get the native host platform plug-in.
Definition: Platform.cpp:134
An error handling class.
Definition: Status.h:44
#define UINT32_MAX
Definition: lldb-defines.h:19
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition: Host.h:32
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:380
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:381
uint64_t pid_t
Definition: lldb-types.h:81
SBError(* SBPlatformLocateModuleCallback)(void *baton, const SBModuleSpec &module_spec, SBFileSpec &module_file_spec, SBFileSpec &symbol_file_spec)
Definition: SBDefines.h:142
PlatformConnectOptions(const char *url=nullptr)
Definition: SBPlatform.cpp:37
std::string m_rsync_remote_path_prefix
Definition: SBPlatform.cpp:46
~PlatformConnectOptions()=default
bool m_rsync_omit_hostname_from_remote_path
Definition: SBPlatform.cpp:48
std::string m_rsync_options
Definition: SBPlatform.cpp:45
ConstString m_local_cache_directory
Definition: SBPlatform.cpp:49
PlatformShellCommand(llvm::StringRef shell_command=llvm::StringRef())
Definition: SBPlatform.cpp:63
std::string m_command
Definition: SBPlatform.cpp:71
std::string m_working_dir
Definition: SBPlatform.cpp:72
Timeout< std::ratio< 1 > > m_timeout
Definition: SBPlatform.cpp:76
PlatformShellCommand(llvm::StringRef shell_interpreter, llvm::StringRef shell_command)
Definition: SBPlatform.cpp:54
std::string m_output
Definition: SBPlatform.cpp:73
~PlatformShellCommand()=default
std::string m_shell
Definition: SBPlatform.cpp:70