[Lldb-commits] [PATCH] D47021: Fix PathMappingList for relative and empty paths after recent FileSpec normalization changes

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri May 18 10:50:39 PDT 2018

clayborg added a comment.

I will make the fixes and also test out mapping "" to "." as suggested.

Comment at: source/Target/PathMappingList.cpp:194
+      // path and any path we appended would end up being relative.
+      fixed.SetFile(path_ref, false);
+    } else {
When I thought about it, I chose to not convert to "." for path remapping. I think people would expect if the remap "" to "/prefix" that "/prefix" would be prepended to each path no matter what it is. Of course users could just specify "/" if they wish for a prefix. I could see this going either way. Let me know what you think.

Comment at: unittests/Utility/PathMappingListTest.cpp:86
+    {"/old/foo.c/.", "/new/old/foo.c"},
+    {"/old/./foo.c", "/new/old/foo.c"},
+  };
labath wrote:
> How does this work for relative paths? I take it `foo.c` should be remapped to `/new/foo.c` ? Can you add a test for that?
It doesn't work. If "foo.c" would map to "/new/foo.c", we can unmap it correctly since it would unmap to "/foo.c". Both "foo.c" and "/foo.c" would map to to "/new/foo.c" and then we can only unmap the latter correctly. 

This might bode well for saying that "" should map to "." actually. Then we won't run into this situation. I will test things out with "" mapping to "." and see how things go.


More information about the lldb-commits mailing list