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