2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
2022-03-24 19:17:41 +00:00
|
|
|
#include "AbstractMemoryAccessPacket.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-03-24 19:17:41 +00:00
|
|
|
namespace Bloom::DebugServers::Gdb::AvrGdb::CommandPackets
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The ReadMemory class implements a structure for "m" packets. Upon receiving these packets, the server is
|
|
|
|
|
* expected to read memory from the target and send it the client.
|
|
|
|
|
*/
|
2022-03-24 19:17:41 +00:00
|
|
|
class ReadMemory: public AbstractMemoryAccessPacket
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* The startAddress sent from the GDB client may include additional bits used to indicate the memory type.
|
|
|
|
|
* These bits have to be removed from the address before it can be used as a start address. This is not done
|
|
|
|
|
* here, as it's target specific.
|
|
|
|
|
*
|
|
|
|
|
* For an example of where GDB does this, see the AvrGdbRsp class.
|
|
|
|
|
*/
|
2021-06-22 23:52:31 +01:00
|
|
|
std::uint32_t startAddress = 0;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Number of bytes to read.
|
|
|
|
|
*/
|
2021-06-22 23:52:31 +01:00
|
|
|
std::uint32_t bytes = 0;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-03-24 19:17:41 +00:00
|
|
|
explicit ReadMemory(const std::vector<unsigned char>& rawPacket): AbstractMemoryAccessPacket(rawPacket) {
|
2021-04-04 21:04:12 +01:00
|
|
|
init();
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-24 19:17:41 +00:00
|
|
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
2021-10-06 21:12:31 +01:00
|
|
|
|
2022-03-24 19:17:41 +00:00
|
|
|
protected:
|
2021-10-06 21:12:31 +01:00
|
|
|
void init();
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
|
|
|
|
}
|