[Lldb-commits] [lldb] r154958 - in /lldb/branches/lldb-platform-work: include/lldb/Target/Platform.h source/Plugins/Platform/MacOSX/PlatformDarwin.cpp source/Plugins/Platform/MacOSX/PlatformDarwin.h source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp source/Plugins/Platform/MacOSX/PlatformMacOSX.h source/Plugins/Platform/POSIX/PlatformPOSIX.cpp source/Plugins/Platform/POSIX/PlatformPOSIX.h source/Target/Platform.cpp
Enrico Granata
egranata at apple.com
Tue Apr 17 15:36:40 PDT 2012
Author: enrico
Date: Tue Apr 17 17:36:39 2012
New Revision: 154958
URL: http://llvm.org/viewvc/llvm-project?rev=154958&view=rev
Log:
Making the local cache directory dynamically configurable - it was previously hardcoded to some path on my local machine which is not a good thing :) - now one can say platform connect --local-cache-dir <path>
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/MacOSX/PlatformDarwin.h
lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
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=154958&r1=154957&r2=154958&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h Tue Apr 17 17:36:39 2012
@@ -451,10 +451,7 @@
}
virtual uint32_t
- RunShellCommand (const std::string &command_line)
- {
- return UINT32_MAX;
- }
+ RunShellCommand (const std::string &command_line);
virtual uint32_t
MakeDirectory (const std::string &path,
@@ -581,6 +578,14 @@
{
return NULL;
}
+
+ virtual lldb_private::Error
+ RunShellCommand (const char *command, // Shouldn't be NULL
+ const char *working_dir, // Pass NULL to use the current working directory
+ int *status_ptr, // Pass NULL if you don't want the process exit status
+ int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass NULL if you don't want the command output
+ uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
protected:
bool m_is_host;
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=154958&r1=154957&r2=154958&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 Tue Apr 17 17:36:39 2012
@@ -412,6 +412,7 @@
SetSSHOpts(posix_options->m_ssh_opts.c_str());
}
SetIgnoresRemoteHostname(posix_options->m_ignores_remote_hostname);
+ SetLocalCacheDirectory(posix_options->m_cache_dir.c_str());
}
}
@@ -789,3 +790,14 @@
return NULL;
}
+void
+PlatformDarwin::SetLocalCacheDirectory (const char* local)
+{
+ m_local_cache_directory.assign(local);
+}
+
+const char*
+PlatformDarwin::GetLocalCacheDirectory ()
+{
+ return m_local_cache_directory.c_str();
+}
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=154958&r1=154957&r2=154958&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.h Tue Apr 17 17:36:39 2012
@@ -102,6 +102,12 @@
bool
x86GetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
+ virtual void
+ SetLocalCacheDirectory (const char* local);
+
+ virtual const char*
+ GetLocalCacheDirectory ();
+
protected:
std::string m_developer_directory;
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=154958&r1=154957&r2=154958&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Tue Apr 17 17:36:39 2012
@@ -115,8 +115,7 @@
/// Default Constructor
//------------------------------------------------------------------
PlatformMacOSX::PlatformMacOSX (bool is_host) :
- PlatformDarwin (is_host),
- m_local_cache_directory("/Volumes/work/egranata/myTextEdit")
+ PlatformDarwin (is_host)
{
}
@@ -156,18 +155,6 @@
#endif
}
-void
-PlatformMacOSX::SetLocalCacheDirectory (const char* local)
-{
- m_local_cache_directory.assign(local);
-}
-
-const char*
-PlatformMacOSX::GetLocalCacheDirectory ()
-{
- return m_local_cache_directory.c_str();
-}
-
lldb_private::Error
PlatformMacOSX::GetSharedModule (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h?rev=154958&r1=154957&r2=154958&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h Tue Apr 17 17:36:39 2012
@@ -92,18 +92,9 @@
GetSupportedArchitectureAtIndex (uint32_t idx,
lldb_private::ArchSpec &arch);
- virtual void
- SetLocalCacheDirectory (const char* local);
-
- virtual const char*
- GetLocalCacheDirectory ();
-
// must add --local-cache to the parent options
virtual lldb_private::Options *
GetConnectionOptions (lldb_private::CommandInterpreter& interpreter);
-
-protected:
- std::string m_local_cache_directory;
private:
DISALLOW_COPY_AND_ASSIGN (PlatformMacOSX);
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=154958&r1=154957&r2=154958&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 Tue Apr 17 17:36:39 2012
@@ -48,7 +48,8 @@
m_rsync_opts (),
m_ssh (false),
m_ssh_opts (),
-m_ignores_remote_hostname (false)
+m_ignores_remote_hostname (false),
+m_cache_dir()
{
}
@@ -84,6 +85,10 @@
m_ignores_remote_hostname = true;
break;
+ case 'c':
+ m_cache_dir.assign(option_arg);
+ break;
+
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -100,6 +105,7 @@
m_ssh = false;
m_ssh_opts.clear();
m_ignores_remote_hostname = false;
+ m_cache_dir.clear();
}
const OptionDefinition*
@@ -116,6 +122,7 @@
{ 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 when composing the rsync command." },
+ { LLDB_OPT_SET_ALL, false, "local-cache-dir" , 'c', required_argument, NULL, 0, eArgTypePath , "Path in which to store local copies of files." },
{ 0, false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }
};
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=154958&r1=154957&r2=154958&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 Tue Apr 17 17:36:39 2012
@@ -75,6 +75,7 @@
protected:
std::auto_ptr<lldb_private::Options> m_options;
+ std::string m_local_cache_directory;
class POSIXPlatformConnectionOptions : public lldb_private::Options
{
@@ -104,6 +105,7 @@
bool m_ssh;
std::string m_ssh_opts;
bool m_ignores_remote_hostname;
+ std::string m_cache_dir;
};
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=154958&r1=154957&r2=154958&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Platform.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Platform.cpp Tue Apr 17 17:36:39 2012
@@ -712,3 +712,24 @@
{
return false;
}
+
+uint32_t
+Platform::RunShellCommand (const std::string &command_line)
+{
+ int status;
+ Error err = RunShellCommand(command_line.c_str(), NULL, &status, NULL, NULL, 10);
+ if (err.Fail())
+ return UINT32_MAX;
+ return status;
+}
+
+lldb_private::Error
+Platform::RunShellCommand (const char *command, // Shouldn't be NULL
+ const char *working_dir, // Pass NULL to use the current working directory
+ int *status_ptr, // Pass NULL if you don't want the process exit status
+ int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass NULL if you don't want the command output
+ uint32_t timeout_sec) // Timeout in seconds to wait for shell program to finish
+{
+ return Error("unimplemented");
+}
More information about the lldb-commits
mailing list