From dad4db713de4e2d7e783cde6fc3191624c7bac29 Mon Sep 17 00:00:00 2001 From: Tamas Berghammer Date: Fri, 13 Mar 2015 11:16:08 +0000 Subject: Add filepath to qModuleInfo packet The file path is currently required on android because the executables only contain the name of the system libraries without their path. This CL add an extra field to the qModuleInfo packet to return the full path of a modul and add logic to locate a shared module on android. Differential revision: http://reviews.llvm.org/D8221 llvm-svn: 232156 --- .../gdb-remote/GDBRemoteCommunicationServerCommon.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp') diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index 0a2385f6f2c..31202fca2bf 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -39,6 +39,10 @@ #include "ProcessGDBRemoteLog.h" #include "Utility/StringExtractorGDBRemote.h" +#ifdef __ANDROID__ +#include "lldb/Host/android/HostInfoAndroid.h" +#endif + using namespace lldb; using namespace lldb_private; @@ -1131,14 +1135,21 @@ GDBRemoteCommunicationServerCommon::Handle_qModuleInfo (StringExtractorGDBRemote packet.GetHexByteStringTerminatedBy(module_path, ';'); if (module_path.empty()) return SendErrorResponse (1); - const FileSpec module_path_spec(module_path.c_str(), true); if (packet.GetChar() != ';') return SendErrorResponse (2); std::string triple; packet.GetHexByteString(triple); - const ModuleSpec module_spec(module_path_spec, ArchSpec(triple.c_str())); + ArchSpec arch(triple.c_str()); + +#ifdef __ANDROID__ + const FileSpec module_path_spec = HostInfoAndroid::ResolveLibraryPath(module_path, arch); +#else + const FileSpec module_path_spec(module_path.c_str(), true); +#endif + + const ModuleSpec module_spec(module_path_spec, arch); ModuleSpecList module_specs; if (!ObjectFile::GetModuleSpecifications(module_path_spec, 0, 0, module_specs)) @@ -1173,6 +1184,9 @@ GDBRemoteCommunicationServerCommon::Handle_qModuleInfo (StringExtractorGDBRemote response.PutCStringAsRawHex8( module_arch.GetTriple().getTriple().c_str()); response.PutChar(';'); + response.PutCString("file_path:"); + response.PutCStringAsRawHex8(module_path_spec.GetPath().c_str()); + response.PutChar(';'); response.PutCString("file_offset:"); response.PutHex64(file_offset); response.PutChar(';'); -- cgit v1.2.3