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 mydir = TestBase.compute_mydir(__file__) 14 15 @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc") 16 @expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el']) 17 @expectedFailureAll( 18 oslist=["windows"], 19 bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows") 20 @expectedFailureNetBSD 21 def test_and_run_command(self): 22 """Test interpreted and JITted expressions on constant values.""" 23 self.build() 24 exe = self.getBuildArtifact("a.out") 25 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 26 27 # Break inside the main. 28 lldbutil.run_break_set_by_symbol( 29 self, "main", num_expected_locations=1) 30 31 self.runCmd("run", RUN_SUCCEEDED) 32 33 # The stop reason of the thread should be breakpoint. 34 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 35 substrs=['stopped', 36 'stop reason = breakpoint']) 37 38 # The breakpoint should have a hit count of 1. 39 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, 40 substrs=[' resolved, hit count = 1']) 41 42 self.runCmd("next") 43 self.runCmd("next") 44 45 # Try frame variable. 46 self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY, 47 substrs=['(int32_t) index = 512']) 48 49 # Try an interpreted expression. 50 self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY, 51 substrs=['1024']) 52 53 # Try a JITted expression. 54 self.expect( 55 "expr (int)getpid(); (index - 256)", 56 VARIABLES_DISPLAYED_CORRECTLY, 57 substrs=['256']) 58 59 self.runCmd("kill") 60