[Lldb-commits] [lldb] r331637 - Fix "file ./a.out" and file "../a.out" so that is works after recent FileSpec normalization path changes.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon May 7 07:21:04 PDT 2018


Author: gclayton
Date: Mon May  7 07:21:04 2018
New Revision: 331637

URL: http://llvm.org/viewvc/llvm-project?rev=331637&view=rev
Log:
Fix "file ./a.out" and file "../a.out" so that is works after recent FileSpec normalization path changes.

Test coming soon, but I want to unbreak people.


Modified:
    lldb/trunk/source/Target/TargetList.cpp

Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=331637&r1=331636&r2=331637&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Mon May  7 07:21:04 2018
@@ -367,16 +367,12 @@ Status TargetList::CreateTargetInternal(
       user_exe_path_is_bundle = true;
 
     if (file.IsRelative() && !user_exe_path.empty()) {
-      // Ignore paths that start with "./" and "../"
-      if (!user_exe_path.startswith("./") && !user_exe_path.startswith("../")) {
-        llvm::SmallString<64> cwd;
-        if (! llvm::sys::fs::current_path(cwd)) {
-          cwd += '/';
-          cwd += user_exe_path;
-          FileSpec cwd_file(cwd, false);
-          if (cwd_file.Exists())
-            file = cwd_file;
-        }
+      llvm::SmallString<64> cwd;
+      if (! llvm::sys::fs::current_path(cwd)) {
+        FileSpec cwd_file(cwd.c_str(), false);
+        cwd_file.AppendPathComponent(file);
+        if (cwd_file.Exists())
+          file = cwd_file;
       }
     }
 




More information about the lldb-commits mailing list