1"""Check that compiler-generated constant values work correctly""" 2 3 4 5import lldb 6from lldbsuite.test.decorators import * 7from lldbsuite.test.lldbtest import * 8from lldbsuite.test import lldbutil 9 10 11class ConstVariableTestCase(TestBase): 12 13 @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc") 14 @expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el']) 15 @expectedFailureAll( 16 oslist=["windows"], 17 bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows") 18 def test_and_run_command(self): 19 """Test interpreted and JITted expressions on constant values.""" 20 self.build() 21 exe = self.getBuildArtifact("a.out") 22 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 23 24 # Break inside the main. 25 lldbutil.run_break_set_by_symbol( 26 self, "main", num_expected_locations=1) 27 28 self.runCmd("run", RUN_SUCCEEDED) 29 30 # The stop reason of the thread should be breakpoint. 31 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 32 substrs=['stopped', 33 'stop reason = breakpoint']) 34 35 # The breakpoint should have a hit count of 1. 36 lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1) 37 38 self.runCmd("next") 39 self.runCmd("next") 40 41 # Try frame variable. 42 self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY, 43 substrs=['(int32_t) index = 512']) 44 45 # Try an interpreted expression. 46 self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY, 47 substrs=['1024']) 48 49 # Try a JITted expression. 50 self.expect( 51 "expr (int)getpid(); (index - 256)", 52 VARIABLES_DISPLAYED_CORRECTLY, 53 substrs=['256']) 54 55 self.runCmd("kill") 56