From df5a904a43a05f8bed4654d3c75f2dae9db269e1 Mon Sep 17 00:00:00 2001 From: Nav Date: Thu, 24 Mar 2022 19:07:28 +0000 Subject: [PATCH] New debug session class --- CMakeLists.txt | 1 + src/DebugServers/GdbRsp/DebugSession.cpp | 17 +++++++++++++++ src/DebugServers/GdbRsp/DebugSession.hpp | 27 ++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/DebugServers/GdbRsp/DebugSession.cpp create mode 100644 src/DebugServers/GdbRsp/DebugSession.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a6d6a43..ccaf46e8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,7 @@ add_executable(Bloom src/DebugServers/GdbRsp/GdbRspDebugServer.cpp src/DebugServers/GdbRsp/GdbDebugServerConfig.cpp src/DebugServers/GdbRsp/Connection.cpp + src/DebugServers/GdbRsp/DebugSession.cpp src/DebugServers/GdbRsp/CommandPackets/CommandPacket.cpp src/DebugServers/GdbRsp/CommandPackets/CommandPacketFactory.cpp src/DebugServers/GdbRsp/CommandPackets/SupportedFeaturesQuery.cpp diff --git a/src/DebugServers/GdbRsp/DebugSession.cpp b/src/DebugServers/GdbRsp/DebugSession.cpp new file mode 100644 index 00000000..b507f566 --- /dev/null +++ b/src/DebugServers/GdbRsp/DebugSession.cpp @@ -0,0 +1,17 @@ +#include "DebugSession.hpp" + +#include "src/Logger/Logger.hpp" + +namespace Bloom::DebugServers::Gdb +{ + using Bloom::Targets::TargetDescriptor; + + DebugSession::DebugSession(const Connection& connection, const TargetDescriptor& targetDescriptor) + : connection(connection) + , targetDescriptor(targetDescriptor) + {} + + void DebugSession::terminate() { + this->connection.close(); + } +} diff --git a/src/DebugServers/GdbRsp/DebugSession.hpp b/src/DebugServers/GdbRsp/DebugSession.hpp new file mode 100644 index 00000000..4ef285ef --- /dev/null +++ b/src/DebugServers/GdbRsp/DebugSession.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include "Connection.hpp" +#include "TargetDescriptor.hpp" + +namespace Bloom::DebugServers::Gdb +{ + class DebugSession + { + public: + Connection connection; + + const TargetDescriptor& targetDescriptor; + + /** + * When the GDB client is waiting for the target to halt, this is set to true so we know when to notify the + * client. + */ + bool waitingForBreak = false; + + DebugSession(const Connection& connection, const TargetDescriptor& targetDescriptor); + + void terminate(); + }; +}