1""" 2Test std::unique_ptr functionality with a decl 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 TestUniquePtrDbgInfoContent(TestBase): 11 @add_test_categories(["libc++"]) 12 @skipIf(compiler=no_match("clang")) 13 @skipIf(compiler="clang", compiler_version=["<", "9.0"]) 14 @skipIfLinux # s.reset() causes link errors on ubuntu 18.04/Clang 9 15 def test(self): 16 self.build() 17 18 lldbutil.run_to_source_breakpoint( 19 self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp") 20 ) 21 22 self.runCmd("settings set target.import-std-module true") 23 24 if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion( 25 [">", "16.0"] 26 ): 27 ptr_type = "std::unique_ptr<Foo>" 28 else: 29 ptr_type = "std::unique_ptr<Foo, std::default_delete<Foo> >" 30 31 self.expect_expr( 32 "s", 33 result_type=ptr_type, 34 result_children=[ValueCheck(children=[ValueCheck(value="3")])], 35 ) 36 self.expect_expr("s->a", result_type="int", result_value="3") 37 self.expect_expr("s->a = 5", result_type="int", result_value="5") 38 self.expect_expr("(int)s->a", result_type="int", result_value="5") 39 self.expect_expr("(bool)s", result_type="bool", result_value="true") 40 self.expect("expr s.reset()") 41 self.expect_expr("(bool)s", result_type="bool", result_value="false") 42