[Lldb-commits] [lldb] r154605 - in /lldb/branches/lldb-platform-work: include/lldb/Target/Platform.h source/Plugins/Platform/MacOSX/PlatformDarwin.cpp source/Plugins/Platform/POSIX/PlatformPOSIX.cpp source/Plugins/Platform/POSIX/PlatformPOSIX.h source/Target/Platform.cpp
Johnny Chen
johnny.chen at apple.com
Thu Apr 12 12:23:19 PDT 2012
Author: johnny
Date: Thu Apr 12 14:23:19 2012
New Revision: 154605
URL: http://llvm.org/viewvc/llvm-project?rev=154605&view=rev
Log:
Add an option '-i' to 'platform connect' such that when specified, 'platform get-file' command shall ignore the remote hostname when constructing 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/Plugins/Platform/POSIX/PlatformPOSIX.h
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=154605&r1=154604&r2=154605&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h Thu Apr 12 14:23:19 2012
@@ -555,6 +555,18 @@
m_ssh_opts.assign(opts);
}
+ virtual bool
+ GetIgnoresRemoteHostname ()
+ {
+ return m_ignores_remote_hostname;
+ }
+
+ virtual void
+ SetIgnoresRemoteHostname(bool flag)
+ {
+ m_ignores_remote_hostname = flag;
+ }
+
virtual Options *
GetConnectionOptions (CommandInterpreter& interpreter)
{
@@ -589,6 +601,7 @@
std::string m_rsync_opts;
bool m_supports_ssh;
std::string m_ssh_opts;
+ bool m_ignores_remote_hostname;
const char *
GetCachedUserName (uint32_t uid)
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=154605&r1=154604&r2=154605&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 Thu Apr 12 14:23:19 2012
@@ -411,6 +411,7 @@
SetSupportsSSH(true);
SetSSHOpts(posix_options->m_ssh_opts.c_str());
}
+ SetIgnoresRemoteHostname(posix_options->m_ignores_remote_hostname);
}
}
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=154605&r1=154604&r2=154605&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 Thu Apr 12 14:23:19 2012
@@ -47,7 +47,8 @@
m_rsync (false),
m_rsync_opts (),
m_ssh (false),
-m_ssh_opts ()
+m_ssh_opts (),
+m_ignores_remote_hostname (false)
{
}
@@ -79,6 +80,10 @@
m_ssh_opts.assign(option_arg);
break;
+ case 'i':
+ m_ignores_remote_hostname = true;
+ break;
+
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -94,6 +99,7 @@
m_rsync_opts.clear();
m_ssh = false;
m_ssh_opts.clear();
+ m_ignores_remote_hostname = false;
}
const OptionDefinition*
@@ -105,11 +111,12 @@
OptionDefinition
PlatformPOSIX::POSIXPlatformConnectionOptions::g_option_table[] =
{
- { 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, "ssh" , 's', no_argument, NULL, 0, eArgTypeNone , "Enable SSH." },
- { LLDB_OPT_SET_ALL, false, "ssh-opts" , 'S', required_argument, NULL, 0, eArgTypeCommandName , "Platform-specific options required for SSH to work." },
- { 0, false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }
+ { 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, "ssh" , 's', no_argument, NULL, 0, eArgTypeNone , "Enable SSH." },
+ { LLDB_OPT_SET_ALL, false, "ssh-opts" , 'S', required_argument, NULL, 0, eArgTypeCommandName , "Platform-specific options required for SSH to work." },
+ { LLDB_OPT_SET_ALL, false, "ignore-remote-hostname" , 'i', no_argument, NULL, 0, eArgTypeNone , "Do not automatically fill in the remote hostname for the rsync command." },
+ { 0, false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }
};
Options *
@@ -366,11 +373,17 @@
if (GetSupportsRSync())
{
StreamString command;
- command.Printf("rsync %s %s:%s %s",
- GetRSyncOpts(),
- GetHostname(),
- src_path.c_str(),
- dst_path.c_str());
+ if (GetIgnoresRemoteHostname())
+ command.Printf("rsync %s %s %s",
+ GetRSyncOpts(),
+ src_path.c_str(),
+ dst_path.c_str());
+ else
+ command.Printf("rsync %s %s:%s %s",
+ GetRSyncOpts(),
+ GetHostname(),
+ src_path.c_str(),
+ dst_path.c_str());
printf("Running command: %s\n", command.GetData());
if (RunShellCommand(command.GetData()) == 0)
return Error();
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.h?rev=154605&r1=154604&r2=154605&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/POSIX/PlatformPOSIX.h Thu Apr 12 14:23:19 2012
@@ -100,6 +100,7 @@
std::string m_rsync_opts;
bool m_ssh;
std::string m_ssh_opts;
+ bool m_ignores_remote_hostname;
};
lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote POSIX-compliant OS
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=154605&r1=154604&r2=154605&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Platform.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Platform.cpp Thu Apr 12 14:23:19 2012
@@ -192,7 +192,8 @@
m_supports_rsync (false),
m_rsync_opts (),
m_supports_ssh (false),
- m_ssh_opts ()
+ m_ssh_opts (),
+ m_ignores_remote_hostname (false)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
More information about the lldb-commits
mailing list