@@ -804,6 +804,13 @@ def setUpCommands(cls):
804804 )
805805 return commands
806806
807+ def getDebugInfoSetupCommands (self ):
808+ if self .getDebugInfo () == "native-pdb" :
809+ return ["settings set plugin.symbol-file.pdb.reader native" ]
810+ if self .getDebugInfo () == "dia-pdb" :
811+ return ["settings set plugin.symbol-file.pdb.reader dia" ]
812+ return []
813+
807814 def setUp (self ):
808815 """Fixture for unittest test case setup.
809816
@@ -828,13 +835,6 @@ def setUp(self):
828835 else :
829836 self .lldbDAPExec = None
830837
831- self .lldbOption = " " .join ("-o '" + s + "'" for s in self .setUpCommands ())
832-
833- # If we spawn an lldb process for test (via pexpect), do not load the
834- # init file unless told otherwise.
835- if os .environ .get ("NO_LLDBINIT" ) != "NO" :
836- self .lldbOption += " --no-lldbinit"
837-
838838 # Assign the test method name to self.testMethodName.
839839 #
840840 # For an example of the use of this attribute, look at test/types dir.
@@ -843,6 +843,14 @@ def setUp(self):
843843 # used for all the test cases.
844844 self .testMethodName = self ._testMethodName
845845
846+ setUpCommands = self .setUpCommands () + self .getDebugInfoSetupCommands ()
847+ self .lldbOption = " " .join ("-o '" + s + "'" for s in setUpCommands )
848+
849+ # If we spawn an lldb process for test (via pexpect), do not load the
850+ # init file unless told otherwise.
851+ if os .environ .get ("NO_LLDBINIT" ) != "NO" :
852+ self .lldbOption += " --no-lldbinit"
853+
846854 # This is for the case of directly spawning 'lldb'/'gdb' and interacting
847855 # with it using pexpect.
848856 self .child = None
@@ -1792,6 +1800,12 @@ def no_reason(_):
17921800 if can_replicate
17931801 ]
17941802
1803+ # PDB is off by default, because it has a lot of failures right now.
1804+ # See llvm.org/pr149498
1805+ if original_testcase .TEST_WITH_PDB_DEBUG_INFO :
1806+ dbginfo_categories .append ("native-pdb" )
1807+ dbginfo_categories .append ("dia-pdb" )
1808+
17951809 xfail_for_debug_info_cat_fn = getattr (
17961810 attrvalue , "__xfail_for_debug_info_cat_fn__" , no_reason
17971811 )
@@ -1879,6 +1893,14 @@ class TestBase(Base, metaclass=LLDBTestCaseFactory):
18791893 # test multiple times with various debug info types.
18801894 NO_DEBUG_INFO_TESTCASE = False
18811895
1896+ TEST_WITH_PDB_DEBUG_INFO = False
1897+ """
1898+ Subclasses can set this to True to test with both native and DIA PDB in addition to
1899+ the other debug info types. This id off by default because many tests will
1900+ fail due to missing functionality in PDB.
1901+ See llvm.org/pr149498.
1902+ """
1903+
18821904 def generateSource (self , source ):
18831905 template = source + ".template"
18841906 temp = os .path .join (self .getSourceDir (), template )
@@ -1918,6 +1940,8 @@ def setUp(self):
19181940
19191941 for s in self .setUpCommands ():
19201942 self .runCmd (s )
1943+ for s in self .getDebugInfoSetupCommands ():
1944+ self .runCmd (s )
19211945
19221946 # We want our debugger to be synchronous.
19231947 self .dbg .SetAsync (False )
@@ -2264,7 +2288,9 @@ def completions_match(self, command, completions, max_completions=-1):
22642288 given list of completions"""
22652289 interp = self .dbg .GetCommandInterpreter ()
22662290 match_strings = lldb .SBStringList ()
2267- interp .HandleCompletion (command , len (command ), 0 , max_completions , match_strings )
2291+ interp .HandleCompletion (
2292+ command , len (command ), 0 , max_completions , match_strings
2293+ )
22682294 # match_strings is a 1-indexed list, so we have to slice...
22692295 self .assertCountEqual (
22702296 completions , list (match_strings )[1 :], "List of returned completion is wrong"
0 commit comments