Author: gclayton
Date: Wed Dec 4 13:40:33 2013
New Revision: 196405
URL: http://llvm.org/viewvc/llvm-project?rev=196405&view=rev
Log:
Allow the hostname to be specified when asking a platform to launch another
debugserver in case you want to change it.
The GDB server remote platform how has the debugserver that are launched on iOS
devices to use localhost due to the use of a USB mux.
Modified:
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
Modified:
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=196405&r1=196404&r2=196405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
(original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
Wed Dec 4 13:40:33 2013
@@ -418,7 +418,21 @@ PlatformRemoteGDBServer::DebugProcess (l
if (IsConnected())
{
lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID;
- uint16_t port =
m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid);
+ ArchSpec remote_arch = GetRemoteSystemArchitecture();
+ llvm::Triple &remote_triple = remote_arch.GetTriple();
+ uint16_t port = 0;
+ if (remote_triple.getVendor() == llvm::Triple::Apple &&
remote_triple.getOS() == llvm::Triple::IOS)
+ {
+ // When remote debugging to iOS, we use a USB mux that always
talks
+ // to localhost, so we will need the remote debugserver to
accept connections
+ // only from localhost, no matter what our current hostname is
+ port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid,
"localhost");
+ }
+ else
+ {
+ // All other hosts should use their actual hostname
+ port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid,
NULL);
+ }
if (port == 0)
{
@@ -492,7 +506,21 @@ PlatformRemoteGDBServer::Attach (lldb_pr
if (IsConnected())
{
lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID;
- uint16_t port =
m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid);
+ ArchSpec remote_arch = GetRemoteSystemArchitecture();
+ llvm::Triple &remote_triple = remote_arch.GetTriple();
+ uint16_t port = 0;
+ if (remote_triple.getVendor() == llvm::Triple::Apple &&
remote_triple.getOS() == llvm::Triple::IOS)
+ {
+ // When remote debugging to iOS, we use a USB mux that always
talks
+ // to localhost, so we will need the remote debugserver to
accept connections
+ // only from localhost, no matter what our current hostname is
+ port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid,
"localhost");
+ }
+ else
+ {
+ // All other hosts should use their actual hostname
+ port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid,
NULL);
+ }
if (port == 0)
{
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=196405&r1=196404&r2=196405&view=diff
==============================================================================
---
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
(original)
+++
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
Wed Dec 4 13:40:33 2013
@@ -2301,22 +2301,27 @@ GDBRemoteCommunicationClient::SendSpeedT
}
uint16_t
-GDBRemoteCommunicationClient::LaunchGDBserverAndGetPort (lldb::pid_t &pid)
+GDBRemoteCommunicationClient::LaunchGDBserverAndGetPort (lldb::pid_t &pid,
const char *remote_accept_hostname)
{
pid = LLDB_INVALID_PROCESS_ID;
StringExtractorGDBRemote response;
StreamString stream;
stream.PutCString("qLaunchGDBServer;");
std::string hostname;
- if (Host::GetHostname (hostname))
- {
- // Make the GDB server we launch only accept connections from this host
- stream.Printf("host:%s;", hostname.c_str());
- }
+ if (remote_accept_hostname && remote_accept_hostname[0])
+ hostname = remote_accept_hostname;
else
{
- // Make the GDB server we launch accept connections from any host
since we can't figure out the hostname
- stream.Printf("host:*;");
+ if (Host::GetHostname (hostname))
+ {
+ // Make the GDB server we launch only accept connections from this
host
+ stream.Printf("host:%s;", hostname.c_str());
+ }
+ else
+ {
+ // Make the GDB server we launch accept connections from any host
since we can't figure out the hostname
+ stream.Printf("host:*;");
+ }
}
const char *packet = stream.GetData();
int packet_len = stream.GetSize();
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=196405&r1=196404&r2=196405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
Wed Dec 4 13:40:33 2013
@@ -94,7 +94,7 @@ public:
GetLaunchSuccess (std::string &error_str);
uint16_t
- LaunchGDBserverAndGetPort (lldb::pid_t &pid);
+ LaunchGDBserverAndGetPort (lldb::pid_t &pid, const char
*remote_accept_hostname);
bool
KillSpawnedProcess (lldb::pid_t pid);
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits