28#include "llvm/Support/FileSystem.h"
55 llvm::StringRef shell_command) {
56 if (!shell_interpreter.empty())
57 m_shell = shell_interpreter.str();
59 if (!
m_shell.empty() && !shell_command.empty())
64 if (!shell_command.empty())
126 const char *options,
const char *remote_path_prefix,
127 bool omit_hostname_from_remote_path) {
129 omit_hostname_from_remote_path);
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;
139 if (options && options[0])
154 return m_opaque_ptr->m_local_cache_directory.GetCString();
168 const char *shell_command)
216 if (shell_interpreter && shell_interpreter[0])
233 if (shell_command && shell_command[0])
322 return host_platform;
327 return this->
operator bool();
329SBPlatform::operator
bool()
const {
367 platform_sp->GetWorkingDirectory().GetPath());
377 platform_sp->SetWorkingDirectory(
FileSpec(path));
379 platform_sp->SetWorkingDirectory(
FileSpec());
390 if (platform_sp && connect_options.
GetURL()) {
393 sb_error.
ref() = platform_sp->ConnectRemote(args);
405 platform_sp->DisconnectRemote();
413 return platform_sp->IsConnected();
422 ArchSpec arch(platform_sp->GetSystemArchitecture());
435 std::string s = platform_sp->GetOSBuildString().value_or(
"");
448 std::string s = platform_sp->GetOSKernelDescription().value_or(
"");
468 llvm::VersionTuple version;
470 version = platform_sp->GetOSVersion();
471 return version.empty() ?
UINT32_MAX : version.getMajor();
477 llvm::VersionTuple version;
479 version = platform_sp->GetOSVersion();
480 return version.getMinor().value_or(
UINT32_MAX);
486 llvm::VersionTuple version;
488 version = platform_sp->GetOSVersion();
489 return version.getSubminor().value_or(
UINT32_MAX);
495 platform_sp->SetSDKRootDirectory(llvm::StringRef(sysroot).str());
504 sb_error.
ref() = platform_sp->GetFile(src.
ref(), dst.
ref());
516 if (permissions == 0) {
518 permissions = eFilePermissionsDirectoryDefault;
520 permissions = eFilePermissionsFileDefault;
523 return platform_sp->PutFile(src.
ref(), dst.
ref(), permissions);
527 "'src' argument doesn't exist: '%s'", src.
ref().
GetPath().c_str());
535 return platform_sp->Install(src.
ref(), dst.
ref());
539 "'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.
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)
const char * Intern(llvm::StringRef str) const
const char * InternNonEmpty(llvm::StringRef str) const
Like Intern, but an empty string yields nullptr.
static StringPoolRef GetSystemPool()
The system pool. Only valid between Initialize and Terminate.
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