1 """Look up enum type information and check for correct display."""
3 from __future__ import print_function
9 from lldbsuite.test.lldbtest import *
10 import lldbsuite.test.lldbutil as lldbutil
12 class EnumTypesTestCase(TestBase):
14 mydir = TestBase.compute_mydir(__file__)
17 # Call super's setUp().
19 # Find the line number to break inside main().
20 self.line = line_number('main.c', '// Set break point at this line.')
23 """Test 'image lookup -t days' and check for correct display and enum value printing."""
25 exe = os.path.join(os.getcwd(), "a.out")
26 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
28 # Break inside the main.
29 bkpt_id = lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
31 self.runCmd("run", RUN_SUCCEEDED)
33 # The stop reason of the thread should be breakpoint.
34 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
36 'stop reason = breakpoint'])
38 # The breakpoint should have a hit count of 1.
39 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
40 substrs = [' resolved, hit count = 1'])
42 # Look up information about the 'days' enum type.
43 # Check for correct display.
44 self.expect("image lookup -t days", DATA_TYPES_DISPLAYED_CORRECTLY,
45 substrs = ['enum days {',
67 bkpt = self.target().FindBreakpointByID(bkpt_id)
68 for enum_value in enum_values:
69 self.expect("frame variable day", 'check for valid enumeration value',
70 substrs = [enum_value])
71 lldbutil.continue_to_breakpoint (self.process(), bkpt)