From 95ef9da873a24d5c36d4f30bcc3c1477381a8b8a Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 1 Nov 2021 12:43:18 -0700 Subject: [PATCH] dmnt2: remove memory-map output which does nothing for us --- .../source/dmnt2_gdb_server_impl.cpp | 71 ------------------- .../source/dmnt2_gdb_server_impl.hpp | 1 - 2 files changed, 72 deletions(-) diff --git a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp index 80743edbb..f19eb81a1 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp @@ -772,7 +772,6 @@ namespace ams::dmnt { AnnexBufferContents_Processes, AnnexBufferContents_Threads, AnnexBufferContents_Libraries, - AnnexBufferContents_MemoryMap, }; constinit AnnexBufferContents g_annex_buffer_contents = AnnexBufferContents_Invalid; @@ -1954,7 +1953,6 @@ namespace ams::dmnt { AppendReply(m_reply_packet, ";augmented-libraries-svr4-read+"); AppendReply(m_reply_packet, ";qXfer:threads:read+"); AppendReply(m_reply_packet, ";qXfer:exec-file:read+"); - AppendReply(m_reply_packet, ";qXfer:memory-map:read+"); AppendReply(m_reply_packet, ";swbreak+"); AppendReply(m_reply_packet, ";hwbreak+"); AppendReply(m_reply_packet, ";vContSupported+"); @@ -1981,8 +1979,6 @@ namespace ams::dmnt { } } else if (ParsePrefix(m_receive_packet, "libraries:read::")) { this->qXferLibrariesRead(); - } else if (ParsePrefix(m_receive_packet, "memory-map:read::")) { - this->qXferMemoryMapRead(); } else if (ParsePrefix(m_receive_packet, "exec-file:read:")) { SetReply(m_reply_packet, "l%s", m_debug_process.GetProcessName()); } else { @@ -2079,73 +2075,6 @@ namespace ams::dmnt { GetAnnexBufferContents(m_reply_packet, offset, length); } - void GdbServerImpl::qXferMemoryMapRead() { - /* Handle the qXfer. */ - u32 offset, length; - - /* Parse offset/length. */ - ParseOffsetLength(m_receive_packet, offset, length); - - /* Acquire access to the annex buffer. */ - std::scoped_lock lk(g_annex_buffer_lock); - - /* If doing a fresh read, generate the module list. */ - if (offset == 0 || g_annex_buffer_contents != AnnexBufferContents_MemoryMap) { - /* Set header. */ - SetReply(g_annex_buffer, "\n"); - - /* Iterate over all mappings. */ - uintptr_t cur_addr = 0; - svc::MemoryInfo prev_info = {}; - size_t prev_size = 0; - while (true) { - /* Get current mapping. */ - svc::MemoryInfo mem_info; - if (R_FAILED(m_debug_process.QueryMemory(std::addressof(mem_info), cur_addr))) { - break; - } - - /* If the mapping is present, add it. */ - if (mem_info.state != svc::MemoryState_Free && mem_info.state != svc::MemoryState_Inaccessible && mem_info.permission != svc::MemoryPermission_None) { - if (prev_size != 0 && mem_info.state == prev_info.state && mem_info.permission == prev_info.permission && mem_info.attribute == prev_info.attribute && mem_info.base_address == prev_info.base_address + prev_size) { - prev_size += mem_info.size; - } else { - if (prev_size != 0) { - AppendReply(g_annex_buffer, "", prev_info.base_address, prev_size); - } - - prev_info = mem_info; - prev_size = mem_info.size; - } - } else { - if (prev_size != 0) { - AppendReply(g_annex_buffer, "", prev_info.base_address, prev_size); - - prev_size = 0; - } - } - - const uintptr_t next_address = mem_info.base_address + mem_info.size; - if (next_address <= cur_addr) { - break; - } - - cur_addr = next_address; - } - - if (prev_size != 0) { - AppendReply(g_annex_buffer, "", prev_info.base_address, prev_size); - } - - AppendReply(g_annex_buffer, ""); - - g_annex_buffer_contents = AnnexBufferContents_MemoryMap; - } - - /* Copy out the module list. */ - GetAnnexBufferContents(m_reply_packet, offset, length); - } - void GdbServerImpl::qXferOsdataRead() { /* Handle the qXfer. */ u32 offset, length; diff --git a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.hpp b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.hpp index 3c0c0aacb..66c8e74d0 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.hpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.hpp @@ -104,7 +104,6 @@ namespace ams::dmnt { void qXfer(); void qXferFeaturesRead(); void qXferLibrariesRead(); - void qXferMemoryMapRead(); void qXferOsdataRead(); bool qXferThreadsRead();