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