brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · ebd9e66 Raw
52 lines · python
1import lldb2from lldbsuite.test.decorators import *3from lldbsuite.test.lldbtest import *4from lldbsuite.test import lldbutil5 6 7class TestWithLimitDebugInfo(TestBase):8    def _run_test(self, build_dict):9        self.build(dictionary=build_dict)10 11        # Get the path of the executable12        exe_path = self.getBuildArtifact("a.out")13 14        # Load the executable15        target = self.dbg.CreateTarget(exe_path)16        self.assertTrue(target.IsValid(), VALID_TARGET)17 18        # Break on main function19        lldbutil.run_break_set_by_file_and_line(20            self, "derived.h", line_number("derived.h", "// break1")21        )22        lldbutil.run_break_set_by_file_and_line(23            self, "derived.h", line_number("derived.h", "// break2")24        )25 26        # Launch the process27        process = target.LaunchSimple(None, None, self.get_process_working_directory())28        self.assertTrue(process.IsValid(), PROCESS_IS_VALID)29 30        # Get the thread of the process31        self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)32 33        self.expect_expr("1", result_type="int", result_value="1")34        self.expect_expr("this", result_type="Foo *")35        self.expect_expr("this->x", result_type="int", result_value="12345")36 37        self.runCmd("continue")38 39        self.expect_expr("1", result_type="int", result_value="1")40        self.expect_expr("this", result_type="ns::Foo2 *")41        self.expect_expr("this->x", result_type="int", result_value="23456")42 43    @add_test_categories(["dwarf", "dwo"])44    def test_default(self):45        self._run_test(dict(CFLAGS_EXTRAS="$(LIMIT_DEBUG_INFO_FLAGS)"))46 47    @add_test_categories(["dwarf", "dwo"])48    def test_debug_names(self):49        self._run_test(50            dict(CFLAGS_EXTRAS="$(LIMIT_DEBUG_INFO_FLAGS) -gdwarf-5 -gpubnames")51        )52