brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · b6b6f1d Raw
60 lines · python
1"""Test that forward declaration of a data structure gets resolved correctly."""2 3 4import lldb5from lldbsuite.test.lldbtest import *6from lldbsuite.test.decorators import *7import lldbsuite.test.lldbutil as lldbutil8 9 10class ForwardDeclarationTestCase(TestBase):11    def do_test(self, dictionary=None):12        """Display *bar_ptr when stopped on a function with forward declaration of struct bar."""13        self.build(dictionary=dictionary)14        exe = self.getBuildArtifact("a.out")15        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)16 17        # Break inside the foo function which takes a bar_ptr argument.18        lldbutil.run_break_set_by_symbol(19            self, "foo", num_expected_locations=1, sym_exact=True20        )21 22        self.runCmd("run", RUN_SUCCEEDED)23 24        # The stop reason of the thread should be breakpoint.25        self.expect(26            "thread list",27            STOPPED_DUE_TO_BREAKPOINT,28            substrs=["stopped", "stop reason = breakpoint"],29        )30 31        # The breakpoint should have a hit count of 1.32        lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1)33 34        # This should display correctly.35        # Note that the member fields of a = 1 and b = 2 is by design.36        self.expect(37            "frame variable --show-types *bar_ptr",38            VARIABLES_DISPLAYED_CORRECTLY,39            substrs=["(bar) *bar_ptr = ", "(int) a = 1", "(int) b = 2"],40        )41 42        # And so should this.43        self.expect(44            "expression --show-types -- *bar_ptr",45            VARIABLES_DISPLAYED_CORRECTLY,46            substrs=["(bar)", "(int) a = 1", "(int) b = 2"],47        )48 49    def test(self):50        self.do_test()51 52    @no_debug_info_test53    @skipIfDarwin54    @skipIf(compiler=no_match("clang"))55    @skipIf(compiler_version=["<", "8.0"])56    def test_debug_names(self):57        """Test that we are able to find complete types when using DWARF v558        accelerator tables"""59        self.do_test(dict(CFLAGS_EXTRAS="-gdwarf-5 -gpubnames"))60