2 Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class SyntheticCappingTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
18 # Call super's setUp().
20 # Find the line number to break at.
21 self.line = line_number('main.cpp', '// Set break point at this line.')
23 def test_with_run_command(self):
24 """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs."""
26 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
28 lldbutil.run_break_set_by_file_and_line(
29 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
31 self.runCmd("run", RUN_SUCCEEDED)
33 process = self.dbg.GetSelectedTarget().GetProcess()
35 # The stop reason of the thread should be breakpoint.
36 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
38 'stop reason = breakpoint'])
40 # This is the function to remove the custom formats in order to have a
41 # clean slate for the next test case.
43 self.runCmd('type format clear', check=False)
44 self.runCmd('type summary clear', check=False)
45 self.runCmd('type filter clear', check=False)
46 self.runCmd('type synth clear', check=False)
48 "settings set target.max-children-count 256",
51 # Execute the cleanup function during test case tear down.
52 self.addTearDownHook(cleanup)
54 # set up the synthetic children provider
55 self.runCmd("script from fooSynthProvider import *")
56 self.runCmd("type synth add -l fooSynthProvider foo")
58 # note that the value of fake_a depends on target byte order
59 if process.GetByteOrder() == lldb.eByteOrderLittle:
60 fake_a_val = 0x02000000
62 fake_a_val = 0x00000100
64 # check that the synthetic children work, so we know we are doing the
66 self.expect("frame variable f00_1",
68 'fake_a = %d' % fake_a_val,
71 # check that capping works
72 self.runCmd("settings set target.max-children-count 2", check=False)
74 self.expect("frame variable f00_1",
76 'fake_a = %d' % fake_a_val,
79 self.expect("frame variable f00_1", matching=False,
82 self.runCmd("settings set target.max-children-count 256", check=False)
84 self.expect("frame variable f00_1", matching=True,