1 """Check that compiler-generated constant values work correctly"""
3 from __future__ import print_function
9 from lldbsuite.test.lldbtest import *
10 import lldbsuite.test.lldbutil as lldbutil
12 class ConstVariableTestCase(TestBase):
14 mydir = TestBase.compute_mydir(__file__)
17 oslist=["freebsd", "linux"],
18 compiler="clang", compiler_version=["<", "3.5"])
20 oslist=["freebsd", "linux"],
21 compiler="clang", compiler_version=["=", "3.7"])
23 oslist=["freebsd", "linux"],
24 compiler="clang", compiler_version=["=", "3.8"])
25 @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc")
26 @expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
27 @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows")
28 @expectedFailureWindows("llvm.org/pr24490: We shouldn't be using platform-specific names like `getpid` in tests")
29 def test_and_run_command(self):
30 """Test interpreted and JITted expressions on constant values."""
32 exe = os.path.join(os.getcwd(), "a.out")
33 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
35 # Break inside the main.
36 lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=1)
38 self.runCmd("run", RUN_SUCCEEDED)
40 # The stop reason of the thread should be breakpoint.
41 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
43 'stop reason = breakpoint'])
45 # The breakpoint should have a hit count of 1.
46 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
47 substrs = [' resolved, hit count = 1'])
53 self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY,
54 substrs = ['(int32_t) index = 512'])
56 # Try an interpreted expression.
57 self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY,
60 # Try a JITted expression.
61 self.expect("expr (int)getpid(); (index - 256)", VARIABLES_DISPLAYED_CORRECTLY,