[Lldb-commits] [lldb] [LLDB] Run API tests with native PDB too (PR #149305)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 17 06:13:42 PDT 2025
https://github.com/Nerixyz created https://github.com/llvm/llvm-project/pull/149305
>From https://github.com/llvm/llvm-project/pull/148554#issuecomment-3083261858 - this runs the API tests with the native PDB on Windows. Using native over DIA because it's easier to inspect/debug.
One of the most common issues is that PDB doesn't preserve typedefs - so `std::string` is a `std::basic_string<...>` and so on. These typedefs aren't contained in the debug info, either.
Draft, because there are about 120 failed tests I need to check.
>From 9768370d0e3f9464be65ac3bcce370f9ba3879b3 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at 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 +
lldb/packages/Python/lldbsuite/test/decorators.py | 4 ++++
.../packages/Python/lldbsuite/test/test_categories.py | 11 ++++++++++-
.../generic/vector/TestDataFormatterStdVector.py | 1 +
lldb/test/API/lit.cfg.py | 2 ++
5 files changed, 18 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/test_categories.py b/lldb/packages/Python/lldbsuite/test/test_categories.py
index 1f6e8a78e0c0d..272559cfd2c7f 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,7 @@
# 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": True, "gmodules": False}
all_categories = {
"basic_process": "Basic process execution sniff tests.",
@@ -34,6 +35,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 +67,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
More information about the lldb-commits
mailing list