| 1 |
""" |
| 2 |
Test DIL arithmetic. |
| 3 |
""" |
| 4 |
|
| 5 |
import lldb |
| 6 |
from lldbsuite.test.lldbtest import * |
| 7 |
from lldbsuite.test.decorators import * |
| 8 |
from lldbsuite.test import lldbutil |
| 9 |
|
| 10 |
|
| 11 |
class TestFrameVarDILArithmetic(TestBase): |
| 12 |
NO_DEBUG_INFO_TESTCASE = True |
| 13 |
|
| 14 |
def test_arithmetic(self): |
| 15 |
self.build() |
| 16 |
lldbutil.run_to_source_breakpoint( |
| 17 |
self, "Set a breakpoint here", lldb.SBFileSpec("main.cpp") |
| 18 |
) |
| 19 |
|
| 20 |
self.runCmd("settings set target.experimental.use-DIL true") |
| 21 |
|
| 22 |
# Check unary results and integral promotion |
| 23 |
self.expect_var_path("+0", value="0") |
| 24 |
self.expect_var_path("-0", value="0") |
| 25 |
self.expect_var_path("+1", value="1") |
| 26 |
self.expect_var_path("-1", value="-1") |
| 27 |
self.expect_var_path("-9223372036854775808", value="9223372036854775808") |
| 28 |
self.expect_var_path("s", value="10", type="short") |
| 29 |
self.expect_var_path("+s", value="10", type="int") |
| 30 |
self.expect_var_path("-s", value="-10", type="int") |
| 31 |
self.expect_var_path("+us", value="1", type="int") |
| 32 |
self.expect_var_path("-us", value="-1", type="int") |
| 33 |
self.expect_var_path("+ref", value="2", type="int") |
| 34 |
self.expect_var_path("-ref", value="-2", type="int") |
| 35 |
self.expect_var_path("+0.0", value="0") |
| 36 |
self.expect_var_path("-0.0", value="-0") |
| 37 |
self.expect_var_path("+enum_one", value="1") |
| 38 |
self.expect_var_path("-enum_one", value="-1") |
| 39 |
self.expect_var_path("+wchar", value="1") |
| 40 |
self.expect_var_path("+char16", value="2") |
| 41 |
self.expect_var_path("+char32", value="3") |
| 42 |
self.expect_var_path("-bitfield.a", value="-1", type="int") |
| 43 |
self.expect_var_path("+bitfield.a", value="1", type="int") |
| 44 |
self.expect_var_path("+bitfield.b", value="2", type="int") |
| 45 |
self.expect_var_path("+bitfield.c", value="3", type="unsigned int") |
| 46 |
self.expect_var_path("+bitfield.d", value="4", type="uint64_t") |