1 """Test that forward declaration of a data structure gets resolved correctly."""
3 from __future__ import print_function
9 from lldbsuite.test.lldbtest import *
10 import lldbsuite.test.lldbutil as lldbutil
12 class ForwardDeclarationTestCase(TestBase):
14 mydir = TestBase.compute_mydir(__file__)
16 def test_and_run_command(self):
17 """Display *bar_ptr when stopped on a function with forward declaration of struct bar."""
19 exe = os.path.join(os.getcwd(), "a.out")
20 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
22 # Break inside the foo function which takes a bar_ptr argument.
23 lldbutil.run_break_set_by_symbol (self, "foo", num_expected_locations=1, sym_exact=True)
25 self.runCmd("run", RUN_SUCCEEDED)
27 # The stop reason of the thread should be breakpoint.
28 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
30 'stop reason = breakpoint'])
32 # The breakpoint should have a hit count of 1.
33 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
34 substrs = [' resolved, hit count = 1'])
36 # This should display correctly.
37 # Note that the member fields of a = 1 and b = 2 is by design.
38 self.expect("frame variable --show-types *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
39 substrs = ['(bar) *bar_ptr = ',
44 self.expect("expression --show-types -- *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,