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);
28 ~PlatformPOSIX() override;
30 //------------------------------------------------------------
31 // lldb_private::Platform functions
32 //------------------------------------------------------------
35 GetModuleSpec (const lldb_private::FileSpec& module_file_spec,
36 const lldb_private::ArchSpec& arch,
37 lldb_private::ModuleSpec &module_spec) override;
39 lldb_private::OptionGroupOptions*
40 GetConnectionOptions(lldb_private::CommandInterpreter &interpreter) override;
43 GetHostname () override;
46 GetUserName (uint32_t uid) override;
49 GetGroupName (uint32_t gid) override;
52 PutFile (const lldb_private::FileSpec& source,
53 const lldb_private::FileSpec& destination,
54 uint32_t uid = UINT32_MAX,
55 uint32_t gid = UINT32_MAX) override;
58 OpenFile (const lldb_private::FileSpec& file_spec,
61 lldb_private::Error &error) override;
64 CloseFile (lldb::user_id_t fd,
65 lldb_private::Error &error) override;
68 ReadFile (lldb::user_id_t fd,
72 lldb_private::Error &error) override;
75 WriteFile (lldb::user_id_t fd,
79 lldb_private::Error &error) override;
82 GetFileSize (const lldb_private::FileSpec& file_spec) override;
85 CreateSymlink(const lldb_private::FileSpec &src,
86 const lldb_private::FileSpec &dst) override;
89 GetFile(const lldb_private::FileSpec &source,
90 const lldb_private::FileSpec &destination) override;
92 lldb_private::FileSpec
93 GetRemoteWorkingDirectory() override;
96 SetRemoteWorkingDirectory(const lldb_private::FileSpec &working_dir) override;
99 GetRemoteOSVersion () override;
102 GetRemoteOSBuildString (std::string &s) override;
105 GetRemoteOSKernelDescription (std::string &s) override;
107 lldb_private::ArchSpec
108 GetRemoteSystemArchitecture () override;
110 const lldb::UnixSignalsSP &
111 GetRemoteUnixSignals() override;
114 GetEnvironment (lldb_private::StringList &environment) override;
117 IsConnected () const override;
120 RunShellCommand(const char *command, // Shouldn't be nullptr
121 const lldb_private::FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
122 int *status_ptr, // Pass nullptr if you don't want the process exit status
123 int *signo_ptr, // Pass nullptr if you don't want the signal that caused the process to exit
124 std::string *command_output, // Pass nullptr if you don't want the command output
125 uint32_t timeout_sec) override; // Timeout in seconds to wait for shell program to finish
128 MakeDirectory(const lldb_private::FileSpec &file_spec, uint32_t mode) override;
131 GetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t &file_permissions) override;
134 SetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t file_permissions) override;
137 GetFileExists (const lldb_private::FileSpec& file_spec) override;
140 Unlink(const lldb_private::FileSpec &file_spec) override;
143 LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info) override;
146 KillProcess (const lldb::pid_t pid) override;
149 Attach (lldb_private::ProcessAttachInfo &attach_info,
150 lldb_private::Debugger &debugger,
151 lldb_private::Target *target, // Can be nullptr, if nullptr create a new target, else use existing one
152 lldb_private::Error &error) override;
155 DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
156 lldb_private::Debugger &debugger,
157 lldb_private::Target *target, // Can be nullptr, if nullptr create a new target, else use existing one
158 lldb_private::Error &error) override;
161 GetPlatformSpecificConnectionInformation() override;
164 CalculateMD5 (const lldb_private::FileSpec& file_spec,
166 uint64_t &high) override;
169 CalculateTrapHandlerSymbolNames () override;
172 ConnectRemote (lldb_private::Args& args) override;
175 DisconnectRemote () override;
178 DoLoadImage (lldb_private::Process* process,
179 const lldb_private::FileSpec& remote_file,
180 lldb_private::Error& error) override;
183 UnloadImage (lldb_private::Process* process, uint32_t image_token) override;
186 ConnectProcess (const char* connect_url,
187 const char* plugin_name,
188 lldb_private::Debugger &debugger,
189 lldb_private::Target *target,
190 lldb_private::Error &error) override;
193 ConnectToWaitingProcesses(lldb_private::Debugger& debugger, lldb_private::Error& error) override;
196 std::unique_ptr<lldb_private::OptionGroupPlatformRSync> m_option_group_platform_rsync;
197 std::unique_ptr<lldb_private::OptionGroupPlatformSSH> m_option_group_platform_ssh;
198 std::unique_ptr<lldb_private::OptionGroupPlatformCaching> m_option_group_platform_caching;
200 std::map<lldb_private::CommandInterpreter*,std::unique_ptr<lldb_private::OptionGroupOptions>> m_options;
201 lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote POSIX-compliant OS
204 EvaluateLibdlExpression(lldb_private::Process* process,
205 const char *expr_cstr,
206 const char *expr_prefix,
207 lldb::ValueObjectSP& result_valobj_sp);
210 GetLibdlFunctionDeclarations() const;
213 DISALLOW_COPY_AND_ASSIGN (PlatformPOSIX);
216 #endif // liblldb_PlatformPOSIX_h_