From 3bd09bdc84900e8308ea3b6405f0b49329c4d1ac Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 27 Mar 2022 19:44:02 +0100 Subject: [PATCH] Included AVR GDB specific implementations of the read and write memory GDB command packets. --- src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.cpp | 23 ++++++++++++++++++++ src/DebugServers/GdbRsp/AvrGdb/AvrGdbRsp.hpp | 4 ++++ 2 files changed, 27 insertions(+) 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; };