Lines Matching full:platform
1 //===-- Platform.cpp ------------------------------------------------------===//
32 #include "lldb/Target/Platform.h"
61 const char *Platform::GetHostPlatformName() { return "host"; }
76 static constexpr llvm::StringLiteral g_setting_name("platform");
126 /// Get the native host platform plug-in.
132 /// This platform will be used as the default platform when launching
133 /// or attaching to processes unless another platform is specified.
134 PlatformSP Platform::GetHostPlatform() { return GetHostPlatformSP(); }
136 void Platform::Initialize() {}
138 void Platform::Terminate() {}
140 PlatformProperties &Platform::GetGlobalPlatformProperties() {
145 void Platform::SetHostPlatform(const lldb::PlatformSP &platform_sp) {
146 // The native platform should use its static void Platform::Initialize()
147 // function to register itself as the native platform.
151 Status Platform::GetFileWithUUID(const FileSpec &platform_file,
159 Platform::LocateExecutableScriptingResources(Target *target, Module &module,
164 Status Platform::GetSharedModule(
204 bool Platform::GetModuleSpec(const FileSpec &module_file_spec,
216 PlatformSP Platform::Create(llvm::StringRef name) {
227 ArchSpec Platform::GetAugmentedArchSpec(Platform *platform, llvm::StringRef triple) {
228 if (platform)
229 return platform->GetAugmentedArchSpec(triple);
234 Platform::Platform(bool is_host)
243 LLDB_LOGF(log, "%p Platform::Platform()", static_cast<void *>(this));
246 Platform::~Platform() = default;
248 void Platform::GetStatus(Stream &strm) {
249 strm.Format(" Platform: {0}\n", GetPluginName());
291 strm.Printf("Platform-specific connection: %s\n", specific_info.c_str());
297 llvm::VersionTuple Platform::GetOSVersion(Process *process) {
302 // We have a local host platform
307 // We have a remote platform. We can only fetch the remote
339 std::optional<std::string> Platform::GetOSBuildString() {
345 std::optional<std::string> Platform::GetOSKernelDescription() {
351 void Platform::AddClangModuleCompilationOptions(
360 FileSpec Platform::GetWorkingDirectory() {
379 Platform *platform_ptr;
472 Status Platform::Install(const FileSpec &src, const FileSpec &dst) {
475 Log *log = GetLog(LLDBLog::Platform);
476 LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s')",
493 // the platform's working directory
503 "platform working directory must be valid for relative path '%s'",
513 "platform working directory must be valid for relative path '%s'",
522 error.SetErrorStringWithFormat("platform working directory must be valid "
528 LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s') fixed_dst='%s'",
569 error.SetErrorString("platform install doesn't handle pipes");
572 error.SetErrorString("platform install doesn't handle sockets");
576 "platform install doesn't handle non file or directory items");
583 bool Platform::SetWorkingDirectory(const FileSpec &file_spec) {
585 Log *log = GetLog(LLDBLog::Platform);
598 Status Platform::MakeDirectory(const FileSpec &file_spec,
604 error.SetErrorStringWithFormatv("remote platform {0} doesn't support {1}",
610 Status Platform::GetFilePermissions(const FileSpec &file_spec,
619 error.SetErrorStringWithFormatv("remote platform {0} doesn't support {1}",
625 Status Platform::SetFilePermissions(const FileSpec &file_spec,
632 error.SetErrorStringWithFormatv("remote platform {0} doesn't support {1}",
638 user_id_t Platform::OpenFile(const FileSpec &file_spec,
646 bool Platform::CloseFile(user_id_t fd, Status &error) {
652 user_id_t Platform::GetFileSize(const FileSpec &file_spec) {
662 uint64_t Platform::ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
667 "Platform::ReadFile() is not supported in the {0} platform",
672 uint64_t Platform::WriteFile(lldb::user_id_t fd, uint64_t offset,
677 "Platform::WriteFile() is not supported in the {0} platform",
682 UserIDResolver &Platform::GetUserIDResolver() {
688 const char *Platform::GetHostname() {
697 ConstString Platform::GetFullNameForDylib(ConstString basename) {
701 bool Platform::SetRemoteWorkingDirectory(const FileSpec &working_dir) {
702 Log *log = GetLog(LLDBLog::Platform);
703 LLDB_LOGF(log, "Platform::SetRemoteWorkingDirectory('%s')",
709 bool Platform::SetOSVersion(llvm::VersionTuple version) {
711 // We don't need anyone setting the OS version for the host platform, we
715 // We have a remote platform, allow setting the target OS version if we
717 // request the remote OS version from the connected platform.
732 Platform::ResolveExecutable(const ModuleSpec &module_spec,
759 // Ask the platform for the architectures that we should be using (in the
791 "'{0}' doesn't contain any '{1}' platform architectures: {2}",
796 Status Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec,
806 bool Platform::ResolveRemotePath(const FileSpec &platform_path,
813 const ArchSpec &Platform::GetSystemArchitecture() {
816 // We have a local host platform
821 // We have a remote platform. We can only fetch the remote system
847 ArchSpec Platform::GetAugmentedArchSpec(llvm::StringRef triple) {
876 Status Platform::ConnectRemote(Args &args) {
880 "The currently selected platform ({0}) is "
881 "the host platform and is always connected.",
885 "Platform::ConnectRemote() is not supported by {0}", GetPluginName());
889 Status Platform::DisconnectRemote() {
893 "The currently selected platform ({0}) is "
894 "the host platform and is always connected.",
898 "Platform::DisconnectRemote() is not supported by {0}",
903 bool Platform::GetProcessInfo(lldb::pid_t pid,
912 uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info,
922 ProcessInstanceInfoList Platform::GetAllProcesses() {
930 Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) {
932 Log *log = GetLog(LLDBLog::Platform);
933 LLDB_LOGF(log, "Platform::%s()", __FUNCTION__);
949 "Platform::%s GetResumeCountForLaunchInfo() returned %" PRIu32
968 LLDB_LOGF(log, "Platform::%s final launch_info resume count: %" PRIu32,
974 "base lldb_private::Platform class can't launch remote processes");
978 Status Platform::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
981 return Status("base lldb_private::Platform class can't expand arguments");
984 Status Platform::KillProcess(const lldb::pid_t pid) {
985 Log *log = GetLog(LLDBLog::Platform);
986 LLDB_LOGF(log, "Platform::%s, pid %" PRIu64, __FUNCTION__, pid);
990 "base lldb_private::Platform class can't kill remote processes");
996 lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info,
999 Log *log = GetLog(LLDBLog::Platform);
1025 "Platform::%s() StructuredDataPlugin launch "
1036 "Platform::%s LaunchProcess() call succeeded (pid=%" PRIu64 ")",
1061 LLDB_LOGF(log, "Platform::%s Attach() failed: %s", __FUNCTION__,
1066 "Platform::%s LaunchProcess() returned launch_info with "
1071 LLDB_LOGF(log, "Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
1079 Platform::CreateArchList(llvm::ArrayRef<llvm::Triple::ArchType> archs,
1091 /// Lets a platform answer if it is compatible with a given
1093 bool Platform::IsCompatibleArchitecture(const ArchSpec &arch,
1114 Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
1116 Log *log = GetLog(LLDBLog::Platform);
1200 Status Platform::GetFile(const FileSpec &source, const FileSpec &destination) {
1206 Platform::CreateSymlink(const FileSpec &src, // The name of the link is in src
1214 bool Platform::GetFileExists(const lldb_private::FileSpec &file_spec) {
1220 Status Platform::Unlink(const FileSpec &path) {
1226 MmapArgList Platform::GetMmapArgumentList(const ArchSpec &arch, addr_t addr,
1240 lldb_private::Status Platform::RunShellCommand(
1254 lldb_private::Status Platform::RunShellCommand(
1269 return Status("unable to run a remote command without a platform");
1273 Platform::CalculateMD5(const FileSpec &file_spec) {
1279 void Platform::SetLocalCacheDirectory(const char *local) {
1283 const char *Platform::GetLocalCacheDirectory() {
1292 "Platform-specific options required for rsync to work."},
1295 "Platform-specific rsync prefix put before the remote path."},
1307 "Platform-specific options required for SSH to work."},
1360 Platform::SetThreadCreationBreakpoint(lldb_private::Target &target) {
1424 Environment Platform::GetEnvironment() {
1430 const std::vector<ConstString> &Platform::GetTrapHandlerSymbolNames() {
1442 Platform::GetCachedExecutable(ModuleSpec &module_spec,
1449 return Platform::ResolveExecutable(spec, module_sp,
1461 Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec,
1485 // No valid architecture was specified, ask the platform for the
1528 // to bypass pulling files from remote platform, or to search symbol files
1583 void Platform::CallLocateModuleCallbackIfSet(const ModuleSpec &module_spec,
1597 Log *log = GetLog(LLDBLog::Platform);
1689 bool Platform::GetCachedSharedModule(const ModuleSpec &module_spec,
1696 Log *log = GetLog(LLDBLog::Platform);
1716 LLDB_LOGF(log, "Platform::%s - module %s not found in local cache: %s",
1722 Status Platform::DownloadModuleSlice(const FileSpec &src_file_spec,
1770 Status Platform::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
1773 "Symbol file downloading not supported by the default platform.");
1776 FileSpec Platform::GetModuleCacheRoot() {
1782 const char *Platform::GetCacheHostname() { return GetHostname(); }
1784 const UnixSignalsSP &Platform::GetRemoteUnixSignals() {
1789 UnixSignalsSP Platform::GetUnixSignals() {
1795 uint32_t Platform::LoadImage(lldb_private::Process *process,
1832 uint32_t Platform::DoLoadImage(lldb_private::Process *process,
1837 error.SetErrorString("LoadImage is not supported on the current platform");
1841 uint32_t Platform::LoadImageUsingPaths(lldb_private::Process *process,
1858 Status Platform::UnloadImage(lldb_private::Process *process,
1860 return Status("UnloadImage is not supported on the current platform");
1863 lldb::ProcessSP Platform::ConnectProcess(llvm::StringRef connect_url,
1871 lldb::ProcessSP Platform::ConnectProcessSynchronous(
1878 lldb::ProcessSP Platform::DoConnectProcess(llvm::StringRef connect_url,
1935 size_t Platform::ConnectToWaitingProcesses(lldb_private::Debugger &debugger,
1941 size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
2078 CompilerType Platform::GetSiginfoType(const llvm::Triple& triple) {
2082 Args Platform::GetExtraStartupCommands() {
2086 void Platform::SetLocateModuleCallback(LocateModuleCallback callback) {
2090 Platform::LocateModuleCallback Platform::GetLocateModuleCallback() const {
2124 // First try exact arch matches across all platform plug-ins
2137 // Next try compatible arch matches across all platform plug-ins
2172 PlatformSP host_platform_sp = Platform::GetHostPlatform();
2174 // Prefer the selected platform if it matches at least one architecture.
2183 // Prefer the host platform if it matches at least one architecture.
2194 if (PlatformSP platform = GetOrCreate(arch, process_host_arch, nullptr))
2195 candidates.push_back(platform);
2198 // The selected or host platform didn't match any of the architectures. If
2199 // the same platform supports all architectures then that's the obvious next
2217 PlatformSP platform_sp = Platform::Create(name);