[Lldb-commits] [lldb] r238606 - Fix PlatformAndroid::GetFile - check for relative source path and concatenate it with current working directory if needed.

Oleksiy Vyalov ovyalov at google.com
Fri May 29 13:02:07 PDT 2015


Author: ovyalov
Date: Fri May 29 15:02:07 2015
New Revision: 238606

URL: http://llvm.org/viewvc/llvm-project?rev=238606&view=rev
Log:
Fix PlatformAndroid::GetFile - check for relative source path and concatenate it with current working directory if needed.


Modified:
    lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=238606&r1=238605&r2=238606&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Fri May 29 15:02:07 2015
@@ -13,6 +13,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Host/HostInfo.h"
+#include "llvm/Support/Path.h"
 #include "Utility/UriParser.h"
 
 // Project includes
@@ -211,12 +212,19 @@ Error
 PlatformAndroid::GetFile (const FileSpec& source,
                           const FileSpec& destination)
 {
-    if (!IsHost() && m_remote_platform_sp)
+    if (IsHost() || !m_remote_platform_sp)
+        return PlatformLinux::GetFile(source, destination);
+
+    FileSpec source_spec (source);
+    const auto source_path = source_spec.GetPath (false);
+    if (llvm::sys::path::is_relative (source_path.c_str ()))
     {
-        AdbClient adb (m_device_id);
-        return adb.PullFile(source, destination);
+        source_spec.SetFile (GetRemoteWorkingDirectory ().AsCString (), false, FileSpec::ePathSyntaxPosix);
+        source_spec.AppendPathComponent (source_path.c_str ());
     }
-    return PlatformLinux::GetFile(source, destination);
+
+    AdbClient adb (m_device_id);
+    return adb.PullFile (source_spec, destination);
 }
 
 Error





More information about the lldb-commits mailing list