From 291f59c5820cd202fcde0d0633f1316285891428 Mon Sep 17 00:00:00 2001 From: Oleksiy Vyalov Date: Fri, 29 May 2015 20:02:07 +0000 Subject: [PATCH] Fix PlatformAndroid::GetFile - check for relative source path and concatenate it with current working directory if needed. llvm-svn: 238606 --- lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index 7249fac..34df5a9 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -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 -- 2.7.4