2 Test that variables with unsigned types display correctly.
5 from __future__ import print_function
12 from lldbsuite.test.lldbtest import *
13 import lldbsuite.test.lldbutil as lldbutil
15 class UnsignedTypesTestCase(TestBase):
17 mydir = TestBase.compute_mydir(__file__)
20 # Call super's setUp().
22 # Find the line number to break inside main().
23 self.line = line_number('main.cpp', '// Set break point at this line.')
26 """Test that variables with unsigned types display correctly."""
28 exe = os.path.join(os.getcwd(), "a.out")
29 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
31 # GCC puts a breakpoint on the last line of a multi-line expression, so
32 # if GCC is the target compiler, we cannot rely on an exact line match.
33 need_exact = "gcc" not in self.getCompiler()
34 # Break on line 19 in main() aftre the variables are assigned values.
35 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=need_exact)
37 self.runCmd("run", RUN_SUCCEEDED)
39 # The stop reason of the thread should be breakpoint.
40 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
41 substrs = ['stopped', 'stop reason = breakpoint'])
43 # The breakpoint should have a hit count of 1.
44 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
45 substrs = [' resolved, hit count = 1'])
47 # Test that unsigned types display correctly.
48 self.expect("frame variable --show-types --no-args", VARIABLES_DISPLAYED_CORRECTLY,
49 startstr = "(unsigned char) the_unsigned_char = 'c'",
50 patterns = ["\((short unsigned int|unsigned short)\) the_unsigned_short = 99"],
51 substrs = ["(unsigned int) the_unsigned_int = 99",
52 "(unsigned long) the_unsigned_long = 99",
53 "(unsigned long long) the_unsigned_long_long = 99",
54 "(uint32_t) the_uint32 = 99"])