Improved handling of GDB flash memory write attempt

This commit is contained in:
Nav
2022-03-09 22:01:08 +00:00
parent 2f031b91a4
commit 9c891f0cbb

View File

@@ -219,8 +219,17 @@ namespace Bloom::DebugServers::Gdb
Logger::debug("Handling WriteMemory packet");
try {
auto memoryType = this->getMemoryTypeFromGdbAddress(packet.startAddress);
auto startAddress = this->removeMemoryTypeIndicatorFromGdbAddress(packet.startAddress);
const auto memoryType = this->getMemoryTypeFromGdbAddress(packet.startAddress);
if (memoryType == Targets::TargetMemoryType::FLASH) {
Logger::error(
"GDB client requested a flash memory write - This is not currently supported by Bloom."
);
this->clientConnection->writePacket(ResponsePacket({'E', '0', '1'}));
return;
}
const auto startAddress = this->removeMemoryTypeIndicatorFromGdbAddress(packet.startAddress);
this->targetControllerConsole.writeMemory(memoryType, startAddress, packet.buffer);
this->clientConnection->writePacket(ResponsePacket({'O', 'K'}));