mgorny created this revision.
mgorny added reviewers: labath, teemperor, emaste, krytarowski.
mgorny requested review of this revision.

Fix the termination of "process connect" (and "gdb-remote") to kill
the process rather than attempting to disconnect the platform.
The latter only results in an error since we did not use "platform
connect", and apparently process-level connections (at least via
gdb-remote) do not really support disconnecting.


https://reviews.llvm.org/D110996

Files:
  lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
  lldb/test/API/functionalities/gdb_remote_client/TestPty.py


Index: lldb/test/API/functionalities/gdb_remote_client/TestPty.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/TestPty.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestPty.py
@@ -18,7 +18,7 @@
             self.expect("process connect " + self.server.get_connect_url(),
                         substrs=['Process', 'stopped'])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
 
     def test_process_connect_async(self):
         """Test the process connect command in asynchronous mode"""
@@ -32,4 +32,6 @@
             lldbutil.expect_state_changes(self, self.dbg.GetListener(),
                                           self.process(), [lldb.eStateStopped])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
+        lldbutil.expect_state_changes(self, self.dbg.GetListener(),
+                                      self.process(), [lldb.eStateExited])
Index: lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
@@ -18,7 +18,7 @@
             self.expect("gdb-remote " + self.server.get_connect_address(),
                         substrs=['Process', 'stopped'])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
 
     def test_gdb_remote_async(self):
         """Test the gdb-remote command in asynchronous mode"""
@@ -30,7 +30,9 @@
             lldbutil.expect_state_changes(self, self.dbg.GetListener(),
                                           self.process(), [lldb.eStateStopped])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
+        lldbutil.expect_state_changes(self, self.dbg.GetListener(),
+                                      self.process(), [lldb.eStateExited])
 
     @skipIfWindows
     def test_process_connect_sync(self):
@@ -42,7 +44,7 @@
             self.expect("process connect " + self.server.get_connect_url(),
                         substrs=['Process', 'stopped'])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
 
     @skipIfWindows
     def test_process_connect_async(self):
@@ -57,4 +59,6 @@
             lldbutil.expect_state_changes(self, self.dbg.GetListener(),
                                           self.process(), [lldb.eStateStopped])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
+        lldbutil.expect_state_changes(self, self.dbg.GetListener(),
+                                      self.process(), [lldb.eStateExited])


Index: lldb/test/API/functionalities/gdb_remote_client/TestPty.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/TestPty.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestPty.py
@@ -18,7 +18,7 @@
             self.expect("process connect " + self.server.get_connect_url(),
                         substrs=['Process', 'stopped'])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
 
     def test_process_connect_async(self):
         """Test the process connect command in asynchronous mode"""
@@ -32,4 +32,6 @@
             lldbutil.expect_state_changes(self, self.dbg.GetListener(),
                                           self.process(), [lldb.eStateStopped])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
+        lldbutil.expect_state_changes(self, self.dbg.GetListener(),
+                                      self.process(), [lldb.eStateExited])
Index: lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
@@ -18,7 +18,7 @@
             self.expect("gdb-remote " + self.server.get_connect_address(),
                         substrs=['Process', 'stopped'])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
 
     def test_gdb_remote_async(self):
         """Test the gdb-remote command in asynchronous mode"""
@@ -30,7 +30,9 @@
             lldbutil.expect_state_changes(self, self.dbg.GetListener(),
                                           self.process(), [lldb.eStateStopped])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
+        lldbutil.expect_state_changes(self, self.dbg.GetListener(),
+                                      self.process(), [lldb.eStateExited])
 
     @skipIfWindows
     def test_process_connect_sync(self):
@@ -42,7 +44,7 @@
             self.expect("process connect " + self.server.get_connect_url(),
                         substrs=['Process', 'stopped'])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
 
     @skipIfWindows
     def test_process_connect_async(self):
@@ -57,4 +59,6 @@
             lldbutil.expect_state_changes(self, self.dbg.GetListener(),
                                           self.process(), [lldb.eStateStopped])
         finally:
-            self.dbg.GetSelectedPlatform().DisconnectRemote()
+            self.dbg.GetSelectedTarget().GetProcess().Kill()
+        lldbutil.expect_state_changes(self, self.dbg.GetListener(),
+                                      self.process(), [lldb.eStateExited])
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to