1"""
2Test std::shared_ptr functionality with a class from debug info as content.
3"""
4
5from lldbsuite.test.decorators import *
6from lldbsuite.test.lldbtest import *
7from lldbsuite.test import lldbutil
8
9
10class TestSharedPtrDbgInfoContent(TestBase):
11
12    @add_test_categories(["libc++"])
13    @skipIf(compiler=no_match("clang"))
14    def test(self):
15        self.build()
16
17        lldbutil.run_to_source_breakpoint(self,
18                                          "// Set break point at this line.",
19                                          lldb.SBFileSpec("main.cpp"))
20
21        self.runCmd("settings set target.import-std-module true")
22
23        self.expect_expr("s",
24                         result_type="std::shared_ptr<Foo>",
25                         result_children=[ValueCheck(name="__ptr_")])
26        self.expect_expr("s->a", result_type="int", result_value="3")
27        self.expect_expr("s->a = 5", result_type="int", result_value="5")
28        self.expect_expr("s->a", result_type="int", result_value="5")
29        self.expect_expr("(bool)s", result_type="bool", result_value="true")
30        self.expect("expr s.reset()")
31        self.expect_expr("(bool)s", result_type="bool", result_value="false")
32