This commit is contained in:
Nav
2024-11-28 21:49:03 +00:00
parent 9c1b194af1
commit 8e86cfb152
12 changed files with 67 additions and 54 deletions

View File

@@ -42,7 +42,7 @@ namespace DebugServer::Gdb::AvrGdb
{}
std::string AvrGdbRsp::getName() const {
return "AVR GDB Remote Serial Protocol Debug Server";
return "AVR GDB Remote Serial Protocol Server";
}
std::unique_ptr<CommandPackets::AvrGdbCommandPacketInterface> AvrGdbRsp::rawPacketToCommandPacket(

View File

@@ -11,6 +11,7 @@
#include "Exceptions/ClientCommunicationError.hpp"
#include "src/Exceptions/Exception.hpp"
#include "src/Exceptions/InternalFatalErrorException.hpp"
#include "src/Logger/Logger.hpp"
#include "src/Services/StringService.hpp"
@@ -207,6 +208,10 @@ namespace DebugServer::Gdb
bool interruptible,
std::optional<std::chrono::milliseconds> timeout
) {
if (bytes.has_value() && *bytes > Connection::ABSOLUTE_MAXIMUM_PACKET_READ_SIZE) {
throw InternalFatalErrorException{"Attempted to read too many bytes from GDB socket"};
}
auto output = std::vector<unsigned char>{};
if (this->readInterruptEnabled != interruptible) {

View File

@@ -36,7 +36,7 @@ namespace DebugServer::Gdb
* The current server configuration.
*
* TODO: I think this should be moved out of the DebugSession struct and passed into CommandPacket::handle()
* function. Review after v1.1.0.
* function. Review after v2.0.0.
*/
const GdbDebugServerConfig& serverConfig;

View File

@@ -117,10 +117,6 @@ namespace DebugServer::Gdb
GdbRspDebugServer& operator = (const GdbRspDebugServer& other) = delete;
GdbRspDebugServer& operator = (GdbRspDebugServer&& other) = delete;
[[nodiscard]] std::string getName() const override {
return "GDB Remote Serial Protocol DebugServer";
}
/**
* Prepares the GDB server for listing on the selected address and port.
*/
@@ -291,6 +287,7 @@ namespace DebugServer::Gdb
return;
} catch (const ::Exceptions::FatalErrorException& exception) {
Logger::error("Fatal error occurred - closing connection");
this->endDebugSession();
throw exception;
}