27#include "llvm/Support/FileSystem.h"
54 llvm::StringRef shell_command) {
55 if (!shell_interpreter.empty())
56 m_shell = shell_interpreter.str();
58 if (!
m_shell.empty() && !shell_command.empty())
63 if (!shell_command.empty())
125 const char *options,
const char *remote_path_prefix,
126 bool omit_hostname_from_remote_path) {
128 omit_hostname_from_remote_path);
132 omit_hostname_from_remote_path;
133 if (remote_path_prefix && remote_path_prefix[0])
134 m_opaque_ptr->m_rsync_remote_path_prefix = remote_path_prefix;
138 if (options && options[0])
153 return m_opaque_ptr->m_local_cache_directory.GetCString();
167 const char *shell_command)
215 if (shell_interpreter && shell_interpreter[0])
232 if (shell_command && shell_command[0])
321 return host_platform;
326 return this->
operator bool();
328SBPlatform::operator
bool()
const {
365 return platform_sp->GetWorkingDirectory().GetPathAsConstString().AsCString();
375 platform_sp->SetWorkingDirectory(
FileSpec(path));
377 platform_sp->SetWorkingDirectory(
FileSpec());
388 if (platform_sp && connect_options.
GetURL()) {
391 sb_error.
ref() = platform_sp->ConnectRemote(args);
403 platform_sp->DisconnectRemote();
411 return platform_sp->IsConnected();
420 ArchSpec arch(platform_sp->GetSystemArchitecture());
435 std::string s = platform_sp->GetOSBuildString().value_or(
"");
450 std::string s = platform_sp->GetOSKernelDescription().value_or(
"");
472 llvm::VersionTuple version;
474 version = platform_sp->GetOSVersion();
475 return version.empty() ?
UINT32_MAX : version.getMajor();
481 llvm::VersionTuple version;
483 version = platform_sp->GetOSVersion();
484 return version.getMinor().value_or(
UINT32_MAX);
490 llvm::VersionTuple version;
492 version = platform_sp->GetOSVersion();
493 return version.getSubminor().value_or(
UINT32_MAX);
499 platform_sp->SetSDKRootDirectory(llvm::StringRef(sysroot).str());
508 sb_error.
ref() = platform_sp->GetFile(src.
ref(), dst.
ref());
520 if (permissions == 0) {
522 permissions = eFilePermissionsDirectoryDefault;
524 permissions = eFilePermissionsFileDefault;
527 return platform_sp->PutFile(src.
ref(), dst.
ref(), permissions);
531 "'src' argument doesn't exist: '%s'", src.
ref().
GetPath().c_str());
539 return platform_sp->Install(src.
ref(), dst.
ref());
543 "'src' argument doesn't exist: '%s'", src.
ref().
GetPath().c_str());
552 const char *command = shell_command.
GetCommand();
557 std::string platform_working_dir =
558 platform_sp->GetWorkingDirectory().GetPath();
559 if (!platform_working_dir.empty())
562 return platform_sp->RunShellCommand(
588 if (platform_sp->IsConnected()) {
591 ProcessSP process_sp = platform_sp->Attach(info, debugger.
ref(),
592 target.
GetSP().get(), status);
593 error.SetError(std::move(status));
607 if (platform_sp->IsConnected()) {
622 return platform_sp->KillProcess(pid);
629 const auto platform_sp(
GetSP());
631 if (platform_sp->IsConnected())
632 sb_error.
ref() = func(platform_sp);
648 platform_sp->MakeDirectory(
FileSpec(path), file_permissions);
660 uint32_t file_permissions = 0;
661 platform_sp->GetFilePermissions(
FileSpec(path), file_permissions);
662 return file_permissions;
668 uint32_t file_permissions) {
675 platform_sp->SetFilePermissions(
FileSpec(path), file_permissions);
685 if (
auto platform_sp =
GetSP())
707 return SBError(
"invalid platform");
711 platform_sp->SetLocateModuleCallback(
nullptr);
719 platform_sp->SetLocateModuleCallback(
720 [callback, callback_baton](
const ModuleSpec &module_spec,
727 SBError error = callback(callback_baton, module_spec_sb,
728 module_file_spec_sb, symbol_file_spec_sb);
730 if (
error.Success()) {
731 module_file_spec = module_file_spec_sb.
ref();
732 symbol_file_spec = symbol_file_spec_sb.
ref();
735 return error.ref().Clone();
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
lldb_private::ProcessAttachInfo & ref()
lldb_private::Debugger & ref() const
lldb_private::Status & ref()
const lldb_private::FileSpec & ref() const
void set_ref(const lldb_private::ProcessLaunchInfo &info)
const lldb_private::ProcessLaunchInfo & ref() const
lldb::TargetSP GetSP() const
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
llvm::Triple & GetTriple()
Architecture triple accessor.
A command line argument class.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
uint32_t GetPermissions(const FileSpec &file_spec) const
Return the current permissions of the given file.
static FileSystem & Instance()
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
A class that represents a running process on the host machine.
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
class LLDB_API SBProcessInfoList
lldb::SBError(* SBPlatformLocateModuleCallback)(void *baton, const lldb::SBModuleSpec &module_spec, lldb::SBFileSpec &module_file_spec, lldb::SBFileSpec &symbol_file_spec)
std::shared_ptr< lldb_private::Platform > PlatformSP
class LLDB_API SBUnixSignals
std::shared_ptr< lldb_private::Process > ProcessSP
class LLDB_API SBEnvironment