Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lldb/packages/Python/lldbsuite/test/builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,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": {"MAKE_PDB": "YES"},
}

# Collect all flags, with later options overriding earlier ones
Expand Down
12 changes: 12 additions & 0 deletions lldb/packages/Python/lldbsuite/test/lldbtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,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:
dbginfo_categories.append("pdb")

xfail_for_debug_info_cat_fn = getattr(
attrvalue, "__xfail_for_debug_info_cat_fn__", no_reason
)
Expand Down Expand Up @@ -1878,6 +1883,13 @@ 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 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)
Expand Down
4 changes: 4 additions & 0 deletions lldb/packages/Python/lldbsuite/test/make/Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ ifeq ($(CC_TYPE), clang)
MODULE_DEBUG_INFO_FLAGS += -gmodules
endif

ifeq "$(MAKE_PDB)" "YES"
DEBUG_INFO_FLAG ?= -g -gcodeview
endif

# If the OS is Windows, we need to pass -gdwarf to clang, otherwise it will build
# with codeview by default but all the tests rely on dwarf.
ifeq "$(OS)" "Windows_NT"
Expand Down
11 changes: 10 additions & 1 deletion lldb/packages/Python/lldbsuite/test/test_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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.",
Expand All @@ -34,6 +40,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",
Expand Down Expand Up @@ -65,6 +72,8 @@ 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":
return platform == "windows"
return True


Expand Down
3 changes: 3 additions & 0 deletions lldb/test/API/test_utils/pdb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CXX_SOURCES := main.cpp

include Makefile.rules
18 changes: 18 additions & 0 deletions lldb/test/API/test_utils/pdb/TestPdb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Test PDB enabled tests
"""

from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *


class TestBuildMethod(TestBase):
TEST_WITH_PDB_DEBUG_INFO = True

def test(self):
self.build()
self.assertTrue(self.dbg.CreateTarget(self.getBuildArtifact()))
if self.getDebugInfo() == "pdb":
self.expect(
"target modules dump symfile", patterns=["SymbolFile (native-)?pdb"]
)
1 change: 1 addition & 0 deletions lldb/test/API/test_utils/pdb/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int main() { return 0; }
Loading