summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform/gdb-server
diff options
context:
space:
mode:
authorOleksiy Vyalov <ovyalov@google.com>2015-03-10 01:15:28 +0000
committerOleksiy Vyalov <ovyalov@google.com>2015-03-10 01:15:28 +0000
commit63acdfdeb26616dfa1d9657fa666afc9b9440a2a (patch)
treee16c9b93f68e2a5ddd835845a4801ec1dead78c5 /lldb/source/Plugins/Platform/gdb-server
parent8fb05ac9987bb2fe210e3d0d02ef762793524c45 (diff)
downloadbcm5719-llvm-63acdfdeb26616dfa1d9657fa666afc9b9440a2a.tar.gz
bcm5719-llvm-63acdfdeb26616dfa1d9657fa666afc9b9440a2a.zip
Add Utility/ModuleCache class and integrate it with PlatformGDBRemoteServer - in order to allow modules caching from remote targets.
http://reviews.llvm.org/D8037 llvm-svn: 231734
Diffstat (limited to 'lldb/source/Plugins/Platform/gdb-server')
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp73
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h6
2 files changed, 75 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index cfb3161f8ef..6ab48c82078 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -27,6 +27,8 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Host/StringConvert.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -196,6 +198,73 @@ PlatformRemoteGDBServer::ResolveExecutable (const ModuleSpec &module_spec,
return error;
}
+bool
+PlatformRemoteGDBServer::GetModuleSpec (const FileSpec& module_file_spec,
+ const ArchSpec& arch,
+ ModuleSpec &module_spec)
+{
+ Log *log = GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PLATFORM);
+
+ const auto module_path = module_file_spec.GetPath ();
+
+ StringExtractorGDBRemote response;
+ if (!m_gdb_client.GetModuleInfo (module_path.c_str (), arch, response))
+ {
+ if (log)
+ log->Printf ("PlatformRemoteGDBServer::%s - failed to get module info for %s:%s",
+ __FUNCTION__, module_path.c_str (), arch.GetTriple ().getTriple ().c_str ());
+ return false;
+ }
+
+ std::string name;
+ std::string value;
+ bool success;
+ StringExtractor extractor;
+
+ module_spec.Clear ();
+ module_spec.GetFileSpec () = module_file_spec;
+
+ while (response.GetNameColonValue (name, value))
+ {
+ if (name == "uuid" || name == "md5")
+ {
+ extractor.GetStringRef ().swap (value);
+ extractor.SetFilePos (0);
+ extractor.GetHexByteString (value);
+ module_spec.GetUUID().SetFromCString (value.c_str(), value.size() / 2);
+ }
+ else if (name == "triple")
+ {
+ extractor.GetStringRef ().swap (value);
+ extractor.SetFilePos (0);
+ extractor.GetHexByteString (value);
+ module_spec.GetArchitecture().SetTriple (value.c_str ());
+ }
+ else if (name == "file_offset")
+ {
+ const auto ival = StringConvert::ToUInt64 (value.c_str (), 0, 16, &success);
+ if (success)
+ module_spec.SetObjectOffset (ival);
+ }
+ else if (name == "file_size")
+ {
+ const auto ival = StringConvert::ToUInt64 (value.c_str (), 0, 16, &success);
+ if (success)
+ module_spec.SetObjectSize (ival);
+ }
+ }
+
+ if (log)
+ {
+ StreamString stream;
+ module_spec.Dump (stream);
+ log->Printf ("PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s",
+ __FUNCTION__, module_path.c_str (), arch.GetTriple ().getTriple ().c_str (), stream.GetString ().c_str ());
+ }
+
+ return true;
+}
+
Error
PlatformRemoteGDBServer::GetFileWithUUID (const FileSpec &platform_file,
const UUID *uuid_ptr,
@@ -346,7 +415,6 @@ PlatformRemoteGDBServer::ConnectRemote (Args& args)
{
const char *url = args.GetArgumentAtIndex(0);
m_gdb_client.SetConnection (new ConnectionFileDescriptor());
-
// we're going to reuse the hostname when we connect to the debugserver
std::string scheme;
int port;
@@ -380,7 +448,6 @@ PlatformRemoteGDBServer::ConnectRemote (Args& args)
error.SetErrorString ("\"platform connect\" takes a single argument: <connect-url>");
}
}
-
return error;
}
@@ -840,4 +907,4 @@ void
PlatformRemoteGDBServer::CalculateTrapHandlerSymbolNames ()
{
m_trap_handlers.push_back (ConstString ("_sigtramp"));
-}
+}
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index 878a5186dc3..a920cf5ffac 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -68,6 +68,11 @@ public:
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr);
+ virtual bool
+ GetModuleSpec (const lldb_private::FileSpec& module_file_spec,
+ const lldb_private::ArchSpec& arch,
+ lldb_private::ModuleSpec &module_spec);
+
virtual const char *
GetDescription ();
@@ -127,7 +132,6 @@ public:
virtual bool
SetRemoteWorkingDirectory(const lldb_private::ConstString &path);
-
// Remote subclasses should override this and return a valid instance
// name if connected.
OpenPOWER on IntegriCloud