]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / lang / objc / forward-decl / TestForwardDecl.py
1 """Test that a forward-declared class works when its complete definition is in a library"""
2
3 from __future__ import print_function
4
5
6
7 import os, time
8 import lldb
9 from lldbsuite.test.lldbtest import *
10 import lldbsuite.test.lldbutil as lldbutil
11
12 class ForwardDeclTestCase(TestBase):
13
14     mydir = TestBase.compute_mydir(__file__)
15
16     def setUp(self):
17         # Call super's setUp().
18         TestBase.setUp(self)
19         # Find the line number to break inside main().
20         self.source = 'main.m'
21         self.line = line_number(self.source, '// Set breakpoint 0 here.')
22         self.shlib_names = ["Container"]
23
24     @skipUnlessDarwin
25     def test_expr(self):
26         self.build()
27         
28         # Create a target by the debugger.
29         target = self.dbg.CreateTarget("a.out")
30         self.assertTrue(target, VALID_TARGET)
31
32         # Create the breakpoint inside function 'main'.
33         breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
34         self.assertTrue(breakpoint, VALID_BREAKPOINT)
35         
36         # Register our shared libraries for remote targets so they get automatically uploaded
37         environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
38
39         # Now launch the process, and do not stop at entry point.
40         process = target.LaunchSimple (None, environment, self.get_process_working_directory())
41         self.assertTrue(process, PROCESS_IS_VALID)
42
43         # The stop reason of the thread should be breakpoint.
44         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
45             substrs = ['stopped',
46                        'stop reason = breakpoint'])
47
48         # The breakpoint should have a hit count of 1.
49         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
50             substrs = [' resolved, hit count = 1'])
51
52         # This should display correctly.
53         self.expect("expression [j getMember]", VARIABLES_DISPLAYED_CORRECTLY,
54             substrs = ["= 0x"])