summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
diff options
context:
space:
mode:
authorDaniel Malea <daniel.malea@intel.com>2013-08-26 23:57:52 +0000
committerDaniel Malea <daniel.malea@intel.com>2013-08-26 23:57:52 +0000
commite0f8f574c7f41f5b61ec01aa290d52fc55a3f3c9 (patch)
treec519b347e7428c3b28956c9165b661b11b468470 /lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
parent6b16b43ef95d2ffbad889601f26786ecdbd914b4 (diff)
downloadbcm5719-llvm-e0f8f574c7f41f5b61ec01aa290d52fc55a3f3c9.tar.gz
bcm5719-llvm-e0f8f574c7f41f5b61ec01aa290d52fc55a3f3c9.zip
merge lldb-platform-work branch (and assorted fixes) into trunk
Summary: This merge brings in the improved 'platform' command that knows how to interface with remote machines; that is, query OS/kernel information, push and pull files, run shell commands, etc... and implementation for the new communication packets that back that interface, at least on Darwin based operating systems via the POSIXPlatform class. Linux support is coming soon. Verified the test suite runs cleanly on Linux (x86_64), build OK on Mac OS X Mountain Lion. Additional improvements (not in the source SVN branch 'lldb-platform-work'): - cmake build scripts for lldb-platform - cleanup test suite - documentation stub for qPlatform_RunCommand - use log class instead of printf() directly - reverted work-in-progress-looking changes from test/types/TestAbstract.py that work towards running the test suite remotely. - add new logging category 'platform' Reviewers: Matt Kopec, Greg Clayton Review: http://llvm-reviews.chandlerc.com/D1493 llvm-svn: 189295
Diffstat (limited to 'lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp')
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp76
1 files changed, 73 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 3b0e159e454..9ca49731ee9 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -12,14 +12,19 @@
// C Includes
#ifndef LLDB_DISABLE_POSIX
+#include <sys/stat.h>
#include <sys/sysctl.h>
#endif
// C++ Includes
+
+#include <sstream>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Error.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/PluginManager.h"
@@ -161,9 +166,9 @@ PlatformMacOSX::~PlatformMacOSX()
}
Error
-PlatformMacOSX::GetFile (const FileSpec &platform_file,
- const UUID *uuid_ptr,
- FileSpec &local_file)
+PlatformMacOSX::GetSymbolFile (const FileSpec &platform_file,
+ const UUID *uuid_ptr,
+ FileSpec &local_file)
{
if (IsRemote())
{
@@ -176,6 +181,62 @@ PlatformMacOSX::GetFile (const FileSpec &platform_file,
return Error();
}
+lldb_private::Error
+PlatformMacOSX::GetFile (const lldb_private::FileSpec &platform_file,
+ const lldb_private::UUID *uuid_ptr,
+ lldb_private::FileSpec &local_file)
+{
+ if (IsRemote() && m_remote_platform_sp)
+ {
+ std::string local_os_build;
+ Host::GetOSBuildString(local_os_build);
+ std::string remote_os_build;
+ m_remote_platform_sp->GetOSBuildString(remote_os_build);
+ if (local_os_build.compare(remote_os_build) == 0)
+ {
+ // same OS version: the local file is good enough
+ local_file = platform_file;
+ return Error();
+ }
+ else
+ {
+ // try to find the file in the cache
+ std::string cache_path(GetLocalCacheDirectory());
+ std::string module_path (platform_file.GetPath());
+ cache_path.append(module_path);
+ FileSpec module_cache_spec(cache_path.c_str(),false);
+ if (module_cache_spec.Exists())
+ {
+ local_file = module_cache_spec;
+ return Error();
+ }
+ // bring in the remote module file
+ FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent();
+ StreamString mkdir_folder_cmd;
+ // try to make the local directory first
+ mkdir_folder_cmd.Printf("mkdir -p %s/%s", module_cache_folder.GetDirectory().AsCString(), module_cache_folder.GetFilename().AsCString());
+ Host::RunShellCommand(mkdir_folder_cmd.GetData(),
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 60);
+ Error err = GetFile(platform_file, module_cache_spec);
+ if (err.Fail())
+ return err;
+ if (module_cache_spec.Exists())
+ {
+ local_file = module_cache_spec;
+ return Error();
+ }
+ else
+ return Error("unable to obtain valid module file");
+ }
+ }
+ local_file = platform_file;
+ return Error();
+}
+
bool
PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
@@ -186,3 +247,12 @@ PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
#endif
}
+lldb_private::Error
+PlatformMacOSX::GetSharedModule (const lldb_private::ModuleSpec &module_spec,
+ lldb::ModuleSP &module_sp,
+ const lldb_private::FileSpecList *module_search_paths_ptr,
+ lldb::ModuleSP *old_module_sp_ptr,
+ bool *did_create_ptr)
+{
+ return GetSharedModuleWithLocalCache(module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr);
+}
OpenPOWER on IntegriCloud