[Lldb-commits] [PATCH] D112439: normalize file path when searching the source map

Xu Jun via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 25 04:55:42 PDT 2021


xujuntwt95329 created this revision.
xujuntwt95329 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The key stored in the source map is a normalized path string with host's
path style, so it is also necessary to normalize the file path during
searching the map


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112439

Files:
  lldb/source/Target/PathMappingList.cpp


Index: lldb/source/Target/PathMappingList.cpp
===================================================================
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -218,7 +218,12 @@
 }
 
 llvm::Optional<FileSpec> PathMappingList::FindFile(const FileSpec &orig_spec) const {
-  if (auto remapped = RemapPath(orig_spec.GetPath(), /*only_if_exists=*/true))
+  // We must normalize the orig_spec again using the host's path style,
+  // otherwise there will be mismatch between the host and remote platform
+  // if they use different path styles.
+  if (auto remapped = RemapPath(
+          NormalizePath(ConstString(orig_spec.GetCString())).GetStringRef(),
+          /*only_if_exists=*/true))
     return remapped;
 
   return {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112439.381939.patch
Type: text/x-patch
Size: 770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211025/0211f973/attachment-0001.bin>


More information about the lldb-commits mailing list