https://github.com/Nerixyz updated 
https://github.com/llvm/llvm-project/pull/149305

>From 0c9292538507307467cdf8184c5599dbadb79bb9 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerix...@outlook.de>
Date: Thu, 17 Jul 2025 15:10:24 +0200
Subject: [PATCH] [LLDB] Run API tests with native PDB too

---
 .../Python/lldbsuite/test/builders/builder.py   |  1 +
 .../Python/lldbsuite/test/decorators.py         |  4 ++++
 lldb/packages/Python/lldbsuite/test/lldbtest.py | 13 +++++++++++++
 .../Python/lldbsuite/test/test_categories.py    | 17 ++++++++++++++++-
 .../vector/TestDataFormatterStdVector.py        |  1 +
 lldb/test/API/lit.cfg.py                        |  2 ++
 6 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py 
b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index ada6f9ff4a54f..2021d348138e6 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -255,6 +255,7 @@ def _getDebugInfoArgs(self, debug_info):
             "gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"},
             "debug_names": {"MAKE_DEBUG_NAMES": "YES"},
             "dwp": {"MAKE_DSYM": "NO", "MAKE_DWP": "YES"},
+            "pdb": {"DEBUG_INFO_FLAG": "-g"},
         }
 
         # Collect all flags, with later options overriding earlier ones
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index a5f58373ede75..7a39f292958d3 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -573,6 +573,10 @@ def expectedFailureWindows(bugnumber=None):
     return expectedFailureOS(["windows"], bugnumber)
 
 
+def expectedFailurePDB(bugnumber=None):
+    return expectedFailureAll(debug_info="pdb", bugnumber=bugnumber)
+
+
 # TODO: This decorator does not do anything. Remove it.
 def expectedFlakey(expected_fn, bugnumber=None):
     def expectedFailure_impl(func):
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 63fadb59a82a1..f1b5e38a1c9ec 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1790,6 +1790,11 @@ def no_reason(_):
                         if can_replicate
                     ]
 
+                    # PDB is off by default, because it has a lot of failures 
right now.
+                    # See llvm.org/pr149498
+                    if original_testcase.TEST_WITH_PDB_DEBUG_INFO:
+                        categories.append("pdb")
+
                 xfail_for_debug_info_cat_fn = getattr(
                     attrvalue, "__xfail_for_debug_info_cat_fn__", no_reason
                 )
@@ -1877,6 +1882,14 @@ class TestBase(Base, metaclass=LLDBTestCaseFactory):
     # test multiple times with various debug info types.
     NO_DEBUG_INFO_TESTCASE = False
 
+    TEST_WITH_PDB_DEBUG_INFO = False
+    """
+    Subclasses can set this to True to test with PDB (native) in addition to
+    the other debug info types. This id off by default because many tests will
+    fail due to missing functionality in PDB.
+    See llvm.org/pr149498.
+    """
+
     def generateSource(self, source):
         template = source + ".template"
         temp = os.path.join(self.getSourceDir(), template)
diff --git a/lldb/packages/Python/lldbsuite/test/test_categories.py 
b/lldb/packages/Python/lldbsuite/test/test_categories.py
index 1f6e8a78e0c0d..fe475a9f8aef3 100644
--- a/lldb/packages/Python/lldbsuite/test/test_categories.py
+++ b/lldb/packages/Python/lldbsuite/test/test_categories.py
@@ -4,6 +4,7 @@
 
 # System modules
 import sys
+import os
 
 # Third-party modules
 
@@ -12,7 +13,13 @@
 
 # Key: Category name
 # Value: should be used in lldbtest's debug-info replication
-debug_info_categories = {"dwarf": True, "dwo": True, "dsym": True, "gmodules": 
False}
+debug_info_categories = {
+    "dwarf": True,
+    "dwo": True,
+    "dsym": True,
+    "pdb": False,
+    "gmodules": False,
+}
 
 all_categories = {
     "basic_process": "Basic process execution sniff tests.",
@@ -34,6 +41,7 @@
     "lldb-dap": "Tests for the Debug Adapter Protocol with lldb-dap",
     "llgs": "Tests for the gdb-server functionality of lldb-server",
     "msvcstl": "Test for MSVC STL data formatters",
+    "pdb": "Tests that can be run with PDB debug information",
     "pexpect": "Tests requiring the pexpect library to be available",
     "objc": "Tests related to the Objective-C programming language support",
     "pyapi": "Tests related to the Python API",
@@ -65,6 +73,13 @@ def is_supported_on_platform(category, platform, 
compiler_path):
         if platform not in ["darwin", "macosx", "ios", "watchos", "tvos", 
"bridgeos"]:
             return False
         return gmodules.is_compiler_clang_with_gmodules(compiler_path)
+    elif category == "pdb":
+        if platform == "windows":
+            assert (
+                os.environ.get("LLDB_USE_NATIVE_PDB_READER") == "1"
+            ), "Only the native PDB reader is supported"
+            return True
+        return False
     return True
 
 
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterStdVector.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterStdVector.py
index d4da60f86a315..922f1fa1db800 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterStdVector.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterStdVector.py
@@ -185,6 +185,7 @@ def test_libcxx(self):
         self.do_test()
 
     @add_test_categories(["msvcstl"])
+    @expectedFailurePDB  # custom summary for std::int_vect doesn't work 
because typedef aren't preserved
     def test_msvcstl(self):
         # No flags, because the "msvcstl" category checks that the MSVC STL is 
used by default.
         self.build()
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 83713213ce1fe..5bd15a4b8c60b 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -349,6 +349,8 @@ def delete_module_cache(path):
     for v in ["SystemDrive"]:
         if v in os.environ:
             config.environment[v] = os.environ[v]
+    # Always use the native PDB reader
+    config.environment["LLDB_USE_NATIVE_PDB_READER"] = "1"
 
 # Some steps required to initialize the tests dynamically link with python.dll
 # and need to know the location of the Python libraries. This ensures that we

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

Reply via email to