2 Test lldb data formatter subsystem.
5 from __future__ import print_function
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
17 class NSDictionarySyntheticTestCase(TestBase):
19 mydir = TestBase.compute_mydir(__file__)
22 # Call super's setUp().
24 # Find the line number to break at.
25 self.line = line_number('main.m', '// Set break point at this line.')
28 def test_rdar11988289_with_run_command(self):
29 """Test that NSDictionary reports its synthetic children properly."""
31 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
33 lldbutil.run_break_set_by_file_and_line(
34 self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
36 self.runCmd("run", RUN_SUCCEEDED)
38 # The stop reason of the thread should be breakpoint.
39 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
41 'stop reason = breakpoint'])
43 # This is the function to remove the custom formats in order to have a
44 # clean slate for the next test case.
46 self.runCmd('type format clear', check=False)
47 self.runCmd('type summary clear', check=False)
48 self.runCmd('type synth clear', check=False)
50 # Execute the cleanup function during test case tear down.
51 self.addTearDownHook(cleanup)
53 # Now check that we are displaying Cocoa classes correctly
54 self.expect('frame variable dictionary',
55 substrs=['3 key/value pairs'])
56 self.expect('frame variable mutabledict',
57 substrs=['4 key/value pairs'])
59 'frame variable dictionary --ptr-depth 1',
68 'frame variable mutabledict --ptr-depth 1',
78 'frame variable dictionary --ptr-depth 1 --dynamic-type no-run-target',
86 'frame variable mutabledict --ptr-depth 1 --dynamic-type no-run-target',
91 '@"http://www.apple.com"',
95 'frame variable mutabledict --ptr-depth 2 --dynamic-type no-run-target',
100 '@"http://www.apple.com"',
106 'frame variable mutabledict --ptr-depth 3 --dynamic-type no-run-target',
111 '@"http://www.apple.com"',
120 self.frame().FindVariable("dictionary").MightHaveChildren(),
121 "dictionary says it does not have children!")
123 self.frame().FindVariable("mutabledict").MightHaveChildren(),
124 "mutable says it does not have children!")