2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
#include "CommandPacket.hpp"
|
|
|
|
|
#include "src/Targets/TargetMemory.hpp"
|
|
|
|
|
|
|
|
|
|
namespace Bloom::DebugServers::Gdb::CommandPackets
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The WriteMemory class implements the structure for "M" packets. Upon receiving this packet, the server is
|
|
|
|
|
* expected to write data to the target's memory, at the specified start address.
|
|
|
|
|
*/
|
|
|
|
|
class WriteMemory: public CommandPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* Like with the ReadMemory command packet, the start address carries additional bits that indicate
|
|
|
|
|
* the memory type.
|
|
|
|
|
*/
|
2021-06-22 23:52:31 +01:00
|
|
|
std::uint32_t startAddress = 0;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-05-24 20:58:49 +01:00
|
|
|
Targets::TargetMemoryBuffer buffer;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-06-22 23:52:31 +01:00
|
|
|
explicit WriteMemory(const std::vector<unsigned char>& rawPacket): CommandPacket(rawPacket) {
|
2021-04-04 21:04:12 +01:00
|
|
|
init();
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-22 23:52:31 +01:00
|
|
|
void dispatchToHandler(Gdb::GdbRspDebugServer& gdbRspDebugServer) override;
|
2021-10-06 21:12:31 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void init();
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
|
|
|
|
}
|