]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / lang / c / const_variables / TestConstVariables.py
1 """Check that compiler-generated constant values work correctly"""
2
3 from __future__ import print_function
4
5
6
7 import os, time
8 import lldb
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
12
13 class ConstVariableTestCase(TestBase):
14
15     mydir = TestBase.compute_mydir(__file__)
16
17     @expectedFailureAll(
18         oslist=["freebsd", "linux"],
19         compiler="clang", compiler_version=["<", "3.5"])
20     @expectedFailureAll(
21         oslist=["freebsd", "linux"],
22         compiler="clang", compiler_version=["=", "3.7"])
23     @expectedFailureAll(
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."""
32         self.build()
33         exe = os.path.join(os.getcwd(), "a.out")
34         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
35
36         # Break inside the main.
37         lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=1)
38
39         self.runCmd("run", RUN_SUCCEEDED)
40
41         # The stop reason of the thread should be breakpoint.
42         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
43             substrs = ['stopped',
44                        'stop reason = breakpoint'])
45
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'])
49
50         self.runCmd("next")
51         self.runCmd("next")
52
53         # Try frame variable.
54         self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY,
55             substrs = ['(int32_t) index = 512'])
56
57         # Try an interpreted expression.
58         self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY,
59             substrs = ['1024'])
60
61         # Try a JITted expression.
62         self.expect("expr (int)getpid(); (index - 256)", VARIABLES_DISPLAYED_CORRECTLY,
63             substrs = ['256'])
64
65         self.runCmd("kill")