|
1 | 1 | """
|
2 |
| -Test lldb data formatter for libc++ std::shared_ptr. |
| 2 | +Test lldb data formatter for std::shared_ptr. |
3 | 3 | """
|
4 | 4 |
|
5 | 5 | import lldb
|
|
9 | 9 |
|
10 | 10 |
|
11 | 11 | class TestCase(TestBase):
|
12 |
| - @add_test_categories(["libc++"]) |
13 |
| - def test_shared_ptr_variables(self): |
| 12 | + def do_test(self): |
14 | 13 | """Test `frame variable` output for `std::shared_ptr` types."""
|
15 |
| - self.build() |
16 |
| - |
17 | 14 | (_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(
|
18 | 15 | self, "// break here", lldb.SBFileSpec("main.cpp")
|
19 | 16 | )
|
@@ -56,24 +53,16 @@ def test_shared_ptr_variables(self):
|
56 | 53 | self.assertRegex(valobj.summary, r"^10( strong=1)? weak=0$")
|
57 | 54 | self.assertNotEqual(valobj.child[0].unsigned, 0)
|
58 | 55 |
|
59 |
| - if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion( |
60 |
| - [">", "16.0"] |
61 |
| - ): |
62 |
| - string_type = "std::string" |
63 |
| - else: |
64 |
| - string_type = "std::basic_string<char, std::char_traits<char>, std::allocator<char> > " |
65 |
| - |
66 | 56 | valobj = self.expect_var_path(
|
67 | 57 | "sp_str",
|
68 |
| - type="std::shared_ptr<" + string_type + ">", |
69 | 58 | children=[ValueCheck(name="pointer", summary='"hello"')],
|
70 | 59 | )
|
71 | 60 | self.assertRegex(valobj.summary, r'^"hello"( strong=1)? weak=0$')
|
72 | 61 |
|
73 | 62 | valobj = self.expect_var_path("sp_user", type="std::shared_ptr<User>")
|
74 | 63 | self.assertRegex(
|
75 | 64 | valobj.summary,
|
76 |
| - "^std(::__[^:]*)?::shared_ptr<User>::element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0", |
| 65 | + "element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0", |
77 | 66 | )
|
78 | 67 | self.assertNotEqual(valobj.child[0].unsigned, 0)
|
79 | 68 |
|
@@ -109,3 +98,13 @@ def test_shared_ptr_variables(self):
|
109 | 98 | valobj = self.expect_var_path(
|
110 | 99 | "wie", type="std::weak_ptr<int>", summary="nullptr strong=2 weak=2"
|
111 | 100 | )
|
| 101 | + |
| 102 | + @add_test_categories(["libc++"]) |
| 103 | + def test_libcxx(self): |
| 104 | + self.build(dictionary={"USE_LIBCPP": 1}) |
| 105 | + self.do_test() |
| 106 | + |
| 107 | + @add_test_categories(["libstdcxx"]) |
| 108 | + def test_libstdcxx(self): |
| 109 | + self.build(dictionary={"USE_LIBSTDCPP": 1}) |
| 110 | + self.do_test() |
0 commit comments