nitesh.jain created this revision.
nitesh.jain added reviewers: clayborg, tberghammer, labath.
nitesh.jain added subscribers: jaydeep, bhushan, sagar, mohit.bhakkad, 
lldb-commits.
nitesh.jain set the repository for this revision to rL LLVM.

The patch http://reviews.llvm.org/D14952 which modifies the platform connect 
with automatically connecting to the process instance if it was started by the 
remote platform. However this fails for Linux Platform. Since 
PlatformRemoteGDBServer doesn't implement "ConnectToWaitingProcesses". Thus 
Platform::ConnectToWaitingProcesses was called and LLDB failed connecting to 
the remote process instance. This Patch implements "ConnectToWaitingProcesses" 
for PlatformRemoteGDBServer and hence fixes TestPlatformProcessConnect.py 
failure for linux Platform.

Repository:
  rL LLVM

http://reviews.llvm.org/D18082

Files:
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h

Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
===================================================================
--- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -224,6 +224,9 @@
                     lldb_private::Target *target,
                     lldb_private::Error &error) override;
 
+    size_t
+    ConnectToWaitingProcesses(lldb_private::Debugger& debugger, 
lldb_private::Error& error) override;
+
     virtual size_t
     GetPendingGdbServerList(std::vector<std::string>& connection_urls);
 
Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
===================================================================
--- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -1002,6 +1002,22 @@
 }
 
 size_t
+PlatformRemoteGDBServer::ConnectToWaitingProcesses(Debugger& debugger, Error& 
error)
+{
+    std::vector<std::string> connection_urls;
+    GetPendingGdbServerList(connection_urls);
+
+    for (size_t i = 0; i < connection_urls.size(); ++i)
+    {
+        ConnectProcess(connection_urls[i].c_str(), nullptr, debugger, nullptr, 
error);
+        if (error.Fail())
+            return i; // We already connected to i process succsessfully
+    }
+    return connection_urls.size();
+
+}
+
+size_t
 PlatformRemoteGDBServer::GetPendingGdbServerList(std::vector<std::string>& 
connection_urls)
 {
     std::vector<std::pair<uint16_t, std::string>> remote_servers;


Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
===================================================================
--- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -224,6 +224,9 @@
                     lldb_private::Target *target,
                     lldb_private::Error &error) override;
 
+    size_t
+    ConnectToWaitingProcesses(lldb_private::Debugger& debugger, lldb_private::Error& error) override;
+
     virtual size_t
     GetPendingGdbServerList(std::vector<std::string>& connection_urls);
 
Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
===================================================================
--- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -1002,6 +1002,22 @@
 }
 
 size_t
+PlatformRemoteGDBServer::ConnectToWaitingProcesses(Debugger& debugger, Error& error)
+{
+    std::vector<std::string> connection_urls;
+    GetPendingGdbServerList(connection_urls);
+
+    for (size_t i = 0; i < connection_urls.size(); ++i)
+    {
+        ConnectProcess(connection_urls[i].c_str(), nullptr, debugger, nullptr, error);
+        if (error.Fail())
+            return i; // We already connected to i process succsessfully
+    }
+    return connection_urls.size();
+
+}
+
+size_t
 PlatformRemoteGDBServer::GetPendingGdbServerList(std::vector<std::string>& connection_urls)
 {
     std::vector<std::pair<uint16_t, std::string>> remote_servers;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to