https://github.com/da-viper updated 
https://github.com/llvm/llvm-project/pull/157474

>From bfd997d47c554c3b33d1d7de184e202571d388a6 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimy...@gmail.com>
Date: Mon, 8 Sep 2025 15:23:25 +0100
Subject: [PATCH 1/3] [lldb][test] StepUntil disable test for unsupported
 linkers.

`INSERT BEFORE` keyword is not supported in current versions gold and mold 
linkers. Since we cannot confirm accurately what linker and version is 
available on the system and when it will be supported. We test it with a sample 
program using the script keywords.
---
 .../thread/step_until/TestStepUntil.py        | 40 +++++++++++++++++
 .../thread/step_until/TestStepUntilAPI.py     | 43 +++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py 
b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
index 965da02ed0f98..90f207b5d4660 100644
--- a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
+++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
@@ -1,11 +1,50 @@
 """Test stepping over vrs. hitting breakpoints & subsequent stepping in 
various forms."""
 
+from typing import Optional
 
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
+import tempfile
+
+
+def linker_script_syntax_unsupported() -> Optional[str]:
+    """Current versions of mold and gold linker does not support some syntax of
+    linker scripts, this maybe supported in future versions. check if it 
compiles,
+    if not it is not supported.
+    """
+    with tempfile.TemporaryDirectory() as tmpdir:
+        output_path = os.path.join(tmpdir, "linker_support.out")
+        linker_script_path = os.path.join(tmpdir, "test.ld")
+
+        with open(linker_script_path, "w") as linker_script:
+            linker_script.write(
+                "SECTIONS {.text.ordered : { *(.text.ordered) *(.text.foo) } } 
INSERT BEFORE .text;"
+            )
+
+        compiler_cmd = subprocess.Popen(
+            [
+                lldbplatformutil.getCompiler(),
+                f"-o {output_path}",
+                "-ffunction-sections",
+                f"-Wl,--script={linker_script_path}",
+                "-xc",
+                "-",
+            ],
+            shell=True,
+            universal_newlines=True,
+            stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+        )
+        _, comp_err = compiler_cmd.communicate(
+            "int foo() { return 1; } int main() { return 0; }"
+        )
 
+        if len(comp_err) != 0:
+            return str(tmpdir) + " " + comp_err
+        return None
 
 class StepUntilTestCase(TestBase):
     def setUp(self):
@@ -112,6 +151,7 @@ def test_bad_line(self):
     @no_debug_info_test
     @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
     @skipIf(archs=no_match(["x86_64", "aarch64"]))
+    @skipTestIfFn(linker_script_syntax_unsupported)
     def test_bad_line_discontinuous(self):
         """Test that we get an error if attempting to step outside the current
         function -- and the function is discontinuous"""
diff --git 
a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py 
b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
index 59e028acf014c..44e764c43cd20 100644
--- a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
+++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
@@ -1,8 +1,48 @@
+from typing import Optional
+
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
+import tempfile
+
+
+def linker_script_syntax_unsupported() -> Optional[str]:
+    """Current versions of mold and gold linker does not support some syntax of
+    linker scripts, this maybe supported in future versions. check if it 
compiles,
+    if not it is not supported.
+    """
+    with tempfile.TemporaryDirectory() as tmpdir:
+        output_path = os.path.join(tmpdir, "linker_support.out")
+        linker_script_path = os.path.join(tmpdir, "test.ld")
+
+        with open(linker_script_path, "w") as linker_script:
+            linker_script.write(
+                "SECTIONS {.text.ordered : { *(.text.ordered) *(.text.foo) } } 
INSERT BEFORE .text;"
+            )
+
+        compiler_cmd = subprocess.Popen(
+            [
+                lldbplatformutil.getCompiler(),
+                f"-o {output_path}",
+                "-ffunction-sections",
+                f"-Wl,--script={linker_script_path}",
+                "-xc",
+                "-",
+            ],
+            shell=True,
+            universal_newlines=True,
+            stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+        )
+        _, comp_err = compiler_cmd.communicate(
+            "int foo() { return 1; } int main() { return 0; }"
+        )
 
+        if len(comp_err) != 0:
+            return comp_err
+        return None
 
 class TestStepUntilAPI(TestBase):
     NO_DEBUG_INFO_TESTCASE = True
@@ -74,6 +114,7 @@ def test_hitting(self):
 
     @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
     @skipIf(archs=no_match(["x86_64", "aarch64"]))
+    @skipTestIfFn(linker_script_syntax_unsupported)
     def test_hitting_discontinuous(self):
         """Test SBThread.StepOverUntil - targeting a line and hitting it -- 
with
         discontinuous functions"""
@@ -93,6 +134,7 @@ def test_missing(self):
 
     @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
     @skipIf(archs=no_match(["x86_64", "aarch64"]))
+    @skipTestIfFn(linker_script_syntax_unsupported)
     def test_missing_discontinuous(self):
         """Test SBThread.StepOverUntil - targeting a line and missing it by
         stepping out to call site -- with discontinuous functions"""
@@ -120,6 +162,7 @@ def test_bad_line(self):
 
     @skipIf(oslist=lldbplatformutil.getDarwinOSTriples() + ["windows"])
     @skipIf(archs=no_match(["x86_64", "aarch64"]))
+    @skipTestIfFn(linker_script_syntax_unsupported)
     def test_bad_line_discontinuous(self):
         """Test that we get an error if attempting to step outside the current
         function -- and the function is discontinuous"""

>From 4d2d7648158204bddebcdd6541bc14f2f15db4b6 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimy...@gmail.com>
Date: Tue, 9 Sep 2025 11:58:31 +0100
Subject: [PATCH 2/3] [lldb][test] StepUntil disable test for unsupported
 linkers.

`INSERT BEFORE` keyword is not supported in current versions gold and mold 
linkers. Since we cannot confirm accurately what linker and version is 
available on the system and when it will be supported. We test it with a sample 
program using the script keywords.
---
 .../Python/lldbsuite/test/lldbplatformutil.py | 38 ++++++++++++++++
 .../thread/step_until/TestStepUntil.py        | 43 +------------------
 .../thread/step_until/TestStepUntilAPI.py     | 41 +-----------------
 3 files changed, 40 insertions(+), 82 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index cea6270695dc0..ed6365266118a 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -8,6 +8,8 @@
 import subprocess
 import sys
 import os
+import tempfile
+from typing import Optional
 from packaging import version
 from urllib.parse import urlparse
 
@@ -44,6 +46,42 @@ def check_first_register_readable(test_case):
             % test_case.getArchitecture()
         )
 
+def linker_script_syntax_unsupported() -> Optional[str]:
+    """Current versions of mold(2.40.4) and gold(2.44) linker does not support 
some syntax of
+    linker scripts, this maybe supported in future versions. check if it 
compiles,
+    if not it is not supported.
+    """
+    with tempfile.TemporaryDirectory() as tmpdir:
+        output_path = os.path.join(tmpdir, "linker_support.out")
+        linker_script_path = os.path.join(tmpdir, "test.ld")
+
+        with open(linker_script_path, "w") as linker_script:
+            linker_script.write(
+                "SECTIONS {.text.ordered : { *(.text.ordered) *(.text.foo) } } 
INSERT BEFORE .text;"
+            )
+
+        compiler_cmd = subprocess.Popen(
+            [
+                getCompiler(),
+                f"-o {output_path}",
+                "-ffunction-sections",
+                f"-Wl,--script={linker_script_path}",
+                "-xc",
+                "-",
+            ],
+            shell=True,
+            universal_newlines=True,
+            stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+        )
+        _, compiler_err = compiler_cmd.communicate(
+            "int foo() { return 1; } int main() { return 0; }"
+        )
+
+        if len(compiler_err) != 0:
+            return compiler_err
+        return None
 
 def _run_adb_command(cmd, device_id):
     device_id_args = []
diff --git a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py 
b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
index 90f207b5d4660..0b726b7afddbb 100644
--- a/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
+++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntil.py
@@ -1,50 +1,9 @@
 """Test stepping over vrs. hitting breakpoints & subsequent stepping in 
various forms."""
 
-from typing import Optional
-
-import lldb
 from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbplatformutil import linker_script_syntax_unsupported
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
-import tempfile
-
-
-def linker_script_syntax_unsupported() -> Optional[str]:
-    """Current versions of mold and gold linker does not support some syntax of
-    linker scripts, this maybe supported in future versions. check if it 
compiles,
-    if not it is not supported.
-    """
-    with tempfile.TemporaryDirectory() as tmpdir:
-        output_path = os.path.join(tmpdir, "linker_support.out")
-        linker_script_path = os.path.join(tmpdir, "test.ld")
-
-        with open(linker_script_path, "w") as linker_script:
-            linker_script.write(
-                "SECTIONS {.text.ordered : { *(.text.ordered) *(.text.foo) } } 
INSERT BEFORE .text;"
-            )
-
-        compiler_cmd = subprocess.Popen(
-            [
-                lldbplatformutil.getCompiler(),
-                f"-o {output_path}",
-                "-ffunction-sections",
-                f"-Wl,--script={linker_script_path}",
-                "-xc",
-                "-",
-            ],
-            shell=True,
-            universal_newlines=True,
-            stdin=subprocess.PIPE,
-            stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE,
-        )
-        _, comp_err = compiler_cmd.communicate(
-            "int foo() { return 1; } int main() { return 0; }"
-        )
-
-        if len(comp_err) != 0:
-            return str(tmpdir) + " " + comp_err
-        return None
 
 class StepUntilTestCase(TestBase):
     def setUp(self):
diff --git 
a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py 
b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
index 44e764c43cd20..85beaf29af2fb 100644
--- a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
+++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
@@ -1,48 +1,9 @@
-from typing import Optional
 
-import lldb
 from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbplatformutil import linker_script_syntax_unsupported
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
-import tempfile
-
-
-def linker_script_syntax_unsupported() -> Optional[str]:
-    """Current versions of mold and gold linker does not support some syntax of
-    linker scripts, this maybe supported in future versions. check if it 
compiles,
-    if not it is not supported.
-    """
-    with tempfile.TemporaryDirectory() as tmpdir:
-        output_path = os.path.join(tmpdir, "linker_support.out")
-        linker_script_path = os.path.join(tmpdir, "test.ld")
-
-        with open(linker_script_path, "w") as linker_script:
-            linker_script.write(
-                "SECTIONS {.text.ordered : { *(.text.ordered) *(.text.foo) } } 
INSERT BEFORE .text;"
-            )
-
-        compiler_cmd = subprocess.Popen(
-            [
-                lldbplatformutil.getCompiler(),
-                f"-o {output_path}",
-                "-ffunction-sections",
-                f"-Wl,--script={linker_script_path}",
-                "-xc",
-                "-",
-            ],
-            shell=True,
-            universal_newlines=True,
-            stdin=subprocess.PIPE,
-            stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE,
-        )
-        _, comp_err = compiler_cmd.communicate(
-            "int foo() { return 1; } int main() { return 0; }"
-        )
 
-        if len(comp_err) != 0:
-            return comp_err
-        return None
 
 class TestStepUntilAPI(TestBase):
     NO_DEBUG_INFO_TESTCASE = True

>From 663f8f726aeb1c402626792f5b2d1b9f3350ba39 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimy...@gmail.com>
Date: Tue, 9 Sep 2025 12:06:30 +0100
Subject: [PATCH 3/3] [lldb][test] code format

---
 lldb/packages/Python/lldbsuite/test/lldbplatformutil.py          | 1 +
 .../API/functionalities/thread/step_until/TestStepUntilAPI.py    | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index ed6365266118a..d8fabc1321c78 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -46,6 +46,7 @@ def check_first_register_readable(test_case):
             % test_case.getArchitecture()
         )
 
+
 def linker_script_syntax_unsupported() -> Optional[str]:
     """Current versions of mold(2.40.4) and gold(2.44) linker does not support 
some syntax of
     linker scripts, this maybe supported in future versions. check if it 
compiles,
diff --git 
a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py 
b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
index 85beaf29af2fb..5c1575ae932de 100644
--- a/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
+++ b/lldb/test/API/functionalities/thread/step_until/TestStepUntilAPI.py
@@ -1,4 +1,3 @@
-
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbplatformutil import linker_script_syntax_unsupported
 from lldbsuite.test.lldbtest import *

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to