brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · e66ab4f Raw
61 lines · python
1"""Test that forward declaration of a c++ template gets resolved correctly."""2 3import lldb4from lldbsuite.test.lldbtest import *5from lldbsuite.test.decorators import *6import lldbsuite.test.lldbutil as lldbutil7 8 9class ForwardDeclarationTestCase(TestBase):10    def do_test(self, dictionary=None):11        """Display *bar_ptr when stopped on a function with forward declaration of struct bar."""12        self.build(dictionary=dictionary)13        exe = self.getBuildArtifact("a.out")14        target = self.dbg.CreateTarget(exe)15        self.assertTrue(target, VALID_TARGET)16 17        environment = self.registerSharedLibrariesWithTarget(target, ["foo"])18 19        # Break inside the foo function which takes a bar_ptr argument.20        lldbutil.run_break_set_by_symbol(self, "foo", num_expected_locations=1)21 22        process = target.LaunchSimple(23            None, environment, self.get_process_working_directory()24        )25        self.assertTrue(process, PROCESS_IS_VALID)26 27        # The stop reason of the thread should be breakpoint.28        self.expect(29            "thread list",30            STOPPED_DUE_TO_BREAKPOINT,31            substrs=["stopped", "stop reason = breakpoint"],32        )33 34        # The breakpoint should have a hit count of 1.35        lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1)36 37        self.expect_expr(38            "*bar_ptr",39            result_type="bar<int>",40            result_children=[ValueCheck(value="47", name="a", type="int")],41        )42 43    def test(self):44        self.do_test()45 46    @no_debug_info_test47    @skipIfDarwin48    @skipIf(compiler=no_match("clang"))49    @skipIf(compiler_version=["<", "8.0"])50    def test_debug_names(self):51        """Test that we are able to find complete types when using DWARF v552        accelerator tables"""53        self.do_test(dict(CFLAGS_EXTRAS="-gdwarf-5 -gpubnames"))54 55    @no_debug_info_test56    @skipIf(compiler=no_match("clang"))57    def test_simple_template_names(self):58        """Test that we are able to find complete types when using DWARF v559        accelerator tables"""60        self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names"))61