2 Check that SBValue.GetValueAsSigned() does the right thing for a 32-bit -1.
5 from __future__ import print_function
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
15 class Radar12481949DataFormatterTestCase(TestBase):
17 # test for rdar://problem/12481949
18 mydir = TestBase.compute_mydir(__file__)
21 # Call super's setUp().
23 # Find the line number to break at.
24 self.line = line_number('main.cpp', '// Set break point at this line.')
26 def test_with_run_command(self):
27 """Check that SBValue.GetValueAsSigned() does the right thing for a 32-bit -1."""
29 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
31 lldbutil.run_break_set_by_file_and_line(
32 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
34 self.runCmd("run", RUN_SUCCEEDED)
36 # The stop reason of the thread should be breakpoint.
37 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
39 'stop reason = breakpoint'])
41 # This is the function to remove the custom formats in order to have a
42 # clean slate for the next test case.
44 self.runCmd('type format delete hex', check=False)
45 self.runCmd('type summary clear', check=False)
47 # Execute the cleanup function during test case tear down.
48 self.addTearDownHook(cleanup)
51 self.frame().FindVariable("myvar").GetValueAsSigned() == -1,
52 "GetValueAsSigned() says -1")
54 self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFF,
55 "GetValueAsSigned() does not say 0xFFFFFFFF")
57 self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFFFFFFFFFF,
58 "GetValueAsSigned() does not say 0xFFFFFFFFFFFFFFFF")
61 self.frame().FindVariable("myvar").GetValueAsUnsigned() != -1,
62 "GetValueAsUnsigned() does not say -1")
64 self.frame().FindVariable("myvar").GetValueAsUnsigned() == 0xFFFFFFFF,
65 "GetValueAsUnsigned() says 0xFFFFFFFF")
67 self.frame().FindVariable("myvar").GetValueAsUnsigned() != 0xFFFFFFFFFFFFFFFF,
68 "GetValueAsUnsigned() does not says 0xFFFFFFFFFFFFFFFF")