[Lldb-commits] [lldb] r154568 - /lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
Johnny Chen
johnny.chen at apple.com
Wed Apr 11 17:22:50 PDT 2012
Author: johnny
Date: Wed Apr 11 19:22:50 2012
New Revision: 154568
URL: http://llvm.org/viewvc/llvm-project?rev=154568&view=rev
Log:
Add capability of using rsync for 'platform get-file', similar to what's done in 'platform put-file'.
Modified:
lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=154568&r1=154567&r2=154568&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Wed Apr 11 19:22:50 2012
@@ -339,25 +339,39 @@
const lldb_private::FileSpec& destination /* local file path */)
{
#define GETFILE_CHUNK_SIZE 1024
+ // Check the args, first.
+ std::string src_path;
+ if (source.GetPath(src_path) == 0)
+ return Error("unable to get file path for source");
+ std::string dst_path;
+ if (destination.GetPath(dst_path) == 0)
+ return Error("unable to get file path for destination");
if (IsHost())
{
if (FileSpec::Equal(source, destination, true))
return Error("local scenario->source and destination are the same file path: no operation performed");
// cp src dst
- char src_path[PATH_MAX];
- char dst_path[PATH_MAX];
- if (!source.GetPath(src_path, sizeof(src_path)) || !destination.GetPath(dst_path, sizeof(dst_path)))
- {
- return Error("max path length exceeded?");
- }
StreamString cp_command;
- cp_command.Printf("cp %s %s", src_path, dst_path);
+ cp_command.Printf("cp %s %s", src_path.c_str(), dst_path.c_str());
if (RunShellCommand(cp_command.GetData()) != 0)
return Error("unable to perform copy");
return Error();
}
else if (IsRemote() && m_remote_platform_sp)
{
+ if (GetSupportsRSync())
+ {
+ StreamString command;
+ command.Printf("rsync %s %s:%s %s",
+ GetRSyncArgs(),
+ GetHostname(),
+ src_path.c_str(),
+ dst_path.c_str());
+ //printf("Running command: %s\n", command.GetData());
+ if (RunShellCommand(command.GetData()) == 0)
+ return Error();
+ // If we are here, rsync has failed - let's try the slow way before giving up
+ }
// open src and dst
// read/write, read/write, read/write, ...
// close src
More information about the lldb-commits
mailing list