summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-03-24 11:15:23 +0000
committerTamas Berghammer <tberghammer@google.com>2015-03-24 11:15:23 +0000
commit7cb18bf537ed319eaa06f12ed39f85594bed641a (patch)
treee5274e908c82a83438c117d6cc750a81c2b67462 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
parent2a403d1c01e74a6c0fab3a7d70d06ee901209c76 (diff)
downloadbcm5719-llvm-7cb18bf537ed319eaa06f12ed39f85594bed641a.tar.gz
bcm5719-llvm-7cb18bf537ed319eaa06f12ed39f85594bed641a.zip
Fetch module specification from remote process also
Previously the remote module sepcification was fetched only from the remote platform. With this CL if we have a remote process then we ask it if it have any information from a given module. It is required because on android the dynamic linker only reports the name of the SO file and the platform can't always find it without a full path (the process can do it based on /proc/<pid>/maps). Differential revision: http://reviews.llvm.org/D8547 llvm-svn: 233061
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp65
1 files changed, 59 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index d9acf6cc3d9..aad69a06b9c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -21,6 +21,7 @@
#include "llvm/ADT/Triple.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamGDBRemote.h"
#include "lldb/Core/StreamString.h"
@@ -3705,20 +3706,72 @@ GDBRemoteCommunicationClient::RestoreRegisterState (lldb::tid_t tid, uint32_t sa
}
bool
-GDBRemoteCommunicationClient::GetModuleInfo (const char* module_path,
+GDBRemoteCommunicationClient::GetModuleInfo (const FileSpec& module_file_spec,
const lldb_private::ArchSpec& arch_spec,
- StringExtractorGDBRemote &response)
+ ModuleSpec &module_spec)
{
- if (!(module_path && module_path[0]))
+ std::string module_path = module_file_spec.GetPath ();
+ if (module_path.empty ())
return false;
StreamString packet;
packet.PutCString("qModuleInfo:");
- packet.PutBytesAsRawHex8(module_path, strlen(module_path));
+ packet.PutCStringAsRawHex8(module_path.c_str());
packet.PutCString(";");
const auto& tripple = arch_spec.GetTriple().getTriple();
packet.PutBytesAsRawHex8(tripple.c_str(), tripple.size());
- return SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success &&
- !response.IsErrorResponse ();
+ StringExtractorGDBRemote response;
+ if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) != PacketResult::Success)
+ return false;
+
+ if (response.IsErrorResponse ())
+ 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);
+ }
+ else if (name == "file_path")
+ {
+ extractor.GetStringRef ().swap (value);
+ extractor.SetFilePos (0);
+ extractor.GetHexByteString (value);
+ module_spec.GetFileSpec () = FileSpec (value.c_str(), false);
+ }
+ }
+
+ return true;
}
OpenPOWER on IntegriCloud