1 """Check that compiler-generated constant values work correctly"""
3 from __future__ import print_function
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
13 class ConstVariableTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
18 oslist=["freebsd", "linux"],
19 compiler="clang", compiler_version=["<", "3.5"])
21 oslist=["freebsd", "linux"],
22 compiler="clang", compiler_version=["=", "3.7"])
24 oslist=["freebsd", "linux"],
25 compiler="clang", compiler_version=["=", "3.8"])
26 @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc")
27 @expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
28 @expectedFailureAll(oslist=["linux"], archs=['arm', 'aarch64'], bugnumber="llvm.org/pr27883")
29 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
30 def test_and_run_command(self):
31 """Test interpreted and JITted expressions on constant values."""
33 exe = os.path.join(os.getcwd(), "a.out")
34 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
36 # Break inside the main.
37 lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=1)
39 self.runCmd("run", RUN_SUCCEEDED)
41 # The stop reason of the thread should be breakpoint.
42 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
44 'stop reason = breakpoint'])
46 # The breakpoint should have a hit count of 1.
47 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
48 substrs = [' resolved, hit count = 1'])
54 self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY,
55 substrs = ['(int32_t) index = 512'])
57 # Try an interpreted expression.
58 self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY,
61 # Try a JITted expression.
62 self.expect("expr (int)getpid(); (index - 256)", VARIABLES_DISPLAYED_CORRECTLY,