Included AVR GDB specific implementations of the read and write memory GDB command packets.

This commit is contained in:
Nav
2022-03-27 19:44:02 +01:00
parent 7a655f1223
commit 3bd09bdc84
2 changed files with 27 additions and 0 deletions

View File

@@ -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<Gdb::CommandPackets::CommandPacket> 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<ReadMemory>(rawPacket);
}
if (rawPacket[1] == 'M') {
return std::make_unique<WriteMemory>(rawPacket);
}
}
return GdbRspDebugServer::resolveCommandPacket(rawPacket);
}
}

View File

@@ -42,6 +42,10 @@ namespace Bloom::DebugServers::Gdb::AvrGdb
return this->gdbTargetDescriptor.value();
}
std::unique_ptr<Gdb::CommandPackets::CommandPacket> resolveCommandPacket(
const RawPacketType& rawPacket
) override;
private:
std::optional<TargetDescriptor> gdbTargetDescriptor;
};