From 773dd0e6e632d48d7123a321ba86f50847b9afc0 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 2 May 2017 18:31:19 +0000 Subject: Vendor import of lldb trunk r301939: https://llvm.org/svn/llvm-project/lldb/trunk@301939 --- .../test/lang/c/shared_lib/TestSharedLib.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'packages/Python/lldbsuite/test/lang/c') diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py index 61a67dc13987..edc83bf58985 100644 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py +++ b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py @@ -13,14 +13,13 @@ class SharedLibTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - def test_expr(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" + def common_test_expr(self, preload_symbols): if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion(): self.skipTest( "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef") self.build() - self.common_setup() + self.common_setup(preload_symbols) # This should display correctly. self.expect( @@ -31,6 +30,18 @@ class SharedLibTestCase(TestBase): "(sub_foo)", "other_element = 3"]) + self.expect( + "expression GetMeASubFoo(my_foo_ptr)", + startstr="(sub_foo *) $") + + def test_expr(self): + """Test that types work when defined in a shared library and forward-declared in the main executable""" + self.common_test_expr(True) + + def test_expr_no_preload(self): + """Test that types work when defined in a shared library and forward-declared in the main executable, but with preloading disabled""" + self.common_test_expr(False) + @unittest2.expectedFailure("rdar://problem/10704639") def test_frame_variable(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" @@ -54,7 +65,7 @@ class SharedLibTestCase(TestBase): self.line = line_number(self.source, '// Set breakpoint 0 here.') self.shlib_names = ["foo"] - def common_setup(self): + def common_setup(self, preload_symbols = True): # Run in synchronous mode self.dbg.SetAsync(False) @@ -62,6 +73,8 @@ class SharedLibTestCase(TestBase): target = self.dbg.CreateTarget("a.out") self.assertTrue(target, VALID_TARGET) + self.runCmd("settings set target.preload-symbols " + str(preload_symbols).lower()) + # Break inside the foo function which takes a bar_ptr argument. lldbutil.run_break_set_by_file_and_line( self, self.source, self.line, num_expected_locations=1, loc_exact=True) -- cgit v1.2.3