1"""Test that forward declarations don't cause bogus conflicts in namespaced types""" 2 3 4import lldb 5from lldbsuite.test.lldbtest import * 6from lldbsuite.test.decorators import * 7import lldbsuite.test.lldbutil as lldbutil 8 9 10class NamespaceDefinitionsTestCase(TestBase): 11 # See also llvm.org/pr28948 12 @expectedFailureAll(bugnumber="llvm.org/pr50814", compiler="gcc") 13 @expectedFailureAll( 14 bugnumber="llvm.org/pr28948", 15 oslist=["linux"], 16 compiler="gcc", 17 archs=["arm", "aarch64"], 18 ) 19 @expectedFailureAll(oslist=["windows"]) 20 def test_expr(self): 21 self.build() 22 self.common_setup() 23 24 self.expect( 25 "expression -- Foo::MyClass()", 26 VARIABLES_DISPLAYED_CORRECTLY, 27 substrs=["thing = "], 28 ) 29 30 def setUp(self): 31 # Call super's setUp(). 32 TestBase.setUp(self) 33 # Find the line number to break inside main(). 34 self.source = "main.cpp" 35 self.line = line_number(self.source, "// Set breakpoint here") 36 self.shlib_names = ["a", "b"] 37 38 def common_setup(self): 39 # Run in synchronous mode 40 self.dbg.SetAsync(False) 41 42 # Create a target by the debugger. 43 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) 44 self.assertTrue(target, VALID_TARGET) 45 46 # Break inside the foo function which takes a bar_ptr argument. 47 lldbutil.run_break_set_by_file_and_line( 48 self, self.source, self.line, num_expected_locations=1, loc_exact=True 49 ) 50 51 # Register our shared libraries for remote targets so they get 52 # automatically uploaded 53 environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names) 54 55 # Now launch the process, and do not stop at entry point. 56 process = target.LaunchSimple( 57 None, environment, self.get_process_working_directory() 58 ) 59 self.assertTrue(process, PROCESS_IS_VALID) 60 61 # The stop reason of the thread should be breakpoint. 62 self.expect( 63 "thread list", 64 STOPPED_DUE_TO_BREAKPOINT, 65 substrs=["stopped", "stop reason = breakpoint"], 66 ) 67 68 # The breakpoint should have a hit count of 1. 69 lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1) 70