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 {
360 return platform_sp->GetWorkingDirectory().GetPathAsConstString().AsCString();
370 platform_sp->SetWorkingDirectory(
FileSpec(path));
372 platform_sp->SetWorkingDirectory(
FileSpec());
383 if (platform_sp && connect_options.
GetURL()) {
386 sb_error.
ref() = platform_sp->ConnectRemote(args);
398 platform_sp->DisconnectRemote();
406 return platform_sp->IsConnected();
415 ArchSpec arch(platform_sp->GetSystemArchitecture());
430 std::string s = platform_sp->GetOSBuildString().value_or(
"");
445 std::string s = platform_sp->GetOSKernelDescription().value_or(
"");
467 llvm::VersionTuple version;
469 version = platform_sp->GetOSVersion();
470 return version.empty() ?
UINT32_MAX : version.getMajor();
476 llvm::VersionTuple version;
478 version = platform_sp->GetOSVersion();
479 return version.getMinor().value_or(
UINT32_MAX);
485 llvm::VersionTuple version;
487 version = platform_sp->GetOSVersion();
488 return version.getSubminor().value_or(
UINT32_MAX);
494 platform_sp->SetSDKRootDirectory(llvm::StringRef(sysroot).str());
503 sb_error.
ref() = platform_sp->GetFile(src.
ref(), dst.
ref());
515 if (permissions == 0) {
517 permissions = eFilePermissionsDirectoryDefault;
519 permissions = eFilePermissionsFileDefault;
522 return platform_sp->PutFile(src.
ref(), dst.
ref(), permissions);
526 "'src' argument doesn't exist: '%s'", src.
ref().
GetPath().c_str());
534 return platform_sp->Install(src.
ref(), dst.
ref());
538 "'src' argument doesn't exist: '%s'", src.
ref().
GetPath().c_str());
547 const char *command = shell_command.
GetCommand();
552 std::string platform_working_dir =
553 platform_sp->GetWorkingDirectory().GetPath();
554 if (!platform_working_dir.empty())
557 return platform_sp->RunShellCommand(
583 if (platform_sp->IsConnected()) {
586 ProcessSP process_sp = platform_sp->Attach(info, debugger.
ref(),
587 target.
GetSP().get(), status);
588 error.SetError(std::move(status));
602 if (platform_sp->IsConnected()) {
617 return platform_sp->KillProcess(pid);
624 const auto platform_sp(
GetSP());
626 if (platform_sp->IsConnected())
627 sb_error.
ref() = func(platform_sp);
643 platform_sp->MakeDirectory(
FileSpec(path), file_permissions);
655 uint32_t file_permissions = 0;
656 platform_sp->GetFilePermissions(
FileSpec(path), file_permissions);
657 return file_permissions;
663 uint32_t file_permissions) {
670 platform_sp->SetFilePermissions(
FileSpec(path), file_permissions);
680 if (
auto platform_sp =
GetSP())
702 return SBError(
"invalid platform");
706 platform_sp->SetLocateModuleCallback(
nullptr);
714 platform_sp->SetLocateModuleCallback(
715 [callback, callback_baton](
const ModuleSpec &module_spec,
722 SBError error = callback(callback_baton, module_spec_sb,
723 module_file_spec_sb, symbol_file_spec_sb);
725 if (
error.Success()) {
726 module_file_spec = module_file_spec_sb.
ref();
727 symbol_file_spec = symbol_file_spec_sb.
ref();
730 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