xref: /llvm-project/lldb/test/API/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1""" Testing debugging of a binary with "mixed" dwarf (with/without fission). """
2import lldb
3from lldbsuite.test.decorators import *
4from lldbsuite.test.lldbtest import *
5from lldbsuite.test import lldbutil
6
7
8class TestMixedDwarfBinary(TestBase):
9    @no_debug_info_test  # Prevent the genaration of the dwarf version of this test
10    @add_test_categories(["dwo"])
11    @skipUnlessPlatform(["linux"])
12    def test_mixed_dwarf(self):
13        """Test that 'frame variable' works
14        for the executable built from two source files compiled
15        with/whithout -gsplit-dwarf correspondingly."""
16
17        self.build()
18        exe = self.getBuildArtifact("a.out")
19
20        self.target = self.dbg.CreateTarget(exe)
21        self.assertTrue(self.target, VALID_TARGET)
22
23        main_bp = self.target.BreakpointCreateByName("g", "a.out")
24        self.assertTrue(main_bp, VALID_BREAKPOINT)
25
26        self.process = self.target.LaunchSimple(
27            None, None, self.get_process_working_directory()
28        )
29        self.assertTrue(self.process, PROCESS_IS_VALID)
30
31        # The stop reason of the thread should be breakpoint.
32        self.assertState(
33            self.process.GetState(), lldb.eStateStopped, STOPPED_DUE_TO_BREAKPOINT
34        )
35
36        frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0)
37        x = frame.FindVariable("x")
38        self.assertTrue(x.IsValid(), "x is not valid")
39        y = frame.FindVariable("y")
40        self.assertTrue(y.IsValid(), "y is not valid")
41