199451b44SJordan Rupprecht""" 299451b44SJordan RupprechtTest std::deque functionality with a decl from dbg info as content. 399451b44SJordan Rupprecht""" 499451b44SJordan Rupprecht 599451b44SJordan Rupprechtfrom lldbsuite.test.decorators import * 699451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import * 799451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil 899451b44SJordan Rupprecht 9cabee89bSRaphael Isemann 1099451b44SJordan Rupprechtclass TestDbgInfoContentDeque(TestBase): 1199451b44SJordan Rupprecht @add_test_categories(["libc++"]) 1299451b44SJordan Rupprecht @skipIf(compiler=no_match("clang")) 13*2238dcc3SJonas Devlieghere @skipIf(compiler="clang", compiler_version=["<", "12.0"]) 1499451b44SJordan Rupprecht def test(self): 1599451b44SJordan Rupprecht self.build() 1699451b44SJordan Rupprecht 17*2238dcc3SJonas Devlieghere lldbutil.run_to_source_breakpoint( 18*2238dcc3SJonas Devlieghere self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp") 19*2238dcc3SJonas Devlieghere ) 2099451b44SJordan Rupprecht 2199451b44SJordan Rupprecht self.runCmd("settings set target.import-std-module true") 2299451b44SJordan Rupprecht 23*2238dcc3SJonas Devlieghere if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion( 24*2238dcc3SJonas Devlieghere [">", "16.0"] 25*2238dcc3SJonas Devlieghere ): 263f6c856bSRaphael Isemann deque_type = "std::deque<Foo>" 273c667298SMichael Buch else: 283c667298SMichael Buch deque_type = "std::deque<Foo, std::allocator<Foo> >" 293c667298SMichael Buch 3015f3cd6bSMatheus Izvekov size_type = "size_type" 3115f3cd6bSMatheus Izvekov value_type = "value_type" 32cabee89bSRaphael Isemann 3315f3cd6bSMatheus Izvekov iterator_type = "iterator" 34*2238dcc3SJonas Devlieghere iterator_children = [ValueCheck(name="__m_iter_"), ValueCheck(name="__ptr_")] 35cabee89bSRaphael Isemann 3615f3cd6bSMatheus Izvekov riterator_type = "reverse_iterator" 37cabee89bSRaphael Isemann riterator_children = [ 387ccfaecbSMichael Buch ValueCheck(), # Deprecated __t_ member; no need to check 39*2238dcc3SJonas Devlieghere ValueCheck(name="current"), 40cabee89bSRaphael Isemann ] 41cabee89bSRaphael Isemann 42*2238dcc3SJonas Devlieghere self.expect_expr( 43*2238dcc3SJonas Devlieghere "a", 44cabee89bSRaphael Isemann result_type=deque_type, 45cabee89bSRaphael Isemann result_children=[ 46cabee89bSRaphael Isemann ValueCheck(children=[ValueCheck(value="3")]), 47cabee89bSRaphael Isemann ValueCheck(children=[ValueCheck(value="1")]), 48*2238dcc3SJonas Devlieghere ValueCheck(children=[ValueCheck(value="2")]), 49*2238dcc3SJonas Devlieghere ], 50*2238dcc3SJonas Devlieghere ) 51cabee89bSRaphael Isemann 52cabee89bSRaphael Isemann self.expect_expr("a.size()", result_type=size_type, result_value="3") 53*2238dcc3SJonas Devlieghere self.expect_expr( 54*2238dcc3SJonas Devlieghere "a.front()", result_type=value_type, result_children=[ValueCheck(value="3")] 55*2238dcc3SJonas Devlieghere ) 56*2238dcc3SJonas Devlieghere self.expect_expr( 57*2238dcc3SJonas Devlieghere "a.back()", result_type=value_type, result_children=[ValueCheck(value="2")] 58*2238dcc3SJonas Devlieghere ) 59cabee89bSRaphael Isemann self.expect_expr("a.front().a", result_type="int", result_value="3") 60cabee89bSRaphael Isemann self.expect_expr("a.back().a", result_type="int", result_value="2") 6199451b44SJordan Rupprecht 6299451b44SJordan Rupprecht self.expect("expr std::reverse(a.begin(), a.end())") 63cabee89bSRaphael Isemann self.expect_expr("a.front().a", result_type="int", result_value="2") 64cabee89bSRaphael Isemann self.expect_expr("a.back().a", result_type="int", result_value="3") 6599451b44SJordan Rupprecht 66*2238dcc3SJonas Devlieghere self.expect_expr( 67*2238dcc3SJonas Devlieghere "a.begin()", result_type=iterator_type, result_children=iterator_children 68*2238dcc3SJonas Devlieghere ) 69*2238dcc3SJonas Devlieghere self.expect_expr( 70*2238dcc3SJonas Devlieghere "a.rbegin()", result_type=riterator_type, result_children=riterator_children 71*2238dcc3SJonas Devlieghere ) 72cabee89bSRaphael Isemann self.expect_expr("a.begin()->a", result_type="int", result_value="2") 73cabee89bSRaphael Isemann self.expect_expr("a.rbegin()->a", result_type="int", result_value="3") 74