From 8be1446e72e9b63d9ef2bbca37b64792b8f973db Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 9 Apr 2022 15:57:24 +0100 Subject: [PATCH] Moved TargetController components into new 'TargetController' namespace. --- src/Application.cpp | 4 ++-- src/Application.hpp | 2 +- src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.cpp | 2 ++ src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.hpp | 5 ++++- src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.cpp | 2 ++ src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/CommandPacket.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/ContinueExecution.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/ContinueExecution.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/InterruptExecution.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/InterruptExecution.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/Monitor.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/Monitor.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/ReadRegisters.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/ReadRegisters.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/ResetTarget.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/ResetTarget.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/SetBreakpoint.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/SetBreakpoint.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/StepExecution.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/StepExecution.hpp | 5 ++++- .../Gdb/CommandPackets/SupportedFeaturesQuery.cpp | 2 ++ .../Gdb/CommandPackets/SupportedFeaturesQuery.hpp | 5 ++++- src/DebugServer/Gdb/CommandPackets/WriteRegister.cpp | 2 ++ src/DebugServer/Gdb/CommandPackets/WriteRegister.hpp | 5 ++++- src/DebugServer/Gdb/GdbRspDebugServer.cpp | 5 ++++- src/DebugServer/Gdb/GdbRspDebugServer.hpp | 4 +++- src/EventManager/Events/TargetControllerStateReported.hpp | 4 ++-- src/Insight/Insight.hpp | 4 +++- src/Insight/InsightWorker/InsightWorker.cpp | 8 ++++++-- src/Insight/InsightWorker/InsightWorker.hpp | 7 +++++-- src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp | 2 ++ src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp | 4 ++-- .../InsightWorker/Tasks/QueryLatestVersionNumber.cpp | 2 ++ .../InsightWorker/Tasks/QueryLatestVersionNumber.hpp | 2 +- src/Insight/InsightWorker/Tasks/ReadStackPointer.cpp | 2 ++ src/Insight/InsightWorker/Tasks/ReadStackPointer.hpp | 2 +- src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp | 2 ++ src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp | 2 +- src/Insight/InsightWorker/Tasks/ReadTargetRegisters.cpp | 2 ++ src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp | 2 +- .../InsightWorker/Tasks/RefreshTargetPinStates.cpp | 2 ++ .../InsightWorker/Tasks/RefreshTargetPinStates.hpp | 2 +- src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp | 2 ++ src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp | 2 +- src/Insight/InsightWorker/Tasks/WriteTargetRegister.cpp | 2 ++ src/Insight/InsightWorker/Tasks/WriteTargetRegister.hpp | 2 +- src/TargetController/TargetControllerComponent.cpp | 2 +- src/TargetController/TargetControllerComponent.hpp | 2 +- src/TargetController/TargetControllerConsole.cpp | 2 +- src/TargetController/TargetControllerConsole.hpp | 2 +- src/TargetController/TargetControllerState.hpp | 2 +- 55 files changed, 134 insertions(+), 39 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 0b4dbb9d..86cfb254 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -351,13 +351,13 @@ namespace Bloom } void Application::startTargetController() { - this->targetController = std::make_unique( + this->targetController = std::make_unique( this->projectConfig.value(), this->environmentConfig.value() ); this->targetControllerThread = std::thread( - &TargetControllerComponent::run, + &TargetController::TargetControllerComponent::run, this->targetController.get() ); diff --git a/src/Application.hpp b/src/Application.hpp index f0c1c2f4..61ca8cfd 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -76,7 +76,7 @@ namespace Bloom * std::unique_ptr for the debug server (for polymorphism), I thought I'd keep it consistent and just use * std::unique_ptr for lazy loading. */ - std::unique_ptr targetController = nullptr; + std::unique_ptr targetController = nullptr; std::thread targetControllerThread; /** diff --git a/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.cpp b/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.cpp index 485cbf13..563a3ebd 100644 --- a/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.cpp +++ b/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.cpp @@ -8,6 +8,8 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::ErrorResponsePacket; using ResponsePackets::ResponsePacket; diff --git a/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.hpp b/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.hpp index a2e22f81..9ad58859 100644 --- a/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.hpp +++ b/src/DebugServer/Gdb/AvrGdb/CommandPackets/ReadMemory.hpp @@ -31,6 +31,9 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets explicit ReadMemory(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.cpp b/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.cpp index b888942f..f3d8b8ed 100644 --- a/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.cpp +++ b/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.cpp @@ -8,6 +8,8 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::ErrorResponsePacket; using ResponsePackets::OkResponsePacket; diff --git a/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.hpp b/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.hpp index 581d4637..328b8c58 100644 --- a/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.hpp +++ b/src/DebugServer/Gdb/AvrGdb/CommandPackets/WriteMemory.hpp @@ -31,6 +31,9 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets explicit WriteMemory(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/CommandPacket.cpp b/src/DebugServer/Gdb/CommandPackets/CommandPacket.cpp index c1b6f501..0c1f20c1 100644 --- a/src/DebugServer/Gdb/CommandPackets/CommandPacket.cpp +++ b/src/DebugServer/Gdb/CommandPackets/CommandPacket.cpp @@ -13,6 +13,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::ResponsePacket; using ResponsePackets::OkResponsePacket; using ResponsePackets::TargetStopped; diff --git a/src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp b/src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp index 2ccb2b6d..c96c3fdc 100644 --- a/src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp +++ b/src/DebugServer/Gdb/CommandPackets/CommandPacket.hpp @@ -46,6 +46,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets * * @param targetControllerConsole */ - virtual void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole); + virtual void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ); }; } diff --git a/src/DebugServer/Gdb/CommandPackets/ContinueExecution.cpp b/src/DebugServer/Gdb/CommandPackets/ContinueExecution.cpp index 2621b957..07394a5b 100644 --- a/src/DebugServer/Gdb/CommandPackets/ContinueExecution.cpp +++ b/src/DebugServer/Gdb/CommandPackets/ContinueExecution.cpp @@ -7,6 +7,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::ErrorResponsePacket; using Exceptions::Exception; diff --git a/src/DebugServer/Gdb/CommandPackets/ContinueExecution.hpp b/src/DebugServer/Gdb/CommandPackets/ContinueExecution.hpp index c7f7f496..eb0cd84c 100644 --- a/src/DebugServer/Gdb/CommandPackets/ContinueExecution.hpp +++ b/src/DebugServer/Gdb/CommandPackets/ContinueExecution.hpp @@ -26,6 +26,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets explicit ContinueExecution(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/InterruptExecution.cpp b/src/DebugServer/Gdb/CommandPackets/InterruptExecution.cpp index e7aad6af..b7fefe53 100644 --- a/src/DebugServer/Gdb/CommandPackets/InterruptExecution.cpp +++ b/src/DebugServer/Gdb/CommandPackets/InterruptExecution.cpp @@ -9,6 +9,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::TargetStopped; using ResponsePackets::ErrorResponsePacket; using Exceptions::Exception; diff --git a/src/DebugServer/Gdb/CommandPackets/InterruptExecution.hpp b/src/DebugServer/Gdb/CommandPackets/InterruptExecution.hpp index fdc1cf70..840249e0 100644 --- a/src/DebugServer/Gdb/CommandPackets/InterruptExecution.hpp +++ b/src/DebugServer/Gdb/CommandPackets/InterruptExecution.hpp @@ -17,6 +17,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets public: explicit InterruptExecution(const RawPacketType& rawPacket): CommandPacket(rawPacket) {} - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/Monitor.cpp b/src/DebugServer/Gdb/CommandPackets/Monitor.cpp index 2004a775..8b1683e2 100644 --- a/src/DebugServer/Gdb/CommandPackets/Monitor.cpp +++ b/src/DebugServer/Gdb/CommandPackets/Monitor.cpp @@ -6,6 +6,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::EmptyResponsePacket; Monitor::Monitor(const RawPacketType& rawPacket) diff --git a/src/DebugServer/Gdb/CommandPackets/Monitor.hpp b/src/DebugServer/Gdb/CommandPackets/Monitor.hpp index 543f6d44..77c2e5c2 100644 --- a/src/DebugServer/Gdb/CommandPackets/Monitor.hpp +++ b/src/DebugServer/Gdb/CommandPackets/Monitor.hpp @@ -19,6 +19,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets explicit Monitor(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/ReadRegisters.cpp b/src/DebugServer/Gdb/CommandPackets/ReadRegisters.cpp index 9756ea50..6d673baf 100644 --- a/src/DebugServer/Gdb/CommandPackets/ReadRegisters.cpp +++ b/src/DebugServer/Gdb/CommandPackets/ReadRegisters.cpp @@ -9,6 +9,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using Targets::TargetRegister; using Targets::TargetRegisterDescriptors; diff --git a/src/DebugServer/Gdb/CommandPackets/ReadRegisters.hpp b/src/DebugServer/Gdb/CommandPackets/ReadRegisters.hpp index f37bffe8..a741aed9 100644 --- a/src/DebugServer/Gdb/CommandPackets/ReadRegisters.hpp +++ b/src/DebugServer/Gdb/CommandPackets/ReadRegisters.hpp @@ -27,6 +27,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets explicit ReadRegisters(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.cpp b/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.cpp index 01695ab9..f30b628d 100644 --- a/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.cpp +++ b/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.cpp @@ -12,6 +12,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using Targets::TargetBreakpoint; using ResponsePackets::OkResponsePacket; diff --git a/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.hpp b/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.hpp index 7d2a4cdf..8f215f29 100644 --- a/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.hpp +++ b/src/DebugServer/Gdb/CommandPackets/RemoveBreakpoint.hpp @@ -28,6 +28,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets explicit RemoveBreakpoint(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/ResetTarget.cpp b/src/DebugServer/Gdb/CommandPackets/ResetTarget.cpp index 0e72468b..bf987551 100644 --- a/src/DebugServer/Gdb/CommandPackets/ResetTarget.cpp +++ b/src/DebugServer/Gdb/CommandPackets/ResetTarget.cpp @@ -8,6 +8,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::ErrorResponsePacket; using ResponsePackets::ResponsePacket; diff --git a/src/DebugServer/Gdb/CommandPackets/ResetTarget.hpp b/src/DebugServer/Gdb/CommandPackets/ResetTarget.hpp index adf217a5..dc895eef 100644 --- a/src/DebugServer/Gdb/CommandPackets/ResetTarget.hpp +++ b/src/DebugServer/Gdb/CommandPackets/ResetTarget.hpp @@ -17,6 +17,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets public: explicit ResetTarget(Monitor&& monitorPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.cpp b/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.cpp index f9b07afa..5ff4e1a9 100644 --- a/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.cpp +++ b/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.cpp @@ -12,6 +12,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using Targets::TargetBreakpoint; using ResponsePackets::OkResponsePacket; diff --git a/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.hpp b/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.hpp index a123e840..059136d3 100644 --- a/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.hpp +++ b/src/DebugServer/Gdb/CommandPackets/SetBreakpoint.hpp @@ -28,6 +28,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets explicit SetBreakpoint(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/StepExecution.cpp b/src/DebugServer/Gdb/CommandPackets/StepExecution.cpp index 297c4848..51babcaa 100644 --- a/src/DebugServer/Gdb/CommandPackets/StepExecution.cpp +++ b/src/DebugServer/Gdb/CommandPackets/StepExecution.cpp @@ -7,6 +7,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::ErrorResponsePacket; using Exceptions::Exception; diff --git a/src/DebugServer/Gdb/CommandPackets/StepExecution.hpp b/src/DebugServer/Gdb/CommandPackets/StepExecution.hpp index f5d67e22..6d1c5bfb 100644 --- a/src/DebugServer/Gdb/CommandPackets/StepExecution.hpp +++ b/src/DebugServer/Gdb/CommandPackets/StepExecution.hpp @@ -21,6 +21,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets explicit StepExecution(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.cpp b/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.cpp index 3e2a7a66..6b0d687c 100644 --- a/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.cpp +++ b/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.cpp @@ -13,6 +13,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using ResponsePackets::SupportedFeaturesResponse; using ResponsePackets::ErrorResponsePacket; diff --git a/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.hpp b/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.hpp index 8772fb65..5645fd4e 100644 --- a/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.hpp +++ b/src/DebugServer/Gdb/CommandPackets/SupportedFeaturesQuery.hpp @@ -32,7 +32,10 @@ namespace Bloom::DebugServer::Gdb::CommandPackets return this->supportedFeatures; } - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; private: std::set supportedFeatures; diff --git a/src/DebugServer/Gdb/CommandPackets/WriteRegister.cpp b/src/DebugServer/Gdb/CommandPackets/WriteRegister.cpp index 8b5dc25c..914f846e 100644 --- a/src/DebugServer/Gdb/CommandPackets/WriteRegister.cpp +++ b/src/DebugServer/Gdb/CommandPackets/WriteRegister.cpp @@ -11,6 +11,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets { + using TargetController::TargetControllerConsole; + using Targets::TargetRegister; using Targets::TargetRegisterDescriptors; diff --git a/src/DebugServer/Gdb/CommandPackets/WriteRegister.hpp b/src/DebugServer/Gdb/CommandPackets/WriteRegister.hpp index 2c978a09..906d50a4 100644 --- a/src/DebugServer/Gdb/CommandPackets/WriteRegister.hpp +++ b/src/DebugServer/Gdb/CommandPackets/WriteRegister.hpp @@ -19,6 +19,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets explicit WriteRegister(const RawPacketType& rawPacket); - void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override; + void handle( + DebugSession& debugSession, + TargetController::TargetControllerConsole& targetControllerConsole + ) override; }; } diff --git a/src/DebugServer/Gdb/GdbRspDebugServer.cpp b/src/DebugServer/Gdb/GdbRspDebugServer.cpp index fcac4195..5f7ca91d 100644 --- a/src/DebugServer/Gdb/GdbRspDebugServer.cpp +++ b/src/DebugServer/Gdb/GdbRspDebugServer.cpp @@ -295,7 +295,10 @@ namespace Bloom::DebugServer::Gdb } void GdbRspDebugServer::onTargetControllerStateReported(const Events::TargetControllerStateReported& event) { - if (event.state == TargetControllerState::SUSPENDED && this->activeDebugSession.has_value()) { + if ( + event.state == TargetController::TargetControllerState::SUSPENDED + && this->activeDebugSession.has_value() + ) { Logger::warning("Terminating debug session - TargetController suspended unexpectedly"); this->terminateActiveDebugSession(); } diff --git a/src/DebugServer/Gdb/GdbRspDebugServer.hpp b/src/DebugServer/Gdb/GdbRspDebugServer.hpp index 5406a484..f3a8d53d 100644 --- a/src/DebugServer/Gdb/GdbRspDebugServer.hpp +++ b/src/DebugServer/Gdb/GdbRspDebugServer.hpp @@ -112,7 +112,9 @@ namespace Bloom::DebugServer::Gdb * * See documentation in src/DebugServer/Gdb/README.md for more on how GDB commands are processed. */ - TargetControllerConsole targetControllerConsole = TargetControllerConsole(this->eventListener); + TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole( + this->eventListener + ); /** * Listening socket address diff --git a/src/EventManager/Events/TargetControllerStateReported.hpp b/src/EventManager/Events/TargetControllerStateReported.hpp index 1ed59d7b..c1800e34 100644 --- a/src/EventManager/Events/TargetControllerStateReported.hpp +++ b/src/EventManager/Events/TargetControllerStateReported.hpp @@ -13,8 +13,8 @@ namespace Bloom::Events static constexpr EventType type = EventType::TARGET_CONTROLLER_STATE_REPORTED; static inline const std::string name = "TargetControllerStateReported"; - TargetControllerState state; - explicit TargetControllerStateReported(TargetControllerState state): state(state) {}; + TargetController::TargetControllerState state; + explicit TargetControllerStateReported(TargetController::TargetControllerState state): state(state) {}; [[nodiscard]] EventType getType() const override { return TargetControllerStateReported::type; diff --git a/src/Insight/Insight.hpp b/src/Insight/Insight.hpp index a7e18b22..61964000 100644 --- a/src/Insight/Insight.hpp +++ b/src/Insight/Insight.hpp @@ -78,7 +78,9 @@ namespace Bloom this->insightProjectSettings ); - TargetControllerConsole targetControllerConsole = TargetControllerConsole(this->eventListener); + TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole( + this->eventListener + ); /** * Insight consists of two threads - the main thread where the main Qt event loop runs (for the GUI), and diff --git a/src/Insight/InsightWorker/InsightWorker.cpp b/src/Insight/InsightWorker/InsightWorker.cpp index b233ea9d..6d104fb6 100644 --- a/src/Insight/InsightWorker/InsightWorker.cpp +++ b/src/Insight/InsightWorker/InsightWorker.cpp @@ -119,12 +119,16 @@ namespace Bloom } void InsightWorker::onTargetControllerStateReportedEvent(const Events::TargetControllerStateReported& event) { - if (this->lastTargetControllerState == TargetControllerState::ACTIVE + using TargetController::TargetControllerState; + + if ( + this->lastTargetControllerState == TargetControllerState::ACTIVE && event.state == TargetControllerState::SUSPENDED ) { emit this->targetControllerSuspended(); - } else if (this->lastTargetControllerState == TargetControllerState::SUSPENDED + } else if ( + this->lastTargetControllerState == TargetControllerState::SUSPENDED && event.state == TargetControllerState::ACTIVE ) { try { diff --git a/src/Insight/InsightWorker/InsightWorker.hpp b/src/Insight/InsightWorker/InsightWorker.hpp index f697ee50..3dc1a78e 100644 --- a/src/Insight/InsightWorker/InsightWorker.hpp +++ b/src/Insight/InsightWorker/InsightWorker.hpp @@ -49,8 +49,11 @@ namespace Bloom private: EventListenerPointer eventListener = std::make_shared("InsightWorkerEventListener"); - TargetControllerConsole targetControllerConsole = TargetControllerConsole(*(this->eventListener)); - TargetControllerState lastTargetControllerState = TargetControllerState::ACTIVE; + TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole( + *(this->eventListener) + ); + TargetController::TargetControllerState lastTargetControllerState = + TargetController::TargetControllerState::ACTIVE; QTimer* eventDispatchTimer = nullptr; diff --git a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp index 65dba6ad..eb0d5bef 100644 --- a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp +++ b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp @@ -4,6 +4,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void InsightWorkerTask::execute(TargetControllerConsole& targetControllerConsole) { try { this->state = InsightWorkerTaskState::STARTED; diff --git a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp index 46896da2..0288a92a 100644 --- a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp +++ b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp @@ -24,7 +24,7 @@ namespace Bloom InsightWorkerTask(): QObject(nullptr) {}; - void execute(TargetControllerConsole& targetControllerConsole); + void execute(TargetController::TargetControllerConsole& targetControllerConsole); signals: void started(); @@ -32,6 +32,6 @@ namespace Bloom void completed(); protected: - virtual void run(TargetControllerConsole& targetControllerConsole) = 0; + virtual void run(TargetController::TargetControllerConsole& targetControllerConsole) = 0; }; } diff --git a/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.cpp b/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.cpp index 2b3950a2..4f007f5d 100644 --- a/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.cpp +++ b/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.cpp @@ -11,6 +11,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void QueryLatestVersionNumber::run(TargetControllerConsole& targetControllerConsole) { auto* networkAccessManager = new QNetworkAccessManager(this); auto queryVersionEndpointUrl = QUrl(QString::fromStdString(Paths::homeDomainName() + "/latest-version")); diff --git a/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.hpp b/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.hpp index 919b5478..7e6fd892 100644 --- a/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.hpp +++ b/src/Insight/InsightWorker/Tasks/QueryLatestVersionNumber.hpp @@ -18,7 +18,7 @@ namespace Bloom void latestVersionNumberRetrieved(const VersionNumber& latestVersionNumber); protected: - void run(TargetControllerConsole& targetControllerConsole) override; + void run(TargetController::TargetControllerConsole& targetControllerConsole) override; private: VersionNumber currentVersionNumber; diff --git a/src/Insight/InsightWorker/Tasks/ReadStackPointer.cpp b/src/Insight/InsightWorker/Tasks/ReadStackPointer.cpp index bbe483f2..16073781 100644 --- a/src/Insight/InsightWorker/Tasks/ReadStackPointer.cpp +++ b/src/Insight/InsightWorker/Tasks/ReadStackPointer.cpp @@ -2,6 +2,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void ReadStackPointer::run(TargetControllerConsole& targetControllerConsole) { emit this->stackPointerRead(targetControllerConsole.getStackPointer()); } diff --git a/src/Insight/InsightWorker/Tasks/ReadStackPointer.hpp b/src/Insight/InsightWorker/Tasks/ReadStackPointer.hpp index 35efa23f..6c9d1295 100644 --- a/src/Insight/InsightWorker/Tasks/ReadStackPointer.hpp +++ b/src/Insight/InsightWorker/Tasks/ReadStackPointer.hpp @@ -15,6 +15,6 @@ namespace Bloom void stackPointerRead(std::uint32_t stackPointer); protected: - void run(TargetControllerConsole& targetControllerConsole) override; + void run(TargetController::TargetControllerConsole& targetControllerConsole) override; }; } diff --git a/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp b/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp index 7c0c5d17..6cffdff6 100644 --- a/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp +++ b/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp @@ -2,6 +2,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void ReadTargetMemory::run(TargetControllerConsole& targetControllerConsole) { emit this->targetMemoryRead( targetControllerConsole.readMemory( diff --git a/src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp b/src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp index d09da211..dc39c04f 100644 --- a/src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp +++ b/src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp @@ -28,7 +28,7 @@ namespace Bloom void targetMemoryRead(Targets::TargetMemoryBuffer buffer); protected: - void run(TargetControllerConsole& targetControllerConsole) override; + void run(TargetController::TargetControllerConsole& targetControllerConsole) override; private: Targets::TargetMemoryType memoryType; diff --git a/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.cpp b/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.cpp index eb92a8cf..2415a4ae 100644 --- a/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.cpp +++ b/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.cpp @@ -2,6 +2,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void ReadTargetRegisters::run(TargetControllerConsole& targetControllerConsole) { emit this->targetRegistersRead(targetControllerConsole.readRegisters(this->descriptors)); } diff --git a/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp b/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp index 3c53aacb..e60d6d91 100644 --- a/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp +++ b/src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp @@ -16,7 +16,7 @@ namespace Bloom void targetRegistersRead(Targets::TargetRegisters registers); protected: - void run(TargetControllerConsole& targetControllerConsole) override; + void run(TargetController::TargetControllerConsole& targetControllerConsole) override; private: Targets::TargetRegisterDescriptors descriptors; diff --git a/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.cpp b/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.cpp index c6030e33..b92543c6 100644 --- a/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.cpp +++ b/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.cpp @@ -2,6 +2,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void RefreshTargetPinStates::run(TargetControllerConsole& targetControllerConsole) { emit this->targetPinStatesRetrieved(targetControllerConsole.getPinStates(this->variantId)); } diff --git a/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.hpp b/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.hpp index 8da6e2c5..4a3f6b67 100644 --- a/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.hpp +++ b/src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.hpp @@ -17,7 +17,7 @@ namespace Bloom void targetPinStatesRetrieved(Bloom::Targets::TargetPinStateMappingType pinStatesByNumber); protected: - void run(TargetControllerConsole& targetControllerConsole) override; + void run(TargetController::TargetControllerConsole& targetControllerConsole) override; private: int variantId; diff --git a/src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp b/src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp index ae3f17c0..c63be906 100644 --- a/src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp +++ b/src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp @@ -2,6 +2,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void SetTargetPinState::run(TargetControllerConsole& targetControllerConsole) { targetControllerConsole.setPinState(this->pinDescriptor, this->pinState); } diff --git a/src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp b/src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp index bec29baa..8cb090c5 100644 --- a/src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp +++ b/src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp @@ -14,7 +14,7 @@ namespace Bloom pinDescriptor(pinDescriptor), pinState(pinState) {} protected: - void run(TargetControllerConsole& targetControllerConsole) override; + void run(TargetController::TargetControllerConsole& targetControllerConsole) override; private: Targets::TargetPinDescriptor pinDescriptor; diff --git a/src/Insight/InsightWorker/Tasks/WriteTargetRegister.cpp b/src/Insight/InsightWorker/Tasks/WriteTargetRegister.cpp index ca7a2d42..fb8dbf83 100644 --- a/src/Insight/InsightWorker/Tasks/WriteTargetRegister.cpp +++ b/src/Insight/InsightWorker/Tasks/WriteTargetRegister.cpp @@ -2,6 +2,8 @@ namespace Bloom { + using TargetController::TargetControllerConsole; + void WriteTargetRegister::run(TargetControllerConsole& targetControllerConsole) { targetControllerConsole.writeRegisters({this->targetRegister}); } diff --git a/src/Insight/InsightWorker/Tasks/WriteTargetRegister.hpp b/src/Insight/InsightWorker/Tasks/WriteTargetRegister.hpp index ce61129f..69e8e8ff 100644 --- a/src/Insight/InsightWorker/Tasks/WriteTargetRegister.hpp +++ b/src/Insight/InsightWorker/Tasks/WriteTargetRegister.hpp @@ -13,7 +13,7 @@ namespace Bloom explicit WriteTargetRegister(const Targets::TargetRegister& targetRegister): targetRegister(targetRegister) {} protected: - void run(TargetControllerConsole& targetControllerConsole) override; + void run(TargetController::TargetControllerConsole& targetControllerConsole) override; private: Targets::TargetRegister targetRegister; diff --git a/src/TargetController/TargetControllerComponent.cpp b/src/TargetController/TargetControllerComponent.cpp index 5637c059..fbc54a31 100644 --- a/src/TargetController/TargetControllerComponent.cpp +++ b/src/TargetController/TargetControllerComponent.cpp @@ -14,7 +14,7 @@ #include "src/Exceptions/TargetControllerStartupFailure.hpp" #include "src/Exceptions/InvalidConfig.hpp" -namespace Bloom +namespace Bloom::TargetController { using namespace Bloom::Targets; using namespace Bloom::Events; diff --git a/src/TargetController/TargetControllerComponent.hpp b/src/TargetController/TargetControllerComponent.hpp index 41584723..68c27958 100644 --- a/src/TargetController/TargetControllerComponent.hpp +++ b/src/TargetController/TargetControllerComponent.hpp @@ -20,7 +20,7 @@ #include "src/EventManager/EventListener.hpp" #include "src/EventManager/Events/Events.hpp" -namespace Bloom +namespace Bloom::TargetController { /** * The TargetController possesses full control of the debugging target and the debug tool. diff --git a/src/TargetController/TargetControllerConsole.cpp b/src/TargetController/TargetControllerConsole.cpp index 0f9e0571..9ff25170 100644 --- a/src/TargetController/TargetControllerConsole.cpp +++ b/src/TargetController/TargetControllerConsole.cpp @@ -3,7 +3,7 @@ #include "src/EventManager/Events/Events.hpp" #include "src/Logger/Logger.hpp" -namespace Bloom +namespace Bloom::TargetController { using namespace Bloom::Targets; using namespace Bloom::Events; diff --git a/src/TargetController/TargetControllerConsole.hpp b/src/TargetController/TargetControllerConsole.hpp index ee3e8bfe..eb889f87 100644 --- a/src/TargetController/TargetControllerConsole.hpp +++ b/src/TargetController/TargetControllerConsole.hpp @@ -17,7 +17,7 @@ #include "src/Exceptions/Exception.hpp" -namespace Bloom +namespace Bloom::TargetController { /** * The TargetControllerConsole provides an interface to the TargetController. diff --git a/src/TargetController/TargetControllerState.hpp b/src/TargetController/TargetControllerState.hpp index 045b34f5..cd3a1a9a 100644 --- a/src/TargetController/TargetControllerState.hpp +++ b/src/TargetController/TargetControllerState.hpp @@ -2,7 +2,7 @@ #include -namespace Bloom +namespace Bloom::TargetController { enum class TargetControllerState: std::uint8_t {