Changed AVR-GDB command packet class to a bare interface class
This commit is contained in:
@@ -45,7 +45,9 @@ namespace DebugServer::Gdb::AvrGdb
|
||||
return "AVR GDB Remote Serial Protocol Debug Server";
|
||||
}
|
||||
|
||||
std::unique_ptr<CommandPackets::CommandPacket> AvrGdbRsp::rawPacketToCommandPacket(const RawPacket& rawPacket) {
|
||||
std::unique_ptr<CommandPackets::AvrGdbCommandPacketInterface> AvrGdbRsp::rawPacketToCommandPacket(
|
||||
const RawPacket& rawPacket
|
||||
) {
|
||||
using Gdb::CommandPackets::Monitor;
|
||||
|
||||
using CommandPackets::ReadRegister;
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
#include "src/DebugServer/Gdb/GdbRspDebugServer.hpp"
|
||||
|
||||
#include "AvrGdbTargetDescriptor.hpp"
|
||||
#include "CommandPackets/CommandPacket.hpp"
|
||||
#include "CommandPackets/AvrGdbCommandPacketInterface.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb
|
||||
{
|
||||
class AvrGdbRsp: public GdbRspDebugServer<AvrGdbTargetDescriptor, DebugSession, CommandPackets::CommandPacket>
|
||||
class AvrGdbRsp
|
||||
: public GdbRspDebugServer<AvrGdbTargetDescriptor, DebugSession, CommandPackets::AvrGdbCommandPacketInterface>
|
||||
{
|
||||
public:
|
||||
AvrGdbRsp(
|
||||
@@ -22,7 +23,9 @@ namespace DebugServer::Gdb::AvrGdb
|
||||
std::string getName() const override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<CommandPackets::CommandPacket> rawPacketToCommandPacket(const RawPacket& rawPacket) override;
|
||||
std::unique_ptr<CommandPackets::AvrGdbCommandPacketInterface> rawPacketToCommandPacket(
|
||||
const RawPacket& rawPacket
|
||||
) override;
|
||||
std::set<std::pair<Feature, std::optional<std::string>>> getSupportedFeatures() override;
|
||||
void handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programAddress) override;
|
||||
};
|
||||
|
||||
@@ -8,18 +8,10 @@
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
class CommandPacket: public Gdb::CommandPackets::CommandPacket
|
||||
class AvrGdbCommandPacketInterface
|
||||
{
|
||||
public:
|
||||
explicit CommandPacket(const RawPacket& rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
explicit CommandPacket(const Gdb::CommandPackets::CommandPacket& commandPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(commandPacket)
|
||||
{}
|
||||
|
||||
virtual ~CommandPacket() = default;
|
||||
virtual ~AvrGdbCommandPacketInterface() = default;
|
||||
|
||||
/**
|
||||
* Should handle the command for the current active debug session.
|
||||
@@ -24,8 +24,8 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using Exceptions::InvalidCommandOption;
|
||||
|
||||
EepromFill::EepromFill(Gdb::CommandPackets::Monitor&& monitorPacket)
|
||||
: CommandPacket(monitorPacket)
|
||||
, rawFillValue(monitorPacket.commandArguments.size() >= 3 ? monitorPacket.commandArguments[2] : std::string{})
|
||||
: Gdb::CommandPackets::Monitor(std::move(monitorPacket))
|
||||
, rawFillValue(this->commandArguments.size() >= 3 ? this->commandArguments[2] : std::string{})
|
||||
{}
|
||||
|
||||
void EepromFill::handle(
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/Monitor.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
@@ -14,7 +13,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
*
|
||||
* This command fills the target's EEPROM with the given value.
|
||||
*/
|
||||
class EepromFill: public CommandPackets::CommandPacket
|
||||
class EepromFill
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::Monitor
|
||||
{
|
||||
public:
|
||||
std::string rawFillValue;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using namespace Exceptions;
|
||||
|
||||
FlashDone::FlashDone(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void FlashDone::handle(
|
||||
|
||||
@@ -3,14 +3,17 @@
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
/**
|
||||
* The FlashDone class implements the structure for the "vFlashDone" packet.
|
||||
*/
|
||||
class FlashDone: public CommandPackets::CommandPacket
|
||||
class FlashDone
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
explicit FlashDone(const RawPacket& rawPacket);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using namespace Exceptions;
|
||||
|
||||
FlashErase::FlashErase(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{
|
||||
using Services::StringService;
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
@@ -11,7 +12,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
* The FlashErase class implements the structure for the "vFlashErase" packet. Upon receiving this packet, the
|
||||
* server is expected to erase a particular region of the target's flash memory.
|
||||
*/
|
||||
class FlashErase: public CommandPackets::CommandPacket
|
||||
class FlashErase
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
std::uint32_t startAddress = 0;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using namespace Exceptions;
|
||||
|
||||
FlashWrite::FlashWrite(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{
|
||||
using Services::StringService;
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
@@ -13,7 +14,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
* The FlashWrite class implements the structure for the "vFlashWrite" packet. Upon receiving this packet, the
|
||||
* server is expected to write to a particular region of the target's flash memory.
|
||||
*/
|
||||
class FlashWrite: public CommandPackets::CommandPacket
|
||||
class FlashWrite
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
Targets::TargetMemoryAddress startAddress;
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
ReadMemory::PacketData&& packetData
|
||||
)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
, addressSpaceDescriptor(gdbTargetDescriptor.addressSpaceDescriptorFromGdbAddress(packetData.gdbStartAddress))
|
||||
, startAddress(gdbTargetDescriptor.translateGdbAddress(packetData.gdbStartAddress))
|
||||
, bytes(packetData.bytes)
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
@@ -14,7 +15,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
* 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.
|
||||
*/
|
||||
class ReadMemory: public CommandPackets::CommandPacket
|
||||
class ReadMemory
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using Exceptions::Exception;
|
||||
|
||||
ReadMemoryMap::ReadMemoryMap(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{
|
||||
using Services::StringService;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
@@ -10,7 +11,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
* The ReadMemoryMap class implements a structure for the "qXfer:memory-map:read::..." packet. Upon receiving this
|
||||
* packet, the server is expected to respond with the target's memory map.
|
||||
*/
|
||||
class ReadMemoryMap: public CommandPackets::CommandPacket
|
||||
class ReadMemoryMap
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using Exceptions::Exception;
|
||||
|
||||
ReadRegister::ReadRegister(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{
|
||||
using Services::StringService;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/RegisterDescriptor.hpp"
|
||||
|
||||
@@ -10,7 +11,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
* The ReadRegister class implements a structure for the "p" command packet. In response to this packet, the server
|
||||
* is expected to send register values for the requested register.
|
||||
*/
|
||||
class ReadRegister: public CommandPackets::CommandPacket
|
||||
class ReadRegister
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
GdbRegisterId registerId;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using Exceptions::Exception;
|
||||
|
||||
ReadRegisters::ReadRegisters(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void ReadRegisters::handle(
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/RegisterDescriptor.hpp"
|
||||
|
||||
@@ -12,7 +13,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
* The ReadRegisters class implements a structure for the "g" command packet. In response to this packet, the
|
||||
* server is expected to send register values for all registers.
|
||||
*/
|
||||
class ReadRegisters: public CommandPackets::CommandPacket
|
||||
class ReadRegisters
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
explicit ReadRegisters(const RawPacket& rawPacket);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using ::Exceptions::Exception;
|
||||
|
||||
VContRangeStep::VContRangeStep(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{
|
||||
using Services::StringService;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
@@ -13,7 +14,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
* step through a particular address range, and only report back to GDB when execution leaves that range, or when an
|
||||
* external breakpoint has been reached.
|
||||
*/
|
||||
class VContRangeStep: public CommandPackets::CommandPacket
|
||||
class VContRangeStep
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
Targets::TargetMemoryAddress startAddress;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using Services::TargetControllerService;
|
||||
|
||||
VContSupportedActionsQuery::VContSupportedActionsQuery(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void VContSupportedActionsQuery::handle(
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
@@ -13,7 +14,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
*
|
||||
* Responses to this command packet should take the form of a ResponsePackets::SupportedFeaturesResponse.
|
||||
*/
|
||||
class VContSupportedActionsQuery: public CommandPackets::CommandPacket
|
||||
class VContSupportedActionsQuery
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
explicit VContSupportedActionsQuery(const RawPacket& rawPacket);
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
PacketData&& packetData
|
||||
)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
, addressSpaceDescriptor(gdbTargetDescriptor.addressSpaceDescriptorFromGdbAddress(packetData.gdbStartAddress))
|
||||
, startAddress(gdbTargetDescriptor.translateGdbAddress(packetData.gdbStartAddress))
|
||||
, bytes(packetData.bytes)
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
@@ -14,7 +15,9 @@ namespace DebugServer::Gdb::AvrGdb::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 CommandPackets::CommandPacket
|
||||
class WriteMemory
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
using Exceptions::Exception;
|
||||
|
||||
WriteRegister::WriteRegister(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
: Gdb::CommandPackets::CommandPacket(rawPacket)
|
||||
{
|
||||
using Services::StringService;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
#include "AvrGdbCommandPacketInterface.hpp"
|
||||
#include "src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/RegisterDescriptor.hpp"
|
||||
|
||||
@@ -11,7 +12,9 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
/**
|
||||
* The WriteRegister class implements the structure for "P" packets.
|
||||
*/
|
||||
class WriteRegister: public CommandPackets::CommandPacket
|
||||
class WriteRegister
|
||||
: public CommandPackets::AvrGdbCommandPacketInterface
|
||||
, private Gdb::CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
GdbRegisterId registerId;
|
||||
|
||||
Reference in New Issue
Block a user