• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Test some lldb command abbreviations.
3"""
4
5
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class FatArchiveTestCase(TestBase):
13
14    mydir = TestBase.compute_mydir(__file__)
15
16    NO_DEBUG_INFO_TESTCASE = True
17
18    @skipUnlessDarwin
19    def test_breakpoint_resolution_dwarf(self):
20        if self.getArchitecture() == 'x86_64':
21            self.build()
22            self.main()
23        else:
24            self.skipTest(
25                "This test requires x86_64 as the architecture for the inferior")
26
27    def main(self):
28        '''This test compiles a quick example by making a fat file (universal) full of
29        skinny .o files and makes sure we can use them to resolve breakpoints when doing
30        DWARF in .o file debugging. The only thing this test needs to do is to compile and
31        set a breakpoint in the target and verify any breakpoint locations have valid debug
32        info for the function, and source file and line.'''
33        exe = self.getBuildArtifact("a.out")
34
35        # Create the target
36        target = self.dbg.CreateTarget(exe)
37
38        # Create a breakpoint by name
39        breakpoint = target.BreakpointCreateByName('foo', exe)
40        self.assertTrue(breakpoint, VALID_BREAKPOINT)
41
42        # Make sure the breakpoint resolves to a function, file and line
43        for bp_loc in breakpoint:
44            # Get a section offset address (lldb.SBAddress) from the breakpoint
45            # location
46            bp_loc_addr = bp_loc.GetAddress()
47            line_entry = bp_loc_addr.GetLineEntry()
48            function = bp_loc_addr.GetFunction()
49            self.assertTrue(
50                function.IsValid(),
51                "Verify breakpoint in fat BSD archive has valid function debug info")
52            self.assertTrue(
53                line_entry.GetFileSpec(),
54                "Verify breakpoint in fat BSD archive has source file information")
55            self.assertTrue(
56                line_entry.GetLine() != 0,
57                "Verify breakpoint in fat BSD archive has source line information")
58