[Lldb-commits] [lldb] [lldb][test] Expect underlying types for typedefs with PDB in five tests (PR #238170)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 16:55:20 PST 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/238170

`CodeView` has no type record for a typedef, and variables refer to the underlying type directly, so with PDB debug info frame variable shows unsigned int where DWARF shows `uint32_t`, `__int128` for `__int128_t`, etc.

In these five tests the typedef name is incidental to what is tested, so this patch expects the underlying type when the test runs with PDB, as the STL data formatter tests already do, and enables PDB on them.

rdar://191640693

>From a80b4f66506ad0022af60ad2f4cf9a429561884c Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Mon, 28 Sep 2026 12:46:52 +0100
Subject: [PATCH] [lldb][test] Expect underlying types for typedefs with PDB in
 five tests

---
 .../TestFunctionTemplateSpecializationTempArgs.py     |  5 +++--
 .../commands/expression/int128/Test128BitsInteger.py  |  7 +------
 lldb/test/API/commands/expression/int128/main.c       |  7 ++++---
 .../commands/expression/urem-sign/TestScalarURem.py   |  6 +-----
 lldb/test/API/commands/expression/urem-sign/main.c    |  3 ++-
 .../API/lang/cpp/unsigned_types/TestUnsignedTypes.py  |  7 +++++--
 .../value/value_wrap/TestValueAPIWrapper.py           | 11 +++++++----
 7 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/lldb/test/API/commands/expression/function_template_specialization_temp_args/TestFunctionTemplateSpecializationTempArgs.py b/lldb/test/API/commands/expression/function_template_specialization_temp_args/TestFunctionTemplateSpecializationTempArgs.py
index 83c329cfc8c60a..db4f6f96a8761f 100644
--- a/lldb/test/API/commands/expression/function_template_specialization_temp_args/TestFunctionTemplateSpecializationTempArgs.py
+++ b/lldb/test/API/commands/expression/function_template_specialization_temp_args/TestFunctionTemplateSpecializationTempArgs.py
@@ -6,7 +6,6 @@
 
 class TestFunctionTemplateSpecializationTempArgs(TestBase):
     @skipIf(oslist=["windows"], archs=["aarch64"])
-    @expectedFailureAll(debug_info=["pdb"], bugnumber="llvm.org/pr149498")
     def test_function_template_specialization_temp_args(self):
         self.build()
 
@@ -14,4 +13,6 @@ def test_function_template_specialization_temp_args(self):
             self, "// break here", lldb.SBFileSpec("main.cpp", False)
         )
 
-        self.expect_expr("p0", result_type="VType", result_children=[])
+        # With PDB, p0 has the type that the VType typedef names.
+        vtype = "M<int>" if self.getDebugInfo() == "pdb" else "VType"
+        self.expect_expr("p0", result_type=vtype, result_children=[])
diff --git a/lldb/test/API/commands/expression/int128/Test128BitsInteger.py b/lldb/test/API/commands/expression/int128/Test128BitsInteger.py
index 7a1b7c754638c6..7aa2f586e593c3 100644
--- a/lldb/test/API/commands/expression/int128/Test128BitsInteger.py
+++ b/lldb/test/API/commands/expression/int128/Test128BitsInteger.py
@@ -4,10 +4,5 @@
 lldbinline.MakeInlineTest(
     __file__,
     globals(),
-    [
-        decorators.skipIf(archs=["arm$", "armv7k", "i386"]),
-        decorators.expectedFailureAll(
-            debug_info=["pdb"], bugnumber="llvm.org/pr149498"
-        ),
-    ],
+    decorators.skipIf(archs=["arm$", "armv7k", "i386"]),
 )
diff --git a/lldb/test/API/commands/expression/int128/main.c b/lldb/test/API/commands/expression/int128/main.c
index 4d5a041ad91d5d..87a48510fdfe3e 100644
--- a/lldb/test/API/commands/expression/int128/main.c
+++ b/lldb/test/API/commands/expression/int128/main.c
@@ -2,7 +2,8 @@ int main(void)
 {
     __int128_t n = 1;
     n = n + n;
-    return n; //%self.expect("expression n", substrs=['(__int128_t) $0 = 2'])
-              //%self.expect("expression n + 6", substrs=['(__int128_t) $1 = 8'])
-              //%self.expect("expression n + n", substrs=['(__int128_t) $2 = 4'])
+    return n; //%int128 = "__int128" if self.getDebugInfo() == "pdb" else "__int128_t"
+              //%self.expect("expression n", substrs=['(%s) $0 = 2' % int128])
+              //%self.expect("expression n + 6", substrs=['(%s) $1 = 8' % int128])
+              //%self.expect("expression n + n", substrs=['(%s) $2 = 4' % int128])
 }
diff --git a/lldb/test/API/commands/expression/urem-sign/TestScalarURem.py b/lldb/test/API/commands/expression/urem-sign/TestScalarURem.py
index 3f72ebbbb2a06c..03424658f3ed3d 100644
--- a/lldb/test/API/commands/expression/urem-sign/TestScalarURem.py
+++ b/lldb/test/API/commands/expression/urem-sign/TestScalarURem.py
@@ -1,8 +1,4 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(
-    __file__,
-    globals(),
-    [decorators.expectedFailureAll(debug_info=["pdb"], bugnumber="llvm.org/pr149498")],
-)
+lldbinline.MakeInlineTest(__file__, globals(), None)
diff --git a/lldb/test/API/commands/expression/urem-sign/main.c b/lldb/test/API/commands/expression/urem-sign/main.c
index 69f5ffc6a7ae2c..ccec0cb3ec047d 100644
--- a/lldb/test/API/commands/expression/urem-sign/main.c
+++ b/lldb/test/API/commands/expression/urem-sign/main.c
@@ -10,7 +10,8 @@ void func_1(void)
   struct S0 l_19;
   l_19.f2 = 419;
   uint32_t l_4037 = 4294967295UL;
-  l_19.f2 = g_463; //%self.expect("expr ((l_4037 % (-(g_463))) | l_19.f2)", substrs=['(uint32_t) $0 = 358717883'])
+  // With PDB, the variables have the underlying type of the typedef.
+  l_19.f2 = g_463; //%self.expect("expr ((l_4037 % (-(g_463))) | l_19.f2)", substrs=['(%s) $0 = 358717883' % ("unsigned int" if self.getDebugInfo() == "pdb" else "uint32_t")])
 }
 int main()
 {
diff --git a/lldb/test/API/lang/cpp/unsigned_types/TestUnsignedTypes.py b/lldb/test/API/lang/cpp/unsigned_types/TestUnsignedTypes.py
index 9e6206fad7307c..cb5f2c7586f606 100644
--- a/lldb/test/API/lang/cpp/unsigned_types/TestUnsignedTypes.py
+++ b/lldb/test/API/lang/cpp/unsigned_types/TestUnsignedTypes.py
@@ -10,7 +10,6 @@
 
 
 class UnsignedTypesTestCase(TestBase):
-    @expectedFailureAll(debug_info=["pdb"], bugnumber="llvm.org/pr149498")
     def test(self):
         """Test that variables with unsigned types display correctly."""
         self.build()
@@ -18,6 +17,10 @@ def test(self):
             self, "// Set break point at this line", lldb.SBFileSpec("main.cpp")
         )
 
+        # CodeView has no type records for typedefs, so with PDB the variable
+        # has the underlying type.
+        uint32_name = "unsigned int" if self.getDebugInfo() == "pdb" else "uint32_t"
+
         # Test that unsigned types display correctly.
         self.expect(
             "frame variable --show-types --no-args",
@@ -30,6 +33,6 @@ def test(self):
                 "(unsigned int) the_unsigned_int = 99",
                 "(unsigned long) the_unsigned_long = 99",
                 "(unsigned long long) the_unsigned_long_long = 99",
-                "(uint32_t) the_uint32 = 99",
+                f"({uint32_name}) the_uint32 = 99",
             ],
         )
diff --git a/lldb/test/API/python_api/value/value_wrap/TestValueAPIWrapper.py b/lldb/test/API/python_api/value/value_wrap/TestValueAPIWrapper.py
index 25342a4cfe07ba..28f6fcfba01f77 100644
--- a/lldb/test/API/python_api/value/value_wrap/TestValueAPIWrapper.py
+++ b/lldb/test/API/python_api/value/value_wrap/TestValueAPIWrapper.py
@@ -9,7 +9,6 @@
 
 
 class ValueAPIWrapper(TestBase):
-    @expectedFailureAll(debug_info=["pdb"], bugnumber="llvm.org/pr149498")
     def test_accessors(self):
         """Test non-modifying operators (e.g. __getitem__, __add__)."""
         self.build()
@@ -56,9 +55,13 @@ def test_accessors(self):
 
         self.assertFalse(lldb.value(frame.FindVariable("this_does_not_exist")))
 
+        # CodeView has no type records for typedefs, so with PDB the variables
+        # have the underlying type.
+        u32 = "unsigned int" if self.getDebugInfo() == "pdb" else "uint32_t"
+
         # Test __str__().
-        self.assertEqual(str(u32_zero), "(uint32_t) u32_zero = 0")
-        self.assertEqual(str(u32_one), "(uint32_t) u32_one = 1")
+        self.assertEqual(str(u32_zero), f"({u32}) u32_zero = 0")
+        self.assertEqual(str(u32_one), f"({u32}) u32_one = 1")
 
         # Test __getitem__(key).
         self.assertIsInstance(arr[0], lldb.value)
@@ -172,7 +175,7 @@ def test_accessors(self):
         # Test __eq__().
         self.assertEqual(u32_two, i32_two)
         self.assertEqual(u32_two, 2)
-        self.assertEqual(u32_two, "(uint32_t) u32_two = 2")
+        self.assertEqual(u32_two, f"({u32}) u32_two = 2")
         with self.assertRaisesRegex(
             TypeError, "^Unknown type <class 'bool'>, No equality operation defined.$"
         ):



More information about the lldb-commits mailing list