[Lldb-commits] [lldb] r155602 - in /lldb/branches/lldb-platform-work: include/lldb/Target/Platform.h source/Plugins/Platform/MacOSX/PlatformDarwin.cpp source/Plugins/Platform/POSIX/PlatformPOSIX.cpp source/Target/Platform.cpp

Johnny Chen johnny.chen at apple.com
Wed Apr 25 18:22:05 PDT 2012


Author: johnny
Date: Wed Apr 25 20:22:05 2012
New Revision: 155602

URL: http://llvm.org/viewvc/llvm-project?rev=155602&view=rev
Log:
Add an extra '-P rsync_remote_prefix' to the 'platform connect' command to allow prepending it before the remote path
when composing the rsync command.

Modified:
    lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h
    lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    lldb/branches/lldb-platform-work/source/Target/Platform.cpp

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h?rev=155602&r1=155601&r2=155602&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h Wed Apr 25 20:22:05 2012
@@ -535,6 +535,18 @@
             m_rsync_opts.assign(opts);
         }
         
+        virtual const char*
+        GetRSyncPrefix ()
+        {
+            return m_rsync_prefix.c_str();
+        }
+        
+        virtual void
+        SetRSyncPrefix (const char* prefix)
+        {
+            m_rsync_prefix.assign(prefix);
+        }
+        
         virtual bool
         GetSupportsSSH ()
         {
@@ -623,6 +635,7 @@
         uint32_t m_max_gid_name_len;
         bool m_supports_rsync;
         std::string m_rsync_opts;
+        std::string m_rsync_prefix;
         bool m_supports_ssh;
         std::string m_ssh_opts;
         bool m_ignores_remote_hostname;
@@ -839,6 +852,7 @@
         
         bool m_rsync;
         std::string m_rsync_opts;
+        std::string m_rsync_prefix;
         bool m_ignores_remote_hostname;
     private:
         DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformRSync);

Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=155602&r1=155601&r2=155602&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Wed Apr 25 20:22:05 2012
@@ -409,6 +409,7 @@
             {
                 SetSupportsRSync(true);
                 SetRSyncOpts(m_rsync_options->m_rsync_opts.c_str());
+                SetRSyncPrefix(m_rsync_options->m_rsync_prefix.c_str());
                 SetIgnoresRemoteHostname(m_rsync_options->m_ignores_remote_hostname);
             }
             if (m_ssh_options->m_ssh)

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=155602&r1=155601&r2=155602&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 25 20:22:05 2012
@@ -216,10 +216,19 @@
                 return Error("unable to get file path for destination");
             StreamString command;
             if (GetIgnoresRemoteHostname())
-                command.Printf("rsync %s %s %s",
-                               GetRSyncOpts(),
-                               src_path.c_str(),
-                               dst_path.c_str());
+            {
+                if (!GetRSyncPrefix())
+                    command.Printf("rsync %s %s %s",
+                                   GetRSyncOpts(),
+                                   src_path.c_str(),
+                                   dst_path.c_str());
+                else
+                    command.Printf("rsync %s %s %s%s",
+                                   GetRSyncOpts(),
+                                   src_path.c_str(),
+                                   GetRSyncPrefix(),
+                                   dst_path.c_str());
+            }
             else
                 command.Printf("rsync %s %s %s:%s",
                                GetRSyncOpts(),
@@ -341,10 +350,19 @@
         {
             StreamString command;
             if (GetIgnoresRemoteHostname())
-                command.Printf("rsync %s %s %s",
-                               GetRSyncOpts(),
-                               src_path.c_str(),
-                               dst_path.c_str());
+            {
+                if (!GetRSyncPrefix())
+                    command.Printf("rsync %s %s %s",
+                                   GetRSyncOpts(),
+                                   src_path.c_str(),
+                                   dst_path.c_str());
+                else
+                    command.Printf("rsync %s %s%s %s",
+                                   GetRSyncOpts(),
+                                   GetRSyncPrefix(),
+                                   src_path.c_str(),
+                                   dst_path.c_str());
+            }
             else
                 command.Printf("rsync %s %s:%s %s",
                                GetRSyncOpts(),
@@ -414,11 +432,16 @@
     if (GetSupportsRSync())
     {
         stream.PutCString("rsync");
-        if ( (GetRSyncOpts() && *GetRSyncOpts()) || GetIgnoresRemoteHostname())
+        if ( (GetRSyncOpts() && *GetRSyncOpts()) ||
+             (GetRSyncPrefix() && *GetRSyncPrefix()) ||
+             GetIgnoresRemoteHostname())
         {
             stream.Printf(", options: ");
             if (GetRSyncOpts() && *GetRSyncOpts())
                 stream.Printf("'%s' ",GetRSyncOpts());
+            stream.Printf(", prefix: ");
+            if (GetRSyncPrefix() && *GetRSyncPrefix())
+                stream.Printf("'%s' ",GetRSyncPrefix());
             if (GetIgnoresRemoteHostname())
                 stream.Printf("ignore remote-hostname ");
         }

Modified: lldb/branches/lldb-platform-work/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Platform.cpp?rev=155602&r1=155601&r2=155602&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Platform.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Platform.cpp Wed Apr 25 20:22:05 2012
@@ -192,6 +192,7 @@
     m_max_gid_name_len (0),
     m_supports_rsync (false),
     m_rsync_opts (),
+    m_rsync_prefix (),
     m_supports_ssh (false),
     m_ssh_opts (),
     m_ignores_remote_hostname (false)
@@ -741,6 +742,7 @@
 {
     {   LLDB_OPT_SET_ALL, false, "rsync"                  , 'r', no_argument,       NULL, 0, eArgTypeNone         , "Enable rsync." },
     {   LLDB_OPT_SET_ALL, false, "rsync-opts"             , 'R', required_argument, NULL, 0, eArgTypeCommandName  , "Platform-specific options required for rsync to work." },
+    {   LLDB_OPT_SET_ALL, false, "rsync-prefix"           , 'P', required_argument, NULL, 0, eArgTypeCommandName  , "Platform-specific rsync prefix put before the remote path." },
     {   LLDB_OPT_SET_ALL, false, "ignore-remote-hostname" , 'i', no_argument,       NULL, 0, eArgTypeNone         , "Do not automatically fill in the remote hostname when composing the rsync command." },
 };
 
@@ -776,6 +778,7 @@
 {
     m_rsync = false;
     m_rsync_opts.clear();
+    m_rsync_prefix.clear();
     m_ignores_remote_hostname = false;
 }
 
@@ -796,6 +799,10 @@
             m_rsync_opts.assign(option_arg);
             break;
             
+        case 'P':
+            m_rsync_prefix.assign(option_arg);
+            break;
+            
         case 'i':
             m_ignores_remote_hostname = true;
             break;





More information about the lldb-commits mailing list