New GDB RSP EmptyResponsePacket class

This commit is contained in:
Nav
2022-04-08 22:17:03 +01:00
parent a11e347e2c
commit 460d8ceb15
2 changed files with 20 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp" #include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
#include "src/DebugServer/Gdb/ResponsePackets/OkResponsePacket.hpp" #include "src/DebugServer/Gdb/ResponsePackets/OkResponsePacket.hpp"
#include "src/DebugServer/Gdb/ResponsePackets/TargetStopped.hpp" #include "src/DebugServer/Gdb/ResponsePackets/TargetStopped.hpp"
#include "src/DebugServer/Gdb/ResponsePackets/EmptyResponsePacket.hpp"
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp" #include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
#include "src/DebugServer/Gdb/Signal.hpp" #include "src/DebugServer/Gdb/Signal.hpp"
@@ -15,6 +16,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
using ResponsePackets::ResponsePacket; using ResponsePackets::ResponsePacket;
using ResponsePackets::OkResponsePacket; using ResponsePackets::OkResponsePacket;
using ResponsePackets::TargetStopped; using ResponsePackets::TargetStopped;
using ResponsePackets::EmptyResponsePacket;
using ResponsePackets::ErrorResponsePacket; using ResponsePackets::ErrorResponsePacket;
using Exceptions::Exception; using Exceptions::Exception;
@@ -49,6 +51,6 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
Logger::debug("Unknown GDB RSP packet: " + packetString + " - returning empty response"); Logger::debug("Unknown GDB RSP packet: " + packetString + " - returning empty response");
// Respond with an empty packet // Respond with an empty packet
debugSession.connection.writePacket(ResponsePacket(std::vector<unsigned char>({0}))); debugSession.connection.writePacket(EmptyResponsePacket());
} }
} }

View File

@@ -0,0 +1,17 @@
#pragma once
#include "ResponsePacket.hpp"
namespace Bloom::DebugServer::Gdb::ResponsePackets
{
/**
* Empty response packet expected by the GDB client, in response to certain commands.
*/
class EmptyResponsePacket: public ResponsePacket
{
public:
EmptyResponsePacket()
: ResponsePacket(std::vector<unsigned char>{0})
{}
};
}