diff options
Diffstat (limited to 'contrib/llvm-project/lldb/include/lldb/Target/Platform.h')
-rw-r--r-- | contrib/llvm-project/lldb/include/lldb/Target/Platform.h | 79 |
1 files changed, 45 insertions, 34 deletions
diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Platform.h b/contrib/llvm-project/lldb/include/lldb/Target/Platform.h index 4ef6c9d82b1a..aa09b345e4e1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/Platform.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/Platform.h @@ -94,20 +94,11 @@ public: /// attaching to processes unless another platform is specified. static lldb::PlatformSP GetHostPlatform(); - static lldb::PlatformSP - GetPlatformForArchitecture(const ArchSpec &arch, ArchSpec *platform_arch_ptr); - static const char *GetHostPlatformName(); static void SetHostPlatform(const lldb::PlatformSP &platform_sp); - // Find an existing platform plug-in by name - static lldb::PlatformSP Find(ConstString name); - - static lldb::PlatformSP Create(ConstString name, Status &error); - - static lldb::PlatformSP Create(const ArchSpec &arch, - ArchSpec *platform_arch_ptr, Status &error); + static lldb::PlatformSP Create(llvm::StringRef name); /// Augments the triple either with information from platform or the host /// system (if platform is null). @@ -217,7 +208,7 @@ public: llvm::Optional<std::string> GetOSKernelDescription(); // Returns the name of the platform - ConstString GetName(); + llvm::StringRef GetName() { return GetPluginName(); } virtual const char *GetHostname(); @@ -257,7 +248,7 @@ public: virtual bool SetRemoteWorkingDirectory(const FileSpec &working_dir); - virtual UserIDResolver &GetUserIDResolver() = 0; + virtual UserIDResolver &GetUserIDResolver(); /// Locate a file for a platform. /// @@ -310,7 +301,12 @@ public: /// Get the platform's supported architectures in the order in which they /// should be searched. - virtual std::vector<ArchSpec> GetSupportedArchitectures() = 0; + /// + /// \param[in] process_host_arch + /// The process host architecture if it's known. An invalid ArchSpec + /// represents that the process host architecture is unknown. + virtual std::vector<ArchSpec> + GetSupportedArchitectures(const ArchSpec &process_host_arch) = 0; virtual size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site); @@ -332,6 +328,7 @@ public: /// Lets a platform answer if it is compatible with a given architecture and /// the target triple contained within. virtual bool IsCompatibleArchitecture(const ArchSpec &arch, + const ArchSpec &process_host_arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr); @@ -493,34 +490,20 @@ public: virtual lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, - Status &error) { - return UINT64_MAX; - } + Status &error); - virtual bool CloseFile(lldb::user_id_t fd, Status &error) { return false; } + virtual bool CloseFile(lldb::user_id_t fd, Status &error); - virtual lldb::user_id_t GetFileSize(const FileSpec &file_spec) { - return UINT64_MAX; - } + virtual lldb::user_id_t GetFileSize(const FileSpec &file_spec); virtual void AutoCompleteDiskFileOrDirectory(CompletionRequest &request, bool only_dir) {} virtual uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, Status &error) { - error.SetErrorStringWithFormat( - "Platform::ReadFile() is not supported in the %s platform", - GetName().GetCString()); - return -1; - } + uint64_t dst_len, Status &error); virtual uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, - const void *src, uint64_t src_len, Status &error) { - error.SetErrorStringWithFormat( - "Platform::WriteFile() is not supported in the %s platform", - GetName().GetCString()); - return -1; - } + const void *src, uint64_t src_len, Status &error); virtual Status GetFile(const FileSpec &source, const FileSpec &destination); @@ -864,6 +847,8 @@ public: } virtual CompilerType GetSiginfoType(const llvm::Triple &triple); + + virtual Args GetExtraStartupCommands(); protected: /// Create a list of ArchSpecs with the given OS and a architectures. The @@ -892,7 +877,7 @@ protected: FileSpec m_working_dir; // The working directory which is used when installing // modules that have no install path set std::string m_remote_url; - std::string m_name; + std::string m_hostname; llvm::VersionTuple m_os_version; ArchSpec m_system_arch; // The architecture of the kernel or the remote platform @@ -960,7 +945,7 @@ private: class PlatformList { public: - PlatformList() {} + PlatformList() = default; ~PlatformList() = default; @@ -1015,6 +1000,32 @@ public: } } + lldb::PlatformSP GetOrCreate(llvm::StringRef name); + lldb::PlatformSP GetOrCreate(const ArchSpec &arch, + const ArchSpec &process_host_arch, + ArchSpec *platform_arch_ptr, Status &error); + lldb::PlatformSP GetOrCreate(const ArchSpec &arch, + const ArchSpec &process_host_arch, + ArchSpec *platform_arch_ptr); + + /// Get the platform for the given list of architectures. + /// + /// The algorithm works a follows: + /// + /// 1. Returns the selected platform if it matches any of the architectures. + /// 2. Returns the host platform if it matches any of the architectures. + /// 3. Returns the platform that matches all the architectures. + /// + /// If none of the above apply, this function returns a default platform. The + /// candidates output argument differentiates between either no platforms + /// supporting the given architecture or multiple platforms supporting the + /// given architecture. + lldb::PlatformSP GetOrCreate(llvm::ArrayRef<ArchSpec> archs, + const ArchSpec &process_host_arch, + std::vector<lldb::PlatformSP> &candidates); + + lldb::PlatformSP Create(llvm::StringRef name); + protected: typedef std::vector<lldb::PlatformSP> collection; mutable std::recursive_mutex m_mutex; |