Skip to content

Commit 30d1661

Browse files
authored
Merge pull request swiftlang#1271 from jimingham/relative-source-map
apple-llvm-split-commit: 6290e3b86c3f55fffa0efb0bc294ca29450dd07e apple-llvm-split-dir: lldb/
2 parents ec6db2e + 0949a92 commit 30d1661

File tree

4 files changed

+290
-248
lines changed

4 files changed

+290
-248
lines changed

lldb/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,29 @@ def test_source_map(self):
1515
src_path = os.path.join(src_dir, "main.c")
1616
yaml_path = os.path.join(src_dir, "a.yaml")
1717
yaml_base, ext = os.path.splitext(yaml_path)
18-
obj_path = self.getBuildArtifact(yaml_base)
18+
obj_path = self.getBuildArtifact("main.o")
1919
self.yaml2obj(yaml_path, obj_path)
2020

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-
2821
# Create a target with the object file we just created from YAML
2922
target = self.dbg.CreateTarget(obj_path)
3023

3124
# Set a breakpoint before we remap source and verify that it fails
3225
bp = target.BreakpointCreateByLocation(src_path, 2)
3326
self.assertTrue(bp.GetNumLocations() == 0,
3427
"make sure no breakpoints were resolved without map")
35-
src_map_cmd = 'settings set target.source-map ./ "%s"' % (src_dir)
28+
src_map_cmd = 'settings set target.source-map . "%s"' % (src_dir)
3629
self.dbg.HandleCommand(src_map_cmd)
3730

3831
# Set a breakpoint after we remap source and verify that it succeeds
3932
bp = target.BreakpointCreateByLocation(src_path, 2)
4033
self.assertTrue(bp.GetNumLocations() == 1,
4134
"make sure breakpoint was resolved with map")
35+
36+
# Now make sure that we can actually FIND the source file using this
37+
# remapping:
38+
retval = lldb.SBCommandReturnObject()
39+
self.dbg.GetCommandInterpreter().HandleCommand("source list -f main.c -l 2", retval)
40+
self.assertTrue(retval.Succeeded(), "source list didn't succeed.")
41+
self.assertTrue(retval.GetOutput() != None, "We got no ouput from source list")
42+
self.assertTrue("return" in retval.GetOutput(), "We didn't find the source file...")
43+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
int main()
2+
{
3+
return 0;
4+
}
5+
int main () {
6+
return 0;
7+
}

0 commit comments

Comments
 (0)