Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -534,6 +534,10 @@ bool GetThreadExtendedInfoSupported(); + bool + GetModuleInfo (const char* module_path, + StringExtractorGDBRemote &response); + protected: PacketResult Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -3703,3 +3703,17 @@ } return false; } + +bool +GDBRemoteCommunicationClient::GetModuleInfo (const char* module_path, + StringExtractorGDBRemote &response) +{ + if (!(module_path && module_path[0])) + return false; + + StreamString packet; + packet.PutCString("qModuleInfo:"); + packet.PutBytesAsRawHex8(module_path, strlen(module_path)); + + return SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success; +} Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h @@ -126,6 +126,9 @@ Handle_vFile_MD5 (StringExtractorGDBRemote &packet); PacketResult + Handle_qModuleInfo (StringExtractorGDBRemote &packet); + + PacketResult Handle_qPlatform_shell (StringExtractorGDBRemote &packet); PacketResult Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -19,6 +19,8 @@ // Other libraries and framework includes #include "llvm/ADT/Triple.h" #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" #include "lldb/Core/StreamGDBRemote.h" #include "lldb/Core/StreamString.h" #include "lldb/Host/Config.h" @@ -72,6 +74,8 @@ &GDBRemoteCommunicationServerCommon::Handle_qLaunchSuccess); RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_QListThreadsInStopReply, &GDBRemoteCommunicationServerCommon::Handle_QListThreadsInStopReply); + RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_qModuleInfo, + &GDBRemoteCommunicationServerCommon::Handle_qModuleInfo); RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_qPlatform_chmod, &GDBRemoteCommunicationServerCommon::Handle_qPlatform_chmod); RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_qPlatform_mkdir, @@ -1107,6 +1111,33 @@ return SendErrorResponse (8); } +GDBRemoteCommunication::PacketResult +GDBRemoteCommunicationServerCommon::Handle_qModuleInfo (StringExtractorGDBRemote &packet) +{ + packet.SetFilePos(::strlen ("qModuleInfo:")); + std::string module_path; + packet.GetHexByteString(module_path); + if (module_path.empty()) + return SendErrorResponse (1); + + const ModuleSpec module_spec(FileSpec(module_path.c_str(), true)); + const ModuleSP module(new Module(module_spec)); + + StreamGDBRemote response; + + const auto uuid_str = module->GetUUID().GetAsString(); + response.PutCString ("uuid:"); + response.PutCStringAsRawHex8(uuid_str.c_str()); + response.PutChar(';'); + + const auto &module_arch = module->GetArchitecture(); + response.PutCString("triple:"); + response.PutCStringAsRawHex8( module_arch.GetTriple().getTriple().c_str()); + response.PutChar(';'); + + return SendPacketNoLock(response.GetData(), response.GetSize()); +} + void GDBRemoteCommunicationServerCommon::CreateProcessInfoResponse (const ProcessInstanceInfo &proc_info, StreamString &response) Index: source/Utility/StringExtractorGDBRemote.h =================================================================== --- source/Utility/StringExtractorGDBRemote.h +++ source/Utility/StringExtractorGDBRemote.h @@ -55,6 +55,7 @@ eServerPacketType_qLaunchGDBServer, eServerPacketType_qKillSpawnedProcess, eServerPacketType_qLaunchSuccess, + eServerPacketType_qModuleInfo, eServerPacketType_qProcessInfoPID, eServerPacketType_qSpeedTest, eServerPacketType_qUserName, Index: source/Utility/StringExtractorGDBRemote.cpp =================================================================== --- source/Utility/StringExtractorGDBRemote.cpp +++ source/Utility/StringExtractorGDBRemote.cpp @@ -160,6 +160,7 @@ case 'M': if (PACKET_STARTS_WITH ("qMemoryRegionInfo:")) return eServerPacketType_qMemoryRegionInfo; if (PACKET_MATCHES ("qMemoryRegionInfo")) return eServerPacketType_qMemoryRegionInfoSupported; + if (PACKET_STARTS_WITH ("qModuleInfo:")) return eServerPacketType_qModuleInfo; break; case 'P':