Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / functionalities / recursion / TestValueObjectRecursion.py
bloba98cf97fd943dc2ab8a7e2819ce350b731b1b54f
1 """
2 Test lldb data formatter subsystem.
3 """
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
8 import lldbsuite.test.lldbutil as lldbutil
11 class ValueObjectRecursionTestCase(TestBase):
12 def setUp(self):
13 # Call super's setUp().
14 TestBase.setUp(self)
15 # Find the line number to break at.
16 self.line = line_number("main.cpp", "// Set break point at this line.")
18 @no_debug_info_test
19 def test_with_run_command(self):
20 """Test that deeply nested ValueObjects still work."""
21 self.build()
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.
31 self.expect(
32 "thread list",
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.
39 def cleanup():
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)
48 if self.TraceOn():
49 print(root)
50 print(child)
51 for i in range(0, 15000):
52 child = child.GetChildAtIndex(1)
53 if self.TraceOn():
54 print(child)
55 self.assertTrue(child.IsValid(), "could not retrieve the deep ValueObject")
56 self.assertTrue(
57 child.GetChildAtIndex(0).IsValid(), "the deep ValueObject has no value"
59 self.assertNotEqual(
60 child.GetChildAtIndex(0).GetValueAsUnsigned(),
62 "the deep ValueObject has a zero value",
64 self.assertNotEqual(
65 child.GetChildAtIndex(1).GetValueAsUnsigned(),
67 "the deep ValueObject has no next",