From 7a2e8f07b5dce4f5c76f270008b0d90cc82908d1 Mon Sep 17 00:00:00 2001 From: Nav Date: Thu, 17 Nov 2022 00:13:12 +0000 Subject: [PATCH] Renamed DebugSessionAborted GDB exception --- .../Gdb/Exceptions/DebugSessionAborted.hpp | 26 ---------------- .../DebugSessionInitialisationFailure.hpp | 30 +++++++++++++++++++ src/DebugServer/Gdb/GdbRspDebugServer.cpp | 8 ++--- 3 files changed, 34 insertions(+), 30 deletions(-) delete mode 100644 src/DebugServer/Gdb/Exceptions/DebugSessionAborted.hpp create mode 100644 src/DebugServer/Gdb/Exceptions/DebugSessionInitialisationFailure.hpp diff --git a/src/DebugServer/Gdb/Exceptions/DebugSessionAborted.hpp b/src/DebugServer/Gdb/Exceptions/DebugSessionAborted.hpp deleted file mode 100644 index 844a6854..00000000 --- a/src/DebugServer/Gdb/Exceptions/DebugSessionAborted.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "src/Exceptions/Exception.hpp" - -namespace Bloom::DebugServer::Gdb::Exceptions -{ - /** - * The GDB server may abort a debug session with the client, if an internal error occurs. One circumstance where - * this can happen is when the TargetController is not able to service the debug session for whatever reason. - * - * See GdbRspDebugServer::serve() for handling code. - */ - class DebugSessionAborted: public Bloom::Exceptions::Exception - { - public: - explicit DebugSessionAborted(const std::string& message): Bloom::Exceptions::Exception(message) { - this->message = message; - } - - explicit DebugSessionAborted(const char* message): Bloom::Exceptions::Exception(message) { - this->message = std::string(message); - } - - explicit DebugSessionAborted() = default; - }; -} diff --git a/src/DebugServer/Gdb/Exceptions/DebugSessionInitialisationFailure.hpp b/src/DebugServer/Gdb/Exceptions/DebugSessionInitialisationFailure.hpp new file mode 100644 index 00000000..9914c47a --- /dev/null +++ b/src/DebugServer/Gdb/Exceptions/DebugSessionInitialisationFailure.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "src/Exceptions/Exception.hpp" + +namespace Bloom::DebugServer::Gdb::Exceptions +{ + /** + * The GDB server may fail to prepare for a debug session, if an internal error occurs. One circumstance where + * this can happen is when the TargetController is not able to service the debug session for whatever reason. + * + * See GdbRspDebugServer::serve() for handling code. + */ + class DebugSessionInitialisationFailure: public Bloom::Exceptions::Exception + { + public: + explicit DebugSessionInitialisationFailure(const std::string& message) + : Bloom::Exceptions::Exception(message) + { + this->message = message; + } + + explicit DebugSessionInitialisationFailure(const char* message) + : Bloom::Exceptions::Exception(message) + { + this->message = std::string(message); + } + + explicit DebugSessionInitialisationFailure() = default; + }; +} diff --git a/src/DebugServer/Gdb/GdbRspDebugServer.cpp b/src/DebugServer/Gdb/GdbRspDebugServer.cpp index 94e55f3c..a6ca7153 100644 --- a/src/DebugServer/Gdb/GdbRspDebugServer.cpp +++ b/src/DebugServer/Gdb/GdbRspDebugServer.cpp @@ -9,7 +9,7 @@ #include "Exceptions/ClientDisconnected.hpp" #include "Exceptions/ClientNotSupported.hpp" #include "Exceptions/ClientCommunicationError.hpp" -#include "Exceptions/DebugSessionAborted.hpp" +#include "Exceptions/DebugSessionInitialisationFailure.hpp" #include "src/Exceptions/Exception.hpp" #include "src/Exceptions/InvalidConfig.hpp" @@ -175,7 +175,7 @@ namespace Bloom::DebugServer::Gdb if (!this->targetControllerConsole.isTargetControllerInService()) { this->activeDebugSession.reset(); - throw DebugSessionAborted("TargetController not in service"); + throw DebugSessionInitialisationFailure("TargetController not in service"); } } @@ -209,8 +209,8 @@ namespace Bloom::DebugServer::Gdb this->activeDebugSession.reset(); return; - } catch (const DebugSessionAborted& exception) { - Logger::warning("GDB debug session aborted - " + exception.getMessage()); + } catch (const DebugSessionInitialisationFailure& exception) { + Logger::warning("GDB debug session initialisation failure - " + exception.getMessage()); this->activeDebugSession.reset(); return;