llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: nerix (Nerixyz) <details> <summary>Changes</summary> >From https://github.com/llvm/llvm-project/pull/148554#issuecomment-3083261858 >- this adds an option for API tests to be run with the native PDB reader on >Windows. As there are a lot of failures with PDB, this is an opt-in per test. >Once #<!-- -->51933 makes progress, this could be expanded. To get PDB, `-g` has to be used on Clang. As far as I know, there's no way to specify something like `-gpdb`. `-gcodeview` is the closest, but I don't think it sets the correct linker flags (or something similar) - at least LLDB doesn't have any debug info in that case. #<!-- -->149498 tracks the (currently) failing tests. --- Full diff: https://github.com/llvm/llvm-project/pull/149305.diff 4 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/builders/builder.py (+1) - (modified) lldb/packages/Python/lldbsuite/test/lldbtest.py (+13) - (modified) lldb/packages/Python/lldbsuite/test/test_categories.py (+16-1) - (modified) lldb/test/API/lit.cfg.py (+2) ``````````diff 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/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/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 `````````` </details> https://github.com/llvm/llvm-project/pull/149305 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits