Used RawPacketType alias
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
|||||||
class MemoryAccessCommandPacket: public Bloom::DebugServer::Gdb::CommandPackets::CommandPacket
|
class MemoryAccessCommandPacket: public Bloom::DebugServer::Gdb::CommandPackets::CommandPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MemoryAccessCommandPacket(const std::vector<unsigned char>& rawPacket)
|
explicit MemoryAccessCommandPacket(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
|||||||
|
|
||||||
using Exceptions::Exception;
|
using Exceptions::Exception;
|
||||||
|
|
||||||
ReadMemory::ReadMemory(const std::vector<unsigned char>& rawPacket)
|
ReadMemory::ReadMemory(const RawPacketType& rawPacket)
|
||||||
: MemoryAccessCommandPacket(rawPacket)
|
: MemoryAccessCommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() < 4) {
|
if (this->data.size() < 4) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
std::uint32_t bytes = 0;
|
std::uint32_t bytes = 0;
|
||||||
|
|
||||||
explicit ReadMemory(const std::vector<unsigned char>& rawPacket);
|
explicit ReadMemory(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
|||||||
|
|
||||||
using namespace Bloom::Exceptions;
|
using namespace Bloom::Exceptions;
|
||||||
|
|
||||||
WriteMemory::WriteMemory(const std::vector<unsigned char>& rawPacket)
|
WriteMemory::WriteMemory(const RawPacketType& rawPacket)
|
||||||
: MemoryAccessCommandPacket(rawPacket)
|
: MemoryAccessCommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() < 4) {
|
if (this->data.size() < 4) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
Targets::TargetMemoryBuffer buffer;
|
Targets::TargetMemoryBuffer buffer;
|
||||||
|
|
||||||
explicit WriteMemory(const std::vector<unsigned char>& rawPacket);
|
explicit WriteMemory(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
class CommandPacket: public Packet
|
class CommandPacket: public Packet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CommandPacket(const std::vector<unsigned char>& rawPacket): Packet(rawPacket) {}
|
explicit CommandPacket(const RawPacketType& rawPacket): Packet(rawPacket) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should handle the command for the current active debug session.
|
* Should handle the command for the current active debug session.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
using ResponsePackets::ErrorResponsePacket;
|
using ResponsePackets::ErrorResponsePacket;
|
||||||
using Exceptions::Exception;
|
using Exceptions::Exception;
|
||||||
|
|
||||||
ContinueExecution::ContinueExecution(const std::vector<unsigned char>& rawPacket)
|
ContinueExecution::ContinueExecution(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() > 1) {
|
if (this->data.size() > 1) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
std::optional<std::uint32_t> fromProgramCounter;
|
std::optional<std::uint32_t> fromProgramCounter;
|
||||||
|
|
||||||
explicit ContinueExecution(const std::vector<unsigned char>& rawPacket);
|
explicit ContinueExecution(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
class InterruptExecution: public CommandPacket
|
class InterruptExecution: public CommandPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit InterruptExecution(const std::vector<unsigned char>& rawPacket): CommandPacket(rawPacket) {}
|
explicit InterruptExecution(const RawPacketType& rawPacket): CommandPacket(rawPacket) {}
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
{
|
{
|
||||||
using ResponsePackets::EmptyResponsePacket;
|
using ResponsePackets::EmptyResponsePacket;
|
||||||
|
|
||||||
Monitor::Monitor(const std::vector<unsigned char>& rawPacket)
|
Monitor::Monitor(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() > 6) {
|
if (this->data.size() > 6) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
std::string command;
|
std::string command;
|
||||||
|
|
||||||
explicit Monitor(const std::vector<unsigned char>& rawPacket);
|
explicit Monitor(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
|
|
||||||
using Exceptions::Exception;
|
using Exceptions::Exception;
|
||||||
|
|
||||||
ReadRegisters::ReadRegisters(const std::vector<unsigned char>& rawPacket)
|
ReadRegisters::ReadRegisters(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() >= 2 && this->data.front() == 'p') {
|
if (this->data.size() >= 2 && this->data.front() == 'p') {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
std::optional<GdbRegisterNumberType> registerNumber;
|
std::optional<GdbRegisterNumberType> registerNumber;
|
||||||
|
|
||||||
explicit ReadRegisters(const std::vector<unsigned char>& rawPacket);
|
explicit ReadRegisters(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
|
|
||||||
using Exceptions::Exception;
|
using Exceptions::Exception;
|
||||||
|
|
||||||
RemoveBreakpoint::RemoveBreakpoint(const std::vector<unsigned char>& rawPacket)
|
RemoveBreakpoint::RemoveBreakpoint(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() < 6) {
|
if (this->data.size() < 6) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
std::uint32_t address = 0;
|
std::uint32_t address = 0;
|
||||||
|
|
||||||
explicit RemoveBreakpoint(const std::vector<unsigned char>& rawPacket);
|
explicit RemoveBreakpoint(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
|
|
||||||
using Exceptions::Exception;
|
using Exceptions::Exception;
|
||||||
|
|
||||||
SetBreakpoint::SetBreakpoint(const std::vector<unsigned char>& rawPacket)
|
SetBreakpoint::SetBreakpoint(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() < 6) {
|
if (this->data.size() < 6) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
std::uint32_t address = 0;
|
std::uint32_t address = 0;
|
||||||
|
|
||||||
explicit SetBreakpoint(const std::vector<unsigned char>& rawPacket);
|
explicit SetBreakpoint(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
|
|
||||||
using Exceptions::Exception;
|
using Exceptions::Exception;
|
||||||
|
|
||||||
StepExecution::StepExecution(const std::vector<unsigned char>& rawPacket)
|
StepExecution::StepExecution(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
if (this->data.size() > 1) {
|
if (this->data.size() > 1) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
*/
|
*/
|
||||||
std::optional<std::size_t> fromProgramCounter;
|
std::optional<std::size_t> fromProgramCounter;
|
||||||
|
|
||||||
explicit StepExecution(const std::vector<unsigned char>& rawPacket);
|
explicit StepExecution(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
using Bloom::Exceptions::Exception;
|
using Bloom::Exceptions::Exception;
|
||||||
using Gdb::Exceptions::ClientNotSupported;
|
using Gdb::Exceptions::ClientNotSupported;
|
||||||
|
|
||||||
SupportedFeaturesQuery::SupportedFeaturesQuery(const std::vector<unsigned char>& rawPacket)
|
SupportedFeaturesQuery::SupportedFeaturesQuery(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
class SupportedFeaturesQuery: public CommandPacket
|
class SupportedFeaturesQuery: public CommandPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SupportedFeaturesQuery(const std::vector<unsigned char>& rawPacket);
|
explicit SupportedFeaturesQuery(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
[[nodiscard]] bool isFeatureSupported(const Feature& feature) const {
|
[[nodiscard]] bool isFeatureSupported(const Feature& feature) const {
|
||||||
return this->supportedFeatures.find(feature) != this->supportedFeatures.end();
|
return this->supportedFeatures.find(feature) != this->supportedFeatures.end();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
|
|
||||||
using Exceptions::Exception;
|
using Exceptions::Exception;
|
||||||
|
|
||||||
WriteRegister::WriteRegister(const std::vector<unsigned char>& rawPacket)
|
WriteRegister::WriteRegister(const RawPacketType& rawPacket)
|
||||||
: CommandPacket(rawPacket)
|
: CommandPacket(rawPacket)
|
||||||
{
|
{
|
||||||
// The P packet updates a single register
|
// The P packet updates a single register
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
|||||||
int registerNumber = 0;
|
int registerNumber = 0;
|
||||||
std::vector<unsigned char> registerValue;
|
std::vector<unsigned char> registerValue;
|
||||||
|
|
||||||
explicit WriteRegister(const std::vector<unsigned char>& rawPacket);
|
explicit WriteRegister(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Bloom::DebugServer::Gdb
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] std::vector<unsigned char> toRawPacket() const {
|
[[nodiscard]] RawPacketType toRawPacket() const {
|
||||||
std::vector<unsigned char> packet = {'$'};
|
std::vector<unsigned char> packet = {'$'};
|
||||||
auto data = this->getData();
|
auto data = this->getData();
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
std::uint32_t address = 0;
|
std::uint32_t address = 0;
|
||||||
|
|
||||||
explicit SetBreakpoint(const std::vector<unsigned char>& rawPacket);
|
explicit SetBreakpoint(const RawPacketType& rawPacket);
|
||||||
|
|
||||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user