[Lldb-commits] [lldb] 6c0cd56 - [lldb] Make `process connect` behave the same in sync and async mode.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 13 17:39:38 PST 2020


Author: Jonas Devlieghere
Date: 2020-11-13T17:39:30-08:00
New Revision: 6c0cd5676e0a0feaf836e0399023a6e21224467b

URL: https://github.com/llvm/llvm-project/commit/6c0cd5676e0a0feaf836e0399023a6e21224467b
DIFF: https://github.com/llvm/llvm-project/commit/6c0cd5676e0a0feaf836e0399023a6e21224467b.diff

LOG: [lldb] Make `process connect` behave the same in sync and async mode.

I think the check for whether the process is connected is totally bogus
in the first place, but on the off-chance that's it's not, we should
behave the same in synchronous and asynchronous mode.

Added: 
    lldb/test/Shell/Commands/command-process-connect.test

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 0e0b61f1534f..e8bfbd889299 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -837,18 +837,6 @@ std::string PlatformRemoteGDBServer::MakeUrl(const char *scheme,
   return std::string(result.GetString());
 }
 
-lldb::ProcessSP PlatformRemoteGDBServer::ConnectProcess(
-    llvm::StringRef connect_url, llvm::StringRef plugin_name,
-    lldb_private::Debugger &debugger, lldb_private::Target *target,
-    lldb_private::Status &error) {
-  if (!IsRemote() || !IsConnected()) {
-    error.SetErrorString("Not connected to remote gdb server");
-    return nullptr;
-  }
-  return Platform::ConnectProcess(connect_url, plugin_name, debugger, target,
-                                  error);
-}
-
 size_t PlatformRemoteGDBServer::ConnectToWaitingProcesses(Debugger &debugger,
                                                           Status &error) {
   std::vector<std::string> connection_urls;

diff  --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index 297b482eb87a..e43cd0e55c6d 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -154,12 +154,6 @@ class PlatformRemoteGDBServer : public Platform, private UserIDResolver {
 
   const lldb::UnixSignalsSP &GetRemoteUnixSignals() override;
 
-  lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
-                                 llvm::StringRef plugin_name,
-                                 lldb_private::Debugger &debugger,
-                                 lldb_private::Target *target,
-                                 lldb_private::Status &error) override;
-
   size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger,
                                    lldb_private::Status &error) override;
 

diff  --git a/lldb/test/Shell/Commands/command-process-connect.test b/lldb/test/Shell/Commands/command-process-connect.test
new file mode 100644
index 000000000000..c4761360d541
--- /dev/null
+++ b/lldb/test/Shell/Commands/command-process-connect.test
@@ -0,0 +1,9 @@
+# Synchronous
+# RUN: %lldb -o 'platform select remote-gdb-server' -o 'process connect connect://localhost:4321' 2>&1 | FileCheck %s
+
+# Asynchronous
+# RUN: echo -e 'platform select remote-gdb-server\nprocess connect connect://localhost:4321' | %lldb 2>&1 | FileCheck %s
+
+# CHECK: Platform: remote-gdb-server
+# CHECK: Connected: no
+# CHECK: error: Failed to connect port


        


More information about the lldb-commits mailing list