aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h')
-rw-r--r--source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h232
1 files changed, 123 insertions, 109 deletions
diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index a928c4695f79..1d97b4dbc683 100644
--- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -19,7 +19,10 @@
#include "lldb/Target/Platform.h"
#include "../../Process/gdb-remote/GDBRemoteCommunicationClient.h"
-class PlatformRemoteGDBServer : public lldb_private::Platform
+namespace lldb_private {
+namespace platform_gdb_server {
+
+class PlatformRemoteGDBServer : public Platform
{
public:
@@ -30,9 +33,9 @@ public:
Terminate ();
static lldb::PlatformSP
- CreateInstance (bool force, const lldb_private::ArchSpec *arch);
+ CreateInstance (bool force, const ArchSpec *arch);
- static lldb_private::ConstString
+ static ConstString
GetPluginNameStatic();
static const char *
@@ -47,14 +50,14 @@ public:
//------------------------------------------------------------
// lldb_private::PluginInterface functions
//------------------------------------------------------------
- virtual lldb_private::ConstString
- GetPluginName()
+ ConstString
+ GetPluginName() override
{
return GetPluginNameStatic();
}
- virtual uint32_t
- GetPluginVersion()
+ uint32_t
+ GetPluginVersion() override
{
return 1;
}
@@ -63,163 +66,174 @@ public:
//------------------------------------------------------------
// lldb_private::Platform functions
//------------------------------------------------------------
- virtual lldb_private::Error
- ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
+ Error
+ ResolveExecutable (const ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
- const lldb_private::FileSpecList *module_search_paths_ptr);
+ const FileSpecList *module_search_paths_ptr) override;
- virtual const char *
- GetDescription ();
+ bool
+ GetModuleSpec (const FileSpec& module_file_spec,
+ const ArchSpec& arch,
+ ModuleSpec &module_spec) override;
- virtual lldb_private::Error
- GetFileWithUUID (const lldb_private::FileSpec &platform_file,
- const lldb_private::UUID *uuid_ptr,
- lldb_private::FileSpec &local_file);
+ const char *
+ GetDescription () override;
- virtual bool
- GetProcessInfo (lldb::pid_t pid,
- lldb_private::ProcessInstanceInfo &proc_info);
+ Error
+ GetFileWithUUID (const FileSpec &platform_file,
+ const UUID *uuid_ptr,
+ FileSpec &local_file) override;
+
+ bool
+ GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
- virtual uint32_t
- FindProcesses (const lldb_private::ProcessInstanceInfoMatch &match_info,
- lldb_private::ProcessInstanceInfoList &process_infos);
+ uint32_t
+ FindProcesses (const ProcessInstanceInfoMatch &match_info,
+ ProcessInstanceInfoList &process_infos) override;
- virtual lldb_private::Error
- LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info);
+ Error
+ LaunchProcess (ProcessLaunchInfo &launch_info) override;
- virtual lldb_private::Error
- KillProcess (const lldb::pid_t pid);
+ Error
+ KillProcess (const lldb::pid_t pid) override;
- virtual lldb::ProcessSP
- DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
- lldb_private::Debugger &debugger,
- lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
- lldb_private::Error &error);
+ lldb::ProcessSP
+ DebugProcess (ProcessLaunchInfo &launch_info,
+ Debugger &debugger,
+ Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ Error &error) override;
- virtual lldb::ProcessSP
- Attach (lldb_private::ProcessAttachInfo &attach_info,
- lldb_private::Debugger &debugger,
- lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
- lldb_private::Error &error);
+ lldb::ProcessSP
+ Attach (ProcessAttachInfo &attach_info,
+ Debugger &debugger,
+ Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ Error &error) override;
- virtual bool
- GetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
+ bool
+ GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) override;
- virtual size_t
- GetSoftwareBreakpointTrapOpcode (lldb_private::Target &target,
- lldb_private::BreakpointSite *bp_site);
+ size_t
+ GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site) override;
- virtual bool
- GetRemoteOSVersion ();
+ bool
+ GetRemoteOSVersion () override;
- virtual bool
- GetRemoteOSBuildString (std::string &s);
+ bool
+ GetRemoteOSBuildString (std::string &s) override;
- virtual bool
- GetRemoteOSKernelDescription (std::string &s);
+ bool
+ GetRemoteOSKernelDescription (std::string &s) override;
// Remote Platform subclasses need to override this function
- virtual lldb_private::ArchSpec
- GetRemoteSystemArchitecture ();
+ ArchSpec
+ GetRemoteSystemArchitecture () override;
- virtual lldb_private::ConstString
- GetRemoteWorkingDirectory();
-
- virtual bool
- SetRemoteWorkingDirectory(const lldb_private::ConstString &path);
+ FileSpec
+ GetRemoteWorkingDirectory() override;
+ bool
+ SetRemoteWorkingDirectory(const FileSpec &working_dir) override;
// Remote subclasses should override this and return a valid instance
// name if connected.
- virtual const char *
- GetHostname ();
+ const char *
+ GetHostname () override;
- virtual const char *
- GetUserName (uint32_t uid);
+ const char *
+ GetUserName (uint32_t uid) override;
- virtual const char *
- GetGroupName (uint32_t gid);
+ const char *
+ GetGroupName (uint32_t gid) override;
- virtual bool
- IsConnected () const;
+ bool
+ IsConnected () const override;
- virtual lldb_private::Error
- ConnectRemote (lldb_private::Args& args);
+ Error
+ ConnectRemote (Args& args) override;
- virtual lldb_private::Error
- DisconnectRemote ();
-
- virtual lldb_private::Error
- MakeDirectory (const char *path, uint32_t file_permissions);
-
- virtual lldb_private::Error
- GetFilePermissions (const char *path, uint32_t &file_permissions);
-
- virtual lldb_private::Error
- SetFilePermissions (const char *path, uint32_t file_permissions);
+ Error
+ DisconnectRemote () override;
+ Error
+ MakeDirectory(const FileSpec &file_spec, uint32_t file_permissions) override;
+
+ Error
+ GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions) override;
- virtual lldb::user_id_t
- OpenFile (const lldb_private::FileSpec& file_spec,
- uint32_t flags,
- uint32_t mode,
- lldb_private::Error &error);
+ Error
+ SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions) override;
+
+
+ lldb::user_id_t
+ OpenFile (const FileSpec& file_spec, uint32_t flags, uint32_t mode, Error &error) override;
- virtual bool
- CloseFile (lldb::user_id_t fd,
- lldb_private::Error &error);
+ bool
+ CloseFile (lldb::user_id_t fd, Error &error) override;
- virtual uint64_t
+ uint64_t
ReadFile (lldb::user_id_t fd,
uint64_t offset,
void *data_ptr,
uint64_t len,
- lldb_private::Error &error);
+ Error &error) override;
- virtual uint64_t
+ uint64_t
WriteFile (lldb::user_id_t fd,
uint64_t offset,
const void* data,
uint64_t len,
- lldb_private::Error &error);
+ Error &error) override;
- virtual lldb::user_id_t
- GetFileSize (const lldb_private::FileSpec& file_spec);
+ lldb::user_id_t
+ GetFileSize (const FileSpec& file_spec) override;
- virtual lldb_private::Error
- PutFile (const lldb_private::FileSpec& source,
- const lldb_private::FileSpec& destination,
+ Error
+ PutFile (const FileSpec& source,
+ const FileSpec& destination,
uint32_t uid = UINT32_MAX,
- uint32_t gid = UINT32_MAX);
+ uint32_t gid = UINT32_MAX) override;
- virtual lldb_private::Error
- CreateSymlink (const char *src, const char *dst);
+ Error
+ CreateSymlink(const FileSpec &src, const FileSpec &dst) override;
- virtual bool
- GetFileExists (const lldb_private::FileSpec& file_spec);
+ bool
+ GetFileExists (const FileSpec& file_spec) override;
- virtual lldb_private::Error
- Unlink (const char *path);
+ Error
+ Unlink(const FileSpec &path) override;
- virtual lldb_private::Error
- RunShellCommand (const char *command, // Shouldn't be NULL
- const char *working_dir, // Pass NULL to use the current working directory
- int *status_ptr, // Pass NULL if you don't want the process exit status
- int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
- std::string *command_output, // Pass NULL if you don't want the command output
- uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
+ Error
+ RunShellCommand(const char *command, // Shouldn't be NULL
+ const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
+ int *status_ptr, // Pass NULL if you don't want the process exit status
+ int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass NULL if you don't want the command output
+ uint32_t timeout_sec) override; // Timeout in seconds to wait for shell program to finish
- virtual void
- CalculateTrapHandlerSymbolNames ();
+ void
+ CalculateTrapHandlerSymbolNames () override;
protected:
- GDBRemoteCommunicationClient m_gdb_client;
+ process_gdb_remote::GDBRemoteCommunicationClient m_gdb_client;
std::string m_platform_description; // After we connect we can get a more complete description of what we are connected to
+ std::string m_platform_scheme;
std::string m_platform_hostname;
+ // Launch the lldb-gdbserver on the remote host and return the port it is listening on or 0 on
+ // failure. Subclasses should override this method if they want to do extra actions before or
+ // after launching the lldb-gdbserver.
+ virtual uint16_t
+ LaunchGDBserverAndGetPort (lldb::pid_t &pid);
+
+ virtual bool
+ KillSpawnedProcess (lldb::pid_t pid);
+
private:
DISALLOW_COPY_AND_ASSIGN (PlatformRemoteGDBServer);
};
+} // namespace platform_gdb_server
+} // namespace lldb_private
+
#endif // liblldb_PlatformRemoteGDBServer_h_