]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / fat_archives / TestFatArchives.py
1 """
2 Test some lldb command abbreviations.
3 """
4 from __future__ import print_function
5
6
7
8 import lldb
9 import os
10 import time
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
13 import lldbsuite.support.seven as seven
14
15 def execute_command (command):
16     # print('%% %s' % (command))
17     (exit_status, output) = seven.get_command_status_output(command)
18     # if output:
19     #     print(output)
20     # print('status = %u' % (exit_status))
21     return exit_status
22
23 class FatArchiveTestCase(TestBase):
24
25     mydir = TestBase.compute_mydir(__file__)
26
27     @skipUnlessDarwin
28     def test (self):
29         if self.getArchitecture() == 'x86_64':
30             execute_command ("make CC='%s'" % (os.environ["CC"]))
31             self.main ()
32         else:
33             self.skipTest("This test requires x86_64 as the architecture for the inferior")
34
35     def main (self):
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")
42         
43         # Create the target
44         target = self.dbg.CreateTarget(exe)
45         
46         # Create a breakpoint by name
47         breakpoint = target.BreakpointCreateByName ('foo', exe)
48         self.assertTrue(breakpoint, VALID_BREAKPOINT)
49
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")