2 Test that the debugger handles loops in std::list (which can appear as a result of e.g. memory
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 class LibcxxListDataFormatterTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
17 NO_DEBUG_INFO_TESTCASE = True
19 @add_test_categories(["libc++"])
20 @expectedFailureAndroid(bugnumber="llvm.org/pr32592")
21 def test_with_run_command(self):
23 exe = self.getBuildArtifact("a.out")
24 target = self.dbg.CreateTarget(exe)
25 self.assertTrue(target and target.IsValid(), "Target is valid")
27 file_spec = lldb.SBFileSpec("main.cpp", False)
28 breakpoint1 = target.BreakpointCreateBySourceRegex(
29 '// Set break point at this line.', file_spec)
30 self.assertTrue(breakpoint1 and breakpoint1.IsValid())
31 breakpoint2 = target.BreakpointCreateBySourceRegex(
32 '// Set second break point at this line.', file_spec)
33 self.assertTrue(breakpoint2 and breakpoint2.IsValid())
35 # Run the program, it should stop at breakpoint 1.
36 process = target.LaunchSimple(
37 None, None, self.get_process_working_directory())
38 self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
40 len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint1)), 1)
42 # verify our list is displayed correctly
44 "frame variable *numbers_list",
52 # Continue to breakpoint 2.
54 self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
56 len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint2)), 1)
58 # The list is now inconsistent. However, we should be able to get the first three
59 # elements at least (and most importantly, not crash).
61 "frame variable *numbers_list",
69 self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)