3 Test lldb data formatter subsystem.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
12 from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
15 class ObjCDataFormatterKVO(ObjCDataFormatterTestCase):
18 def test_kvo_with_run_command(self):
19 """Test the behavior of formatters when KVO is in use."""
21 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
22 self, '// Set break point at this line.',
23 lldb.SBFileSpec('main.m', False))
25 # The stop reason of the thread should be breakpoint.
28 STOPPED_DUE_TO_BREAKPOINT,
29 substrs=['stopped', 'stop reason = breakpoint'])
31 # This is the function to remove the custom formats in order to have a
32 # clean slate for the next test case.
34 self.runCmd('type format clear', check=False)
35 self.runCmd('type summary clear', check=False)
36 self.runCmd('type synth clear', check=False)
38 # Execute the cleanup function during test case tear down.
39 self.addTearDownHook(cleanup)
41 # as long as KVO is implemented by subclassing, this test should succeed
42 # we should be able to dynamically figure out that the KVO implementor class
43 # is a subclass of Molecule, and use the appropriate summary for it
44 self.runCmd("type summary add -s JustAMoleculeHere Molecule")
45 self.expect('frame variable molecule', substrs=['JustAMoleculeHere'])
47 self.expect("thread list", substrs=['stopped', 'step over'])
48 self.expect('frame variable molecule', substrs=['JustAMoleculeHere'])
51 # check that NSMutableDictionary's formatter is not confused when
52 # dealing with a KVO'd dictionary
54 'frame variable newMutableDictionary',
56 '(NSDictionary *) newMutableDictionary = ',
60 lldbutil.run_break_set_by_regexp(self, 'setAtoms')
62 self.runCmd("continue")
63 self.expect("frame variable _cmd", substrs=['setAtoms:'])