diff options
author | Antonio Afonso <antonio.afonso@gmail.com> | 2019-07-23 20:40:30 +0000 |
---|---|---|
committer | Antonio Afonso <antonio.afonso@gmail.com> | 2019-07-23 20:40:30 +0000 |
commit | 05e32bad137c80a7ff28f8f002ff0e9f614ad2af (patch) | |
tree | 5be360df78d6b3aebcd65c27f614d711e4b40164 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | |
parent | cbbdc4183837dfea92cf840b93e0f12e2bcccffc (diff) | |
download | bcm5719-llvm-05e32bad137c80a7ff28f8f002ff0e9f614ad2af.tar.gz bcm5719-llvm-05e32bad137c80a7ff28f8f002ff0e9f614ad2af.zip |
Revert "Revert "Implement xfer:libraries-svr4:read packet""
This reverts commit 08c38f77c5fb4d3735ec215032fed8ee6730b3db.
llvm-svn: 366847
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 196607665bb..190db341ae0 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -2765,6 +2765,24 @@ GDBRemoteCommunicationServerLLGS::ReadXferObject(llvm::StringRef object, return std::move(*buffer_or_error); } + if (object == "libraries-svr4") { + auto library_list = m_debugged_process_up->GetLoadedSVR4Libraries(); + if (!library_list) + return library_list.takeError(); + + StreamString response; + response.Printf("<library-list-svr4 version=\"1.0\">"); + for (auto const &library : *library_list) { + response.Printf("<library name=\"%s\" ", + XMLEncodeAttributeValue(library.name.c_str()).c_str()); + response.Printf("lm=\"0x%" PRIx64 "\" ", library.link_map); + response.Printf("l_addr=\"0x%" PRIx64 "\" ", library.base_addr); + response.Printf("l_ld=\"0x%" PRIx64 "\" />", library.ld_addr); + } + response.Printf("</library-list-svr4>"); + return MemoryBuffer::getMemBufferCopy(response.GetString(), __FUNCTION__); + } + return llvm::make_error<PacketUnimplementedError>( "Xfer object not supported"); } @@ -3283,3 +3301,28 @@ GDBRemoteCommunicationServerLLGS::FindModuleFile(const std::string &module_path, return GDBRemoteCommunicationServerCommon::FindModuleFile(module_path, arch); } + +std::string GDBRemoteCommunicationServerLLGS::XMLEncodeAttributeValue( + llvm::StringRef value) { + std::string result; + for (const char &c : value) { + switch (c) { + case '\'': + result += "'"; + break; + case '"': + result += """; + break; + case '<': + result += "<"; + break; + case '>': + result += ">"; + break; + default: + result += c; + break; + } + } + return result; +}
\ No newline at end of file |