Files
BloomPatched/src/DebugServer/Gdb/Packet.hpp
Nav 6cdbfbe950 Massive refactor to accommodate RISC-V targets
- Refactored entire codebase (excluding the Insight component) to accommodate multiple target architectures (no longer specific to AVR)
- Deleted 'generate SVD' GDB monitor command - I will eventually move this functionality to the Bloom website
- Added unit size property to address spaces
- Many other changes which I couldn't be bothered to describe here
2024-07-23 21:14:22 +01:00

47 lines
1.1 KiB
C++

#pragma once
#include <vector>
#include <memory>
#include <numeric>
#include <QString>
#include <sstream>
#include <iomanip>
namespace DebugServer::Gdb
{
using RawPacket = std::vector<unsigned char>;
/**
* The Packet class implements the data structure for GDB RSP packets.
*
* Fore more information on the packet data structure, see https://sourceware.org/gdb/onlinedocs/gdb/Overview.html#Overview
*/
class Packet
{
public:
explicit Packet(const RawPacket& rawPacket) {
this->init(rawPacket);
}
Packet() = default;
virtual ~Packet() = default;
Packet(const Packet& other) = default;
Packet(Packet&& other) = default;
Packet& operator = (const Packet& other) = default;
Packet& operator = (Packet&& other) = default;
protected:
std::vector<unsigned char> data;
void init(const RawPacket& rawPacket) {
this->data.insert(
this->data.begin(),
rawPacket.begin() + 1,
rawPacket.end() - 3
);
}
};
}