1 """Test that types defined in shared libraries with stripped symbols work correctly."""
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class SharedLibStrippedTestCase(TestBase):
14 mydir = TestBase.compute_mydir(__file__)
16 @expectedFailureAll(oslist=["windows"])
18 """Test that types work when defined in a shared library and forwa/d-declared in the main executable"""
19 if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
21 "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
26 # This should display correctly.
28 "expression --show-types -- *my_foo_ptr",
29 VARIABLES_DISPLAYED_CORRECTLY,
35 @expectedFailureAll(oslist=["windows"])
36 @unittest2.expectedFailure("llvm.org/PR36712")
37 def test_frame_variable(self):
38 """Test that types work when defined in a shared library and forward-declared in the main executable"""
42 # This should display correctly.
44 "frame variable --show-types -- *my_foo_ptr",
45 VARIABLES_DISPLAYED_CORRECTLY,
52 # Call super's setUp().
54 # Find the line number to break inside main().
55 self.source = 'main.c'
56 self.line = line_number(self.source, '// Set breakpoint 0 here.')
57 self.shlib_names = ["foo"]
59 def common_setup(self):
60 # Run in synchronous mode
61 self.dbg.SetAsync(False)
63 # Create a target by the debugger.
64 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
65 self.assertTrue(target, VALID_TARGET)
67 # Break inside the foo function which takes a bar_ptr argument.
68 lldbutil.run_break_set_by_file_and_line(
69 self, self.source, self.line, num_expected_locations=1, loc_exact=True)
71 # Register our shared libraries for remote targets so they get
72 # automatically uploaded
73 environment = self.registerSharedLibrariesWithTarget(
74 target, self.shlib_names)
76 # Now launch the process, and do not stop at entry point.
77 process = target.LaunchSimple(
78 None, environment, self.get_process_working_directory())
79 self.assertTrue(process, PROCESS_IS_VALID)
81 # The stop reason of the thread should be breakpoint.
82 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
84 'stop reason = breakpoint'])
86 # The breakpoint should have a hit count of 1.
87 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
88 substrs=[' resolved, hit count = 1'])