1import lldb 2from lldbsuite.test.lldbtest import * 3from lldbsuite.test.decorators import * 4 5# This test checks that source code location is shown correctly 6# when DWARF5 debug information is used. 7 8class TestTargetSourceMap(TestBase): 9 10 mydir = TestBase.compute_mydir(__file__) 11 12 @skipIf(archs="aarch64", oslist="linux", 13 bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44180") 14 def test_source_map(self): 15 # Set the target soure map to map "./" to the current test directory. 16 yaml_path = os.path.join(self.getSourceDir(), "a.yaml") 17 yaml_base, ext = os.path.splitext(yaml_path) 18 obj_path = self.getBuildArtifact(yaml_base) 19 self.yaml2obj(yaml_path, obj_path) 20 21 def cleanup(): 22 if os.path.exists(obj_path): 23 os.unlink(obj_path) 24 25 # Execute the cleanup function during test case tear down. 26 self.addTearDownHook(cleanup) 27 28 # Create a target with the object file we just created from YAML 29 target = self.dbg.CreateTarget(obj_path) 30 31 # Check we are able to show the locations properly. 32 self.expect("b main", VALID_BREAKPOINT_LOCATION, 33 substrs=['main + 13 at test.cpp:2:3, address = 0x000000000040052d']) 34 35 self.expect("b foo", VALID_BREAKPOINT_LOCATION, 36 substrs=['foo() + 4 at test.cpp:6:1, address = 0x0000000000400534']) 37