diff --git a/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.cpp b/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.cpp index f3c88e9f..36a27cc1 100644 --- a/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.cpp +++ b/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.cpp @@ -1,5 +1,9 @@ #include "AvrGdbRsp.hpp" +// Command packets +#include "CommandPackets/ReadMemory.hpp" +#include "CommandPackets/WriteMemory.hpp" + namespace Bloom::DebugServers::Gdb::AvrGdb { using namespace Bloom::Exceptions; @@ -21,4 +25,23 @@ namespace Bloom::DebugServers::Gdb::AvrGdb this->targetControllerConsole.getTargetDescriptor() ); } + + std::unique_ptr AvrGdbRsp::resolveCommandPacket( + const RawPacketType& rawPacket + ) { + using AvrGdb::CommandPackets::ReadMemory; + using AvrGdb::CommandPackets::WriteMemory; + + if (rawPacket.size() >= 2) { + if (rawPacket[1] == 'm') { + return std::make_unique(rawPacket); + } + + if (rawPacket[1] == 'M') { + return std::make_unique(rawPacket); + } + } + + return GdbRspDebugServer::resolveCommandPacket(rawPacket); + } } diff --git a/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.hpp b/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.hpp index f6c231b2..6a8af03d 100644 --- a/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.hpp +++ b/src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.hpp @@ -42,6 +42,10 @@ namespace Bloom::DebugServers::Gdb::AvrGdb return this->gdbTargetDescriptor.value(); } + std::unique_ptr resolveCommandPacket( + const RawPacketType& rawPacket + ) override; + private: std::optional gdbTargetDescriptor; };