<div dir="ltr">Ah, sorry. This was a side effect from reusing <span style="font-size:12.8000001907349px">FileSpec::</span>Dump for FileSpec::GetPath, since that was the original behavior of Dump.<div><br></div><div><a href="http://reviews.llvm.org/D9862">http://reviews.llvm.org/D9862</a> should address this, I'm going to run a few tests to check if anything relies on the trailing slash from Dump.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 19, 2015 at 7:38 AM, Colin Riley <span dir="ltr"><<a href="mailto:colin@codeplay.com" target="_blank">colin@codeplay.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">r236925 (below) seems to have some side effects on windows when combined with r232437 (Make ModuleList::GetSharedModule to use module_search_paths parameter.)<br>
<br>
-    if (m_directory)<br>
-        path.append(m_directory.GetCString(), m_directory.GetCString() + m_directory.GetLength());<br>
-    if (m_filename)<br>
-        llvm::sys::path::append(path, m_filename.GetCString());<br>
+    StreamString stream;<br>
+    Dump(&stream);<br>
+    path.append(stream.GetString().begin(), stream.GetString().end());<br>
<br>
<br>
Now a slash will appear at the end of a filespec path which references just a directory. On windows, ::stat fails when passed a path with trailing slash.<br>
<br>
This now, with changes from r232437 which checks for the existence of a directory, means no modules can be loaded from the search paths when launching a target using the dyld.<br>
<br>
If checking the existence of a filespec which refers to just a directory is a legitamate operation, there are various options for a fix. I've not fixed it immediately in case your use cases require something different. Given this doesn't seem to have failed any tests we may need to add some.<br>
<br>
Colin<br>
<br>
On 09/05/2015 02:21, Chaoren Lin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: chaoren<br>
Date: Fri May  8 20:21:32 2015<br>
New Revision: 236925<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=236925&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=236925&view=rev</a><br>
Log:<br>
Set path syntax for remote executable FileSpec.<br>
<br>
Reviewers: ovyalov, zturner<br>
<br>
Subscribers: lldb-commits<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D9579" target="_blank">http://reviews.llvm.org/D9579</a><br>
<br>
Modified:<br>
     lldb/trunk/include/lldb/Host/FileSpec.h<br>
     lldb/trunk/source/Host/common/FileSpec.cpp<br>
     lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br>
     lldb/trunk/source/Target/Target.cpp<br>
<br>
Modified: lldb/trunk/include/lldb/Host/FileSpec.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=236925&r1=236924&r2=236925&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=236925&r1=236924&r2=236925&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)<br>
+++ lldb/trunk/include/lldb/Host/FileSpec.h Fri May  8 20:21:32 2015<br>
@@ -78,6 +78,8 @@ public:<br>
      //------------------------------------------------------------------<br>
      explicit FileSpec (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);<br>
  +    explicit FileSpec (const char *path, bool resolve_path, ArchSpec arch);<br>
+<br>
      //------------------------------------------------------------------<br>
      /// Copy constructor<br>
      ///<br>
<br>
Modified: lldb/trunk/source/Host/common/FileSpec.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=236925&r1=236924&r2=236925&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=236925&r1=236924&r2=236925&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)<br>
+++ lldb/trunk/source/Host/common/FileSpec.cpp Fri May  8 20:21:32 2015<br>
@@ -27,6 +27,7 @@<br>
  #include <pwd.h><br>
  #endif<br>
  +#include "lldb/Core/ArchSpec.h"<br>
  #include "lldb/Core/DataBufferHeap.h"<br>
  #include "lldb/Core/DataBufferMemoryMap.h"<br>
  #include "lldb/Core/RegularExpression.h"<br>
@@ -201,6 +202,11 @@ FileSpec::FileSpec(const char *pathname,<br>
          SetFile(pathname, resolve_path, syntax);<br>
  }<br>
  +FileSpec::FileSpec(const char *pathname, bool resolve_path, ArchSpec arch) :<br>
+    FileSpec(pathname, resolve_path, arch.GetTriple().isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix)<br>
+{<br>
+}<br>
+<br>
  //------------------------------------------------------------------<br>
  // Copy constructor<br>
  //------------------------------------------------------------------<br>
@@ -605,11 +611,10 @@ FileSpec::RemoveBackupDots (const ConstS<br>
  void<br>
  FileSpec::Dump(Stream *s) const<br>
  {<br>
-    static ConstString g_slash_only ("/");<br>
      if (s)<br>
      {<br>
          m_directory.Dump(s);<br>
-        if (m_directory && m_directory != g_slash_only)<br>
+        if (m_directory && m_directory.GetStringRef().back() != '/')<br>
              s->PutChar('/');<br>
          m_filename.Dump(s);<br>
      }<br>
@@ -810,10 +815,9 @@ FileSpec::GetPath(bool denormalize) cons<br>
  void<br>
  FileSpec::GetPath(llvm::SmallVectorImpl<char> &path, bool denormalize) const<br>
  {<br>
-    if (m_directory)<br>
-        path.append(m_directory.GetCString(), m_directory.GetCString() + m_directory.GetLength());<br>
-    if (m_filename)<br>
-        llvm::sys::path::append(path, m_filename.GetCString());<br>
+    StreamString stream;<br>
+    Dump(&stream);<br>
+    path.append(stream.GetString().begin(), stream.GetString().end());<br>
      Normalize(path, m_syntax);<br>
      if (denormalize && !path.empty())<br>
          DeNormalize(path, m_syntax);<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=236925&r1=236924&r2=236925&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=236925&r1=236924&r2=236925&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri May  8 20:21:32 2015<br>
@@ -1312,7 +1312,7 @@ GDBRemoteCommunicationClient::SendArgume<br>
      const char *arg = NULL;<br>
      const Args &launch_args = launch_info.GetArguments();<br>
      if (exe_file)<br>
-        exe_path = exe_file.GetPath(false);<br>
+        exe_path = exe_file.GetPath();<br>
      else<br>
      {<br>
          arg = launch_args.GetArgumentAtIndex(0);<br>
@@ -3744,8 +3744,8 @@ GDBRemoteCommunicationClient::GetModuleI<br>
      packet.PutCString("qModuleInfo:");<br>
      packet.PutCStringAsRawHex8(module_path.c_str());<br>
      packet.PutCString(";");<br>
-    const auto& tripple = arch_spec.GetTriple().getTriple();<br>
-    packet.PutBytesAsRawHex8(tripple.c_str(), tripple.size());<br>
+    const auto& triple = arch_spec.GetTriple().getTriple();<br>
+    packet.PutBytesAsRawHex8(triple.c_str(), triple.size());<br>
        StringExtractorGDBRemote response;<br>
      if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) != PacketResult::Success)<br>
@@ -3795,7 +3795,7 @@ GDBRemoteCommunicationClient::GetModuleI<br>
              extractor.GetStringRef ().swap (value);<br>
              extractor.SetFilePos (0);<br>
              extractor.GetHexByteString (value);<br>
-            module_spec.GetFileSpec () = FileSpec (value.c_str(), false);<br>
+            module_spec.GetFileSpec() = FileSpec(value.c_str(), false, arch_spec);<br>
          }<br>
      }<br>
  <br>
Modified: lldb/trunk/source/Target/Target.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=236925&r1=236924&r2=236925&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=236925&r1=236924&r2=236925&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Target/Target.cpp (original)<br>
+++ lldb/trunk/source/Target/Target.cpp Fri May  8 20:21:32 2015<br>
@@ -2377,8 +2377,9 @@ Target::Install (ProcessLaunchInfo *laun<br>
                                  if (is_main_executable) // TODO: add setting for always installing main executable???<br>
                                  {<br>
                                      // Always install the main executable<br>
+                                    remote_file = FileSpec(module_sp->GetFileSpec().GetFilename().AsCString(),<br>
+                                                           false, module_sp->GetArchitecture());<br>
                                      remote_file.GetDirectory() = platform_sp->GetWorkingDirectory();<br>
-                                    remote_file.GetFilename() = module_sp->GetFileSpec().GetFilename();<br>
                                  }<br>
                              }<br>
                              if (remote_file)<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
- Colin Riley<br>
Senior Director,<br>
Parallel/Graphics Debugger Systems<br>
<br>
</font></span></blockquote></div><br></div>