2 Test some lldb command abbreviations.
4 from __future__ import print_function
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
13 import lldbsuite.support.seven as seven
15 def execute_command (command):
16 # print('%% %s' % (command))
17 (exit_status, output) = seven.get_command_status_output(command)
20 # print('status = %u' % (exit_status))
23 class FatArchiveTestCase(TestBase):
25 mydir = TestBase.compute_mydir(__file__)
29 if self.getArchitecture() == 'x86_64':
30 execute_command ("make CC='%s'" % (os.environ["CC"]))
33 self.skipTest("This test requires x86_64 as the architecture for the inferior")
36 '''This test compiles a quick example by making a fat file (universal) full of
37 skinny .o files and makes sure we can use them to resolve breakpoints when doing
38 DWARF in .o file debugging. The only thing this test needs to do is to compile and
39 set a breakpoint in the target and verify any breakpoint locations have valid debug
40 info for the function, and source file and line.'''
41 exe = os.path.join (os.getcwd(), "a.out")
44 target = self.dbg.CreateTarget(exe)
46 # Create a breakpoint by name
47 breakpoint = target.BreakpointCreateByName ('foo', exe)
48 self.assertTrue(breakpoint, VALID_BREAKPOINT)
50 # Make sure the breakpoint resolves to a function, file and line
51 for bp_loc in breakpoint:
52 # Get a section offset address (lldb.SBAddress) from the breakpoint location
53 bp_loc_addr = bp_loc.GetAddress()
54 line_entry = bp_loc_addr.GetLineEntry()
55 function = bp_loc_addr.GetFunction()
56 self.assertTrue(function.IsValid(), "Verify breakpoint in fat BSD archive has valid function debug info")
57 self.assertTrue(line_entry.GetFileSpec(), "Verify breakpoint in fat BSD archive has source file information")
58 self.assertTrue(line_entry.GetLine() != 0, "Verify breakpoint in fat BSD archive has source line information")