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    mydir = TestBase.compute_mydir(__file__)
10
11    @no_debug_info_test  # Prevent the genaration of the dwarf version of this test
12    @add_test_categories(["dwo"])
13    @skipUnlessPlatform(["linux"])
14    def test_mixed_dwarf(self):
15        """Test that 'frame variable' works
16        for the executable built from two source files compiled
17        with/whithout -gsplit-dwarf correspondingly."""
18
19        self.build()
20        exe = self.getBuildArtifact("a.out")
21
22        self.target = self.dbg.CreateTarget(exe)
23        self.assertTrue(self.target, VALID_TARGET)
24
25        main_bp = self.target.BreakpointCreateByName("g", "a.out")
26        self.assertTrue(main_bp, VALID_BREAKPOINT)
27
28        self.process = self.target.LaunchSimple(
29            None, None, self.get_process_working_directory())
30        self.assertTrue(self.process, PROCESS_IS_VALID)
31
32        # The stop reason of the thread should be breakpoint.
33        self.assertEquals(self.process.GetState(), lldb.eStateStopped,
34                        STOPPED_DUE_TO_BREAKPOINT)
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
42