Skip to content

Commit 9b12f8f

Browse files
authored
[LLDB] Run MSVC STL smart pointer tests with PDB (#166946)
Runs the `std::shared/unique_ptr` tests with PDB with two changes: - PDB uses the "full" name, so `std::string` is `std::basic_string<char, std::char_traits<char>, std::allocator<char>>` - The type of the pointer inside the shared/unique_ptr isn't the `element_type` typedef
1 parent e6145e8 commit 9b12f8f

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/TestDataFormatterStdSharedPtr.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010

1111
class TestCase(TestBase):
12+
TEST_WITH_PDB_DEBUG_INFO = True
13+
1214
def do_test(self):
1315
"""Test `frame variable` output for `std::shared_ptr` types."""
1416
(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(
@@ -62,7 +64,7 @@ def do_test(self):
6264
valobj = self.expect_var_path("sp_user", type="std::shared_ptr<User>")
6365
self.assertRegex(
6466
valobj.summary,
65-
"element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0",
67+
f"{'User' if self.getDebugInfo() == 'pdb' else 'element_type'} @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0",
6668
)
6769
self.assertNotEqual(valobj.child[0].unsigned, 0)
6870

@@ -77,7 +79,15 @@ def do_test(self):
7779
self.assertEqual(str(valobj), '(User) *pointer = (id = 30, name = "steph")')
7880

7981
self.expect_var_path("sp_user->id", type="int", value="30")
80-
self.expect_var_path("sp_user->name", type="std::string", summary='"steph"')
82+
self.expect_var_path(
83+
"sp_user->name",
84+
type=(
85+
"std::basic_string<char, std::char_traits<char>, std::allocator<char>>"
86+
if self.getDebugInfo() == "pdb"
87+
else "std::string"
88+
),
89+
summary='"steph"',
90+
)
8191

8292
valobj = self.expect_var_path(
8393
"si", type="std::shared_ptr<int>", summary="47 strong=2 weak=0"

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/TestDataFormatterStdUniquePtr.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010

1111
class TestCase(TestBase):
12+
TEST_WITH_PDB_DEBUG_INFO = True
13+
1214
def do_test(self):
1315
"""Test `frame variable` output for `std::unique_ptr` types."""
1416

@@ -84,7 +86,15 @@ def do_test(self):
8486
self.assertNotEqual(valobj.child[0].unsigned, 0)
8587

8688
self.expect_var_path("up_user->id", type="int", value="30")
87-
self.expect_var_path("up_user->name", type="std::string", summary='"steph"')
89+
self.expect_var_path(
90+
"up_user->name",
91+
type=(
92+
"std::basic_string<char, std::char_traits<char>, std::allocator<char>>"
93+
if self.getDebugInfo() == "pdb"
94+
else "std::string"
95+
),
96+
summary='"steph"',
97+
)
8898

8999
self.runCmd("settings set target.experimental.use-DIL true")
90100
self.expect_var_path("ptr_node->value", value="1")

0 commit comments

Comments
 (0)