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
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CXX_SOURCES := main.cpp

CXXFLAGS := -O0
USE_LIBSTDCPP := 1

include Makefile.rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Test lldb data formatter for libc++ std::shared_ptr.
Test lldb data formatter for std::shared_ptr.
"""

import lldb
Expand All @@ -9,11 +9,8 @@


class TestCase(TestBase):
@add_test_categories(["libc++"])
def test_shared_ptr_variables(self):
def do_test(self):
"""Test `frame variable` output for `std::shared_ptr` types."""
self.build()

(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(
self, "// break here", lldb.SBFileSpec("main.cpp")
)
Expand Down Expand Up @@ -56,24 +53,16 @@ def test_shared_ptr_variables(self):
self.assertRegex(valobj.summary, r"^10( strong=1)? weak=0$")
self.assertNotEqual(valobj.child[0].unsigned, 0)

if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
[">", "16.0"]
):
string_type = "std::string"
else:
string_type = "std::basic_string<char, std::char_traits<char>, std::allocator<char> > "

valobj = self.expect_var_path(
"sp_str",
type="std::shared_ptr<" + string_type + ">",
children=[ValueCheck(name="pointer", summary='"hello"')],
)
self.assertRegex(valobj.summary, r'^"hello"( strong=1)? weak=0$')

valobj = self.expect_var_path("sp_user", type="std::shared_ptr<User>")
self.assertRegex(
valobj.summary,
"^std(::__[^:]*)?::shared_ptr<User>::element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0",
"element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0",
)
self.assertNotEqual(valobj.child[0].unsigned, 0)

Expand Down Expand Up @@ -115,3 +104,13 @@ def test_shared_ptr_variables(self):
self.expect_var_path("ptr_node->next->value", value="2")
self.expect_var_path("(*ptr_node).value", value="1")
self.expect_var_path("(*(*ptr_node).next).value", value="2")

@add_test_categories(["libc++"])
def test_libcxx(self):
self.build(dictionary={"USE_LIBCPP": 1})
self.do_test()

@add_test_categories(["libstdcxx"])
def test_libstdcxx(self):
self.build(dictionary={"USE_LIBSTDCPP": 1})
self.do_test()

This file was deleted.

This file was deleted.

This file was deleted.

Loading