Added support for GDB's 'qXfer:memory-map:read::...' command packet.

This commit is contained in:
Nav
2022-05-14 22:43:08 +01:00
parent 159c77a5f1
commit f1e20c81a2
5 changed files with 148 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
// Command packets
#include "CommandPackets/ReadMemory.hpp"
#include "CommandPackets/WriteMemory.hpp"
#include "CommandPackets/ReadMemoryMap.hpp"
namespace Bloom::DebugServer::Gdb::AvrGdb
{
@@ -32,6 +33,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb
) {
using AvrGdb::CommandPackets::ReadMemory;
using AvrGdb::CommandPackets::WriteMemory;
using AvrGdb::CommandPackets::ReadMemoryMap;
if (rawPacket.size() >= 2) {
if (rawPacket[1] == 'm') {
@@ -41,8 +43,25 @@ namespace Bloom::DebugServer::Gdb::AvrGdb
if (rawPacket[1] == 'M') {
return std::make_unique<WriteMemory>(rawPacket);
}
const auto rawPacketString = std::string(rawPacket.begin() + 1, rawPacket.end());
if (rawPacketString.find("qXfer:memory-map:read::") == 0) {
return std::make_unique<ReadMemoryMap>(rawPacket);
}
}
return GdbRspDebugServer::resolveCommandPacket(rawPacket);
}
std::set<std::pair<Feature, std::optional<std::string>>> AvrGdbRsp::getSupportedFeatures() {
auto supportedFeatures = GdbRspDebugServer::getSupportedFeatures();
// The AVR GDB server supports the
supportedFeatures.insert({
Feature::MEMORY_MAP_READ, std::nullopt
});
return supportedFeatures;
}
}