This is an archive of the discontinued LLVM Phabricator instance.

Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly
ClosedPublic

Authored by clayborg on Mar 14 2018, 4:21 PM.

Details

Summary

When using:

(lldb) settings set target.source-map ./ /path/to/source

LLDB would fail to set a source file and line breakpoint with:

(lldb) breakpoint set --file /path/to/source/main.c --line 2

Because code in the target was undoing the remapping of "/path/to/source/main.c" to "./main.c" and then it would resolve this path, which would append the current working directory to the path. We don't want to resolve paths that we unmap.

Test case added.

Diff Detail

Repository
rL LLVM

Event Timeline

clayborg created this revision.Mar 14 2018, 4:21 PM

The DWARF file that this produces has a DW_AT_comp_dir set to ".". This is similar to how some builds work at Facebook when using Buck to build things.

jingham accepted this revision.Mar 14 2018, 4:37 PM

This seems clearly right to me. Thanks for the test.

This revision is now accepted and ready to land.Mar 14 2018, 4:37 PM
davide accepted this revision.Mar 14 2018, 4:40 PM
davide added a subscriber: davide.

LGTM, thanks

(please wait a day or two if @labath has comments) but this should be fine.

Committed revision 327600.

This revision was automatically updated to reflect the committed changes.

I think a .ll file would be better abstraction level for this test. You can still hardcode all the paths needed for the test while avoiding spelling out the irrelevant details like debug info abbreviations. But I guess this will work as well...