2 Test lldb data formatter subsystem.
6 from lldbsuite
.test
.decorators
import *
7 from lldbsuite
.test
.lldbtest
import *
8 import lldbsuite
.test
.lldbutil
as lldbutil
11 class ValueObjectRecursionTestCase(TestBase
):
13 # Call super's setUp().
15 # Find the line number to break at.
16 self
.line
= line_number("main.cpp", "// Set break point at this line.")
19 def test_with_run_command(self
):
20 """Test that deeply nested ValueObjects still work."""
22 self
.runCmd("file " + self
.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET
)
24 lldbutil
.run_break_set_by_file_and_line(
25 self
, "main.cpp", self
.line
, num_expected_locations
=1, loc_exact
=True
28 self
.runCmd("run", RUN_SUCCEEDED
)
30 # The stop reason of the thread should be breakpoint.
33 STOPPED_DUE_TO_BREAKPOINT
,
34 substrs
=["stopped", "stop reason = breakpoint"],
37 # This is the function to remove the custom formats in order to have a
38 # clean slate for the next test case.
40 self
.runCmd("type format clear", check
=False)
41 self
.runCmd("type summary clear", check
=False)
43 # Execute the cleanup function during test case tear down.
44 self
.addTearDownHook(cleanup
)
46 root
= self
.frame().FindVariable("root")
47 child
= root
.GetChildAtIndex(1)
51 for i
in range(0, 15000):
52 child
= child
.GetChildAtIndex(1)
55 self
.assertTrue(child
.IsValid(), "could not retrieve the deep ValueObject")
57 child
.GetChildAtIndex(0).IsValid(), "the deep ValueObject has no value"
60 child
.GetChildAtIndex(0).GetValueAsUnsigned(),
62 "the deep ValueObject has a zero value",
65 child
.GetChildAtIndex(1).GetValueAsUnsigned(),
67 "the deep ValueObject has no next",