60 lines · python
1"""2Test some lldb command abbreviations.3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class FatArchiveTestCase(TestBase):13 NO_DEBUG_INFO_TESTCASE = True14 15 @skipUnlessDarwin16 def test_breakpoint_resolution_dwarf(self):17 if self.getArchitecture() == "x86_64":18 self.build()19 self.main()20 else:21 self.skipTest(22 "This test requires x86_64 as the architecture for the inferior"23 )24 25 def main(self):26 """This test compiles a quick example by making a fat file (universal) full of27 skinny .o files and makes sure we can use them to resolve breakpoints when doing28 DWARF in .o file debugging. The only thing this test needs to do is to compile and29 set a breakpoint in the target and verify any breakpoint locations have valid debug30 info for the function, and source file and line."""31 exe = self.getBuildArtifact("a.out")32 33 # Create the target34 target = self.dbg.CreateTarget(exe)35 36 # Create a breakpoint by name37 breakpoint = target.BreakpointCreateByName("foo", exe)38 self.assertTrue(breakpoint, VALID_BREAKPOINT)39 40 # Make sure the breakpoint resolves to a function, file and line41 for bp_loc in breakpoint:42 # Get a section offset address (lldb.SBAddress) from the breakpoint43 # location44 bp_loc_addr = bp_loc.GetAddress()45 line_entry = bp_loc_addr.GetLineEntry()46 function = bp_loc_addr.GetFunction()47 self.assertTrue(48 function.IsValid(),49 "Verify breakpoint in fat BSD archive has valid function debug info",50 )51 self.assertTrue(52 line_entry.GetFileSpec(),53 "Verify breakpoint in fat BSD archive has source file information",54 )55 self.assertNotEqual(56 line_entry.GetLine(),57 0,58 "Verify breakpoint in fat BSD archive has source line information",59 )60