Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:54

0001 //===-- RemoteAwarePlatform.h -----------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_TARGET_REMOTEAWAREPLATFORM_H
0010 #define LLDB_TARGET_REMOTEAWAREPLATFORM_H
0011 
0012 #include "lldb/Target/Platform.h"
0013 #include <optional>
0014 
0015 namespace lldb_private {
0016 
0017 /// A base class for platforms which automatically want to be able to forward
0018 /// operations to a remote platform instance (such as PlatformRemoteGDBServer).
0019 class RemoteAwarePlatform : public Platform {
0020 public:
0021   using Platform::Platform;
0022 
0023   virtual Status
0024   ResolveExecutable(const ModuleSpec &module_spec,
0025                     lldb::ModuleSP &exe_module_sp,
0026                     const FileSpecList *module_search_paths_ptr) override;
0027 
0028   bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
0029                      ModuleSpec &module_spec) override;
0030 
0031   lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
0032                            uint32_t mode, Status &error) override;
0033 
0034   bool CloseFile(lldb::user_id_t fd, Status &error) override;
0035 
0036   uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
0037                     uint64_t dst_len, Status &error) override;
0038 
0039   uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
0040                      uint64_t src_len, Status &error) override;
0041 
0042   lldb::user_id_t GetFileSize(const FileSpec &file_spec) override;
0043 
0044   Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override;
0045 
0046   bool GetFileExists(const FileSpec &file_spec) override;
0047 
0048   Status Unlink(const FileSpec &file_spec) override;
0049 
0050   FileSpec GetRemoteWorkingDirectory() override;
0051 
0052   bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override;
0053 
0054   Status MakeDirectory(const FileSpec &file_spec, uint32_t mode) override;
0055 
0056   Status GetFilePermissions(const FileSpec &file_spec,
0057                             uint32_t &file_permissions) override;
0058 
0059   Status SetFilePermissions(const FileSpec &file_spec,
0060                             uint32_t file_permissions) override;
0061 
0062   llvm::ErrorOr<llvm::MD5::MD5Result>
0063   CalculateMD5(const FileSpec &file_spec) override;
0064 
0065   Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
0066                          FileSpec &local_file) override;
0067 
0068   bool GetRemoteOSVersion() override;
0069   std::optional<std::string> GetRemoteOSBuildString() override;
0070   std::optional<std::string> GetRemoteOSKernelDescription() override;
0071   ArchSpec GetRemoteSystemArchitecture() override;
0072 
0073   Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir,
0074                          int *status_ptr, int *signo_ptr,
0075                          std::string *command_output,
0076                          const Timeout<std::micro> &timeout) override;
0077 
0078   Status RunShellCommand(llvm::StringRef interpreter, llvm::StringRef command,
0079                          const FileSpec &working_dir, int *status_ptr,
0080                          int *signo_ptr, std::string *command_output,
0081                          const Timeout<std::micro> &timeout) override;
0082 
0083   const char *GetHostname() override;
0084   UserIDResolver &GetUserIDResolver() override;
0085   lldb_private::Environment GetEnvironment() override;
0086 
0087   bool IsConnected() const override;
0088 
0089   bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
0090   uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
0091                          ProcessInstanceInfoList &process_infos) override;
0092 
0093   lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
0094                                  llvm::StringRef plugin_name,
0095                                  Debugger &debugger, Target *target,
0096                                  Status &error) override;
0097 
0098   Status LaunchProcess(ProcessLaunchInfo &launch_info) override;
0099 
0100   Status KillProcess(const lldb::pid_t pid) override;
0101 
0102   size_t ConnectToWaitingProcesses(Debugger &debugger,
0103                                    Status &error) override;
0104 
0105 protected:
0106   lldb::PlatformSP m_remote_platform_sp;
0107 };
0108 
0109 } // namespace lldb_private
0110 
0111 #endif // LLDB_TARGET_REMOTEAWAREPLATFORM_H