[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Fri May 17 05:27:12 PDT 2024


https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92413

>From d88cc6d992e1f753066aa5dccaa510d8a0a35b94 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Thu, 16 May 2024 19:18:21 +0400
Subject: [PATCH 1/2] [lldb] Fixed the test TestGdbRemoteAttachWait running on
 a remote target

Install `_exe_to_attach` to a remote target if necessary.
---
 .../lldb-server/attach-wait/TestGdbRemoteAttachWait.py   | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
index f4c31fe2f5c07..a8333210a72b1 100644
--- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
+++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
@@ -52,6 +52,9 @@ def test_attach_with_vAttachWait(self):
         server = self.connect_to_debug_monitor()
         self.do_handshake()
 
+        if self._run_args:
+            self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0])
+
         # Launch the first inferior (we shouldn't attach to this one).
         self._launch_and_wait_for_init()
 
@@ -101,6 +104,9 @@ def test_launch_before_attach_with_vAttachOrWait(self):
         server = self.connect_to_debug_monitor()
         self.do_handshake()
 
+        if self._run_args:
+            self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0])
+
         inferior = self._launch_and_wait_for_init()
 
         # Add attach packets.
@@ -141,6 +147,9 @@ def test_launch_after_attach_with_vAttachOrWait(self):
         server = self.connect_to_debug_monitor()
         self.do_handshake()
 
+        if self._run_args:
+            self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0])
+
         self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True)
         # Run the stream until attachWait.
         context = self.expect_gdbremote_sequence()

>From 1f329275f90c0be3ecf73f3e9e3c816439596116 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Fri, 17 May 2024 16:26:57 +0400
Subject: [PATCH 2/2] Moved install_to_target() to _set_up_inferior().

---
 .../attach-wait/TestGdbRemoteAttachWait.py         | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
index a8333210a72b1..84aab9c969aa4 100644
--- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
+++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
@@ -17,7 +17,10 @@ def _set_up_inferior(self):
             # Use a shim to ensure that the process is ready to be attached from
             # the get-go.
             self._exe_to_run = "shim"
-            self._run_args = [self.getBuildArtifact(self._exe_to_attach)]
+            self._exe_to_attach = lldbutil.install_to_target(
+                self, self.getBuildArtifact(self._exe_to_attach)
+            )
+            self._run_args = [self._exe_to_attach]
             self.build(dictionary={"EXE": self._exe_to_run, "CXX_SOURCES": "shim.cpp"})
         else:
             self._exe_to_run = self._exe_to_attach
@@ -52,9 +55,6 @@ def test_attach_with_vAttachWait(self):
         server = self.connect_to_debug_monitor()
         self.do_handshake()
 
-        if self._run_args:
-            self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0])
-
         # Launch the first inferior (we shouldn't attach to this one).
         self._launch_and_wait_for_init()
 
@@ -104,9 +104,6 @@ def test_launch_before_attach_with_vAttachOrWait(self):
         server = self.connect_to_debug_monitor()
         self.do_handshake()
 
-        if self._run_args:
-            self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0])
-
         inferior = self._launch_and_wait_for_init()
 
         # Add attach packets.
@@ -147,9 +144,6 @@ def test_launch_after_attach_with_vAttachOrWait(self):
         server = self.connect_to_debug_monitor()
         self.do_handshake()
 
-        if self._run_args:
-            self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0])
-
         self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True)
         # Run the stream until attachWait.
         context = self.expect_gdbremote_sequence()



More information about the lldb-commits mailing list