Removed init() member function from AVR GDB command packet classes

This commit is contained in:
Nav
2022-04-03 17:42:00 +01:00
parent 821f10ba79
commit 80d7c9588f
4 changed files with 10 additions and 19 deletions

View File

@@ -13,7 +13,9 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
using Exceptions::Exception;
void ReadMemory::init() {
ReadMemory::ReadMemory(const std::vector<unsigned char>& rawPacket)
: AbstractMemoryAccessPacket(rawPacket)
{
if (this->data.size() < 4) {
throw Exception("Invalid packet length");
}

View File

@@ -15,11 +15,8 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
{
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.
* The startAddress sent from the GDB client will 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.
*/
std::uint32_t startAddress = 0;
@@ -28,13 +25,8 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
*/
std::uint32_t bytes = 0;
explicit ReadMemory(const std::vector<unsigned char>& rawPacket): AbstractMemoryAccessPacket(rawPacket) {
init();
};
explicit ReadMemory(const std::vector<unsigned char>& rawPacket);
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
protected:
void init();
};
}

View File

@@ -13,7 +13,9 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
using namespace Bloom::Exceptions;
void WriteMemory::init() {
WriteMemory::WriteMemory(const std::vector<unsigned char>& rawPacket)
: AbstractMemoryAccessPacket(rawPacket)
{
if (this->data.size() < 4) {
throw Exception("Invalid packet length");
}

View File

@@ -22,13 +22,8 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
Targets::TargetMemoryBuffer buffer;
explicit WriteMemory(const std::vector<unsigned char>& rawPacket): AbstractMemoryAccessPacket(rawPacket) {
init();
};
explicit WriteMemory(const std::vector<unsigned char>& rawPacket);
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
private:
void init();
};
}