summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
diff options
context:
space:
mode:
authorTodd Fiala <tfiala@google.com>2014-01-28 00:34:23 +0000
committerTodd Fiala <tfiala@google.com>2014-01-28 00:34:23 +0000
commitb8b49ec92bd33b3158f9bf0a74165ac6334f4136 (patch)
tree0812dc4544a086b3b304b0c0c0944c08b27f98ec /lldb/source/Plugins/Process
parent2e87e14490a60ce4f7da4f432b2af8b505a67d71 (diff)
downloadbcm5719-llvm-b8b49ec92bd33b3158f9bf0a74165ac6334f4136.tar.gz
bcm5719-llvm-b8b49ec92bd33b3158f9bf0a74165ac6334f4136.zip
Modified GDBProcessCommunicationServer to launch via the platform.
GDBProcessCommunicationServer now optionally takes a PlatformSP that defaults to the default platform for the host. GDBProcessCommunicationServer::LaunchProcess () now uses the platform to launch the process. lldb-gdbserver now takes an optional --platform={platform_plugin_name} or -p {platform_plugin_name} command line option. If no platform is specified, the default platform for the host is used; otherwise, if the platform_plugin_name matches a registered platform plugin or matches the default platform's name (which is not necessarily registered by name in the case of 'host'), that platform is used. If the platform name cannot be resolved, lldb-gdbserver exits after printing all the available platform plugin names and the default platform plugin name. llvm-svn: 200266
Diffstat (limited to 'lldb/source/Plugins/Process')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp21
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h6
2 files changed, 25 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index f002cc05041..df95542d2c0 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -25,6 +25,7 @@
#include "lldb/Host/File.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/TimeValue.h"
+#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
// Project includes
@@ -40,6 +41,7 @@ using namespace lldb_private;
//----------------------------------------------------------------------
GDBRemoteCommunicationServer::GDBRemoteCommunicationServer(bool is_platform) :
GDBRemoteCommunication ("gdb-remote.server", "gdb-remote.server.rx_packet", is_platform),
+ m_platform_sp (Platform::GetDefaultPlatform ()),
m_async_thread (LLDB_INVALID_HOST_THREAD),
m_process_launch_info (),
m_process_launch_error (),
@@ -52,6 +54,23 @@ GDBRemoteCommunicationServer::GDBRemoteCommunicationServer(bool is_platform) :
{
}
+GDBRemoteCommunicationServer::GDBRemoteCommunicationServer(bool is_platform,
+ const lldb::PlatformSP& platform_sp) :
+ GDBRemoteCommunication ("gdb-remote.server", "gdb-remote.server.rx_packet", is_platform),
+ m_platform_sp (platform_sp),
+ m_async_thread (LLDB_INVALID_HOST_THREAD),
+ m_process_launch_info (),
+ m_process_launch_error (),
+ m_spawned_pids (),
+ m_spawned_pids_mutex (Mutex::eMutexTypeRecursive),
+ m_proc_infos (),
+ m_proc_infos_index (0),
+ m_port_map (),
+ m_port_offset(0)
+{
+ assert(platform_sp);
+}
+
//----------------------------------------------------------------------
// Destructor
//----------------------------------------------------------------------
@@ -304,7 +323,7 @@ GDBRemoteCommunicationServer::LaunchProcess ()
if (!m_process_launch_info.GetMonitorProcessCallback ())
m_process_launch_info.SetMonitorProcessCallback(ReapDebuggedProcess, this, false);
- lldb_private::Error error = Host::LaunchProcess (m_process_launch_info);
+ lldb_private::Error error = m_platform_sp->LaunchProcess (m_process_launch_info);
if (!error.Success ())
{
fprintf (stderr, "%s: failed to launch executable %s", __FUNCTION__, m_process_launch_info.GetArguments ().GetArgumentAtIndex (0));
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
index 6085016665d..913c6b673cf 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
@@ -37,6 +37,9 @@ public:
//------------------------------------------------------------------
GDBRemoteCommunicationServer(bool is_platform);
+ GDBRemoteCommunicationServer(bool is_platform,
+ const lldb::PlatformSP& platform_sp);
+
virtual
~GDBRemoteCommunicationServer();
@@ -186,6 +189,7 @@ public:
LaunchProcess ();
protected:
+ lldb::PlatformSP m_platform_sp;
lldb::thread_t m_async_thread;
lldb_private::ProcessLaunchInfo m_process_launch_info;
lldb_private::Error m_process_launch_error;
@@ -195,7 +199,7 @@ protected:
uint32_t m_proc_infos_index;
PortMap m_port_map;
uint16_t m_port_offset;
-
+
PacketResult
SendUnimplementedResponse (const char *packet);
OpenPOWER on IntegriCloud