2 Test stepping into std::function
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class LibCxxFunctionSteppingIntoCallableTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
17 NO_DEBUG_INFO_TESTCASE = True
19 @add_test_categories(["libc++"])
21 """Test that std::function as defined by libc++ is correctly printed by LLDB"""
24 self.main_source = "main.cpp"
25 self.main_source_spec = lldb.SBFileSpec(self.main_source)
26 self.source_foo_line = line_number(
27 self.main_source, '// Source foo start line')
28 self.source_lambda_f2_line = line_number(
29 self.main_source, '// Source lambda used by f2 start line')
30 self.source_lambda_f3_line = line_number(
31 self.main_source, '// Source lambda used by f3 start line')
32 self.source_bar_operator_line = line_number(
33 self.main_source, '// Source Bar::operator()() start line')
34 self.source_bar_add_num_line = line_number(
35 self.main_source, '// Source Bar::add_num start line')
36 self.source_main_invoking_f1 = line_number(
37 self.main_source, '// Source main invoking f1')
39 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
40 self, "// Set break point at this line.", self.main_source_spec)
43 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_main_invoking_f1 ) ;
44 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ;
47 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_foo_line ) ;
48 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ;
52 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_lambda_f2_line ) ;
53 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ;
57 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_lambda_f3_line ) ;
58 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ;
61 # TODO reenable this case when std::function formatter supports
62 # general callable object case.
64 #self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_bar_operator_line ) ;
65 #self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ;
69 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_bar_add_num_line ) ;
70 self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ;