1 //===-- PlatformRemoteGDBServer.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_PlatformRemoteGDBServer_h_
11 #define liblldb_PlatformRemoteGDBServer_h_
17 // Other libraries and framework includes
19 #include "lldb/Target/Platform.h"
20 #include "../../Process/gdb-remote/GDBRemoteCommunicationClient.h"
22 class PlatformRemoteGDBServer : public lldb_private::Platform
32 static lldb_private::Platform*
33 CreateInstance (bool force, const lldb_private::ArchSpec *arch);
35 static lldb_private::ConstString
36 GetPluginNameStatic();
39 GetDescriptionStatic();
42 PlatformRemoteGDBServer ();
45 ~PlatformRemoteGDBServer();
47 //------------------------------------------------------------
48 // lldb_private::PluginInterface functions
49 //------------------------------------------------------------
50 virtual lldb_private::ConstString
53 return GetPluginNameStatic();
63 //------------------------------------------------------------
64 // lldb_private::Platform functions
65 //------------------------------------------------------------
66 virtual lldb_private::Error
67 ResolveExecutable (const lldb_private::FileSpec &exe_file,
68 const lldb_private::ArchSpec &arch,
69 lldb::ModuleSP &module_sp,
70 const lldb_private::FileSpecList *module_search_paths_ptr);
75 virtual lldb_private::Error
76 GetFileWithUUID (const lldb_private::FileSpec &platform_file,
77 const lldb_private::UUID *uuid_ptr,
78 lldb_private::FileSpec &local_file);
81 GetProcessInfo (lldb::pid_t pid,
82 lldb_private::ProcessInstanceInfo &proc_info);
85 FindProcesses (const lldb_private::ProcessInstanceInfoMatch &match_info,
86 lldb_private::ProcessInstanceInfoList &process_infos);
88 virtual lldb_private::Error
89 LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info);
91 virtual lldb::ProcessSP
92 DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
93 lldb_private::Debugger &debugger,
94 lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
95 lldb_private::Listener &listener,
96 lldb_private::Error &error);
98 virtual lldb::ProcessSP
99 Attach (lldb_private::ProcessAttachInfo &attach_info,
100 lldb_private::Debugger &debugger,
101 lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
102 lldb_private::Listener &listener,
103 lldb_private::Error &error);
106 GetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
109 GetSoftwareBreakpointTrapOpcode (lldb_private::Target &target,
110 lldb_private::BreakpointSite *bp_site);
113 GetRemoteOSVersion ();
116 GetRemoteOSBuildString (std::string &s);
119 GetRemoteOSKernelDescription (std::string &s);
121 // Remote Platform subclasses need to override this function
122 virtual lldb_private::ArchSpec
123 GetRemoteSystemArchitecture ();
125 virtual lldb_private::ConstString
126 GetRemoteWorkingDirectory();
129 SetRemoteWorkingDirectory(const lldb_private::ConstString &path);
132 // Remote subclasses should override this and return a valid instance
133 // name if connected.
138 GetUserName (uint32_t uid);
141 GetGroupName (uint32_t gid);
144 IsConnected () const;
146 virtual lldb_private::Error
147 ConnectRemote (lldb_private::Args& args);
149 virtual lldb_private::Error
152 virtual lldb_private::Error
153 MakeDirectory (const char *path, uint32_t file_permissions);
155 virtual lldb_private::Error
156 GetFilePermissions (const char *path, uint32_t &file_permissions);
158 virtual lldb_private::Error
159 SetFilePermissions (const char *path, uint32_t file_permissions);
162 virtual lldb::user_id_t
163 OpenFile (const lldb_private::FileSpec& file_spec,
166 lldb_private::Error &error);
169 CloseFile (lldb::user_id_t fd,
170 lldb_private::Error &error);
173 ReadFile (lldb::user_id_t fd,
177 lldb_private::Error &error);
180 WriteFile (lldb::user_id_t fd,
184 lldb_private::Error &error);
186 virtual lldb::user_id_t
187 GetFileSize (const lldb_private::FileSpec& file_spec);
189 virtual lldb_private::Error
190 PutFile (const lldb_private::FileSpec& source,
191 const lldb_private::FileSpec& destination,
192 uint32_t uid = UINT32_MAX,
193 uint32_t gid = UINT32_MAX);
195 virtual lldb_private::Error
196 CreateSymlink (const char *src, const char *dst);
199 GetFileExists (const lldb_private::FileSpec& file_spec);
201 virtual lldb_private::Error
202 Unlink (const char *path);
204 virtual lldb_private::Error
205 RunShellCommand (const char *command, // Shouldn't be NULL
206 const char *working_dir, // Pass NULL to use the current working directory
207 int *status_ptr, // Pass NULL if you don't want the process exit status
208 int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
209 std::string *command_output, // Pass NULL if you don't want the command output
210 uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
213 CalculateTrapHandlerSymbolNames ();
216 GDBRemoteCommunicationClient m_gdb_client;
217 std::string m_platform_description; // After we connect we can get a more complete description of what we are connected to
220 DISALLOW_COPY_AND_ASSIGN (PlatformRemoteGDBServer);
224 #endif // liblldb_PlatformRemoteGDBServer_h_