1 //===-- PlatformPOSIX.h -----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_PlatformPOSIX_h_
11 #define liblldb_PlatformPOSIX_h_
18 // Other libraries and framework includes
20 #include "lldb/Interpreter/Options.h"
21 #include "lldb/Target/Platform.h"
23 class PlatformPOSIX : public lldb_private::Platform
26 PlatformPOSIX (bool is_host);
31 //------------------------------------------------------------
32 // lldb_private::Platform functions
33 //------------------------------------------------------------
36 GetModuleSpec (const lldb_private::FileSpec& module_file_spec,
37 const lldb_private::ArchSpec& arch,
38 lldb_private::ModuleSpec &module_spec) override;
40 lldb_private::OptionGroupOptions
41 *GetConnectionOptions(
42 lldb_private::CommandInterpreter &interpreter) override;
45 GetHostname () override;
48 GetUserName (uint32_t uid) override;
51 GetGroupName (uint32_t gid) override;
54 PutFile (const lldb_private::FileSpec& source,
55 const lldb_private::FileSpec& destination,
56 uint32_t uid = UINT32_MAX,
57 uint32_t gid = UINT32_MAX) override;
60 OpenFile (const lldb_private::FileSpec& file_spec,
63 lldb_private::Error &error) override;
66 CloseFile (lldb::user_id_t fd,
67 lldb_private::Error &error) override;
70 ReadFile (lldb::user_id_t fd,
74 lldb_private::Error &error) override;
77 WriteFile (lldb::user_id_t fd,
81 lldb_private::Error &error) override;
84 GetFileSize (const lldb_private::FileSpec& file_spec) override;
87 CreateSymlink(const lldb_private::FileSpec &src,
88 const lldb_private::FileSpec &dst) override;
91 GetFile(const lldb_private::FileSpec &source,
92 const lldb_private::FileSpec &destination) override;
94 lldb_private::FileSpec
95 GetRemoteWorkingDirectory() override;
98 SetRemoteWorkingDirectory(const lldb_private::FileSpec &working_dir) override;
101 GetRemoteOSVersion () override;
104 GetRemoteOSBuildString (std::string &s) override;
107 GetRemoteOSKernelDescription (std::string &s) override;
109 lldb_private::ArchSpec
110 GetRemoteSystemArchitecture () override;
112 const lldb::UnixSignalsSP &
113 GetRemoteUnixSignals() override;
116 GetEnvironment (lldb_private::StringList &environment) override;
119 IsConnected () const override;
122 RunShellCommand(const char *command, // Shouldn't be NULL
123 const lldb_private::FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
124 int *status_ptr, // Pass NULL if you don't want the process exit status
125 int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
126 std::string *command_output, // Pass NULL if you don't want the command output
127 uint32_t timeout_sec) override; // Timeout in seconds to wait for shell program to finish
130 MakeDirectory(const lldb_private::FileSpec &file_spec, uint32_t mode) override;
133 GetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t &file_permissions) override;
136 SetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t file_permissions) override;
139 GetFileExists (const lldb_private::FileSpec& file_spec) override;
142 Unlink(const lldb_private::FileSpec &file_spec) override;
145 LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info) override;
148 KillProcess (const lldb::pid_t pid) override;
151 Attach (lldb_private::ProcessAttachInfo &attach_info,
152 lldb_private::Debugger &debugger,
153 lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
154 lldb_private::Error &error) override;
157 DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
158 lldb_private::Debugger &debugger,
159 lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
160 lldb_private::Error &error) override;
163 GetPlatformSpecificConnectionInformation() override;
166 CalculateMD5 (const lldb_private::FileSpec& file_spec,
168 uint64_t &high) override;
171 CalculateTrapHandlerSymbolNames () override;
174 ConnectRemote (lldb_private::Args& args) override;
177 DisconnectRemote () override;
180 std::unique_ptr<lldb_private::OptionGroupOptions> m_options;
182 lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote POSIX-compliant OS
185 DISALLOW_COPY_AND_ASSIGN (PlatformPOSIX);
189 #endif // liblldb_PlatformPOSIX_h_