1import lldb 2from lldbsuite.test.decorators import * 3from lldbsuite.test.lldbtest import * 4from lldbsuite.test import lldbutil 5 6class TestCase(TestBase): 7 8 mydir = TestBase.compute_mydir(__file__) 9 10 def test(self): 11 self.build() 12 lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c")) 13 14 self.expect("statistics disable", substrs=['need to enable statistics before disabling'], error=True) 15 16 # 'expression' should change the statistics. 17 self.expect("statistics enable") 18 self.expect("statistics enable", substrs=['already enabled'], error=True) 19 self.expect("expr patatino", substrs=['27']) 20 self.expect("statistics disable") 21 self.expect("statistics dump", substrs=['expr evaluation successes : 1\n', 22 'expr evaluation failures : 0\n']) 23 24 # 'frame var' with disabled statistics shouldn't change stats. 25 self.expect("frame var", substrs=['27']) 26 27 self.expect("statistics enable") 28 # 'frame var' with enabled statistics will change stats. 29 self.expect("frame var", substrs=['27']) 30 self.expect("statistics disable") 31 self.expect("statistics dump", substrs=['frame var successes : 1\n', 32 'frame var failures : 0\n']) 33