Renamed DebugServer class to DebugServerComponent

This commit is contained in:
Nav
2022-03-31 16:01:43 +01:00
parent 74977804b1
commit e52ef609a4
5 changed files with 15 additions and 15 deletions

View File

@@ -125,7 +125,7 @@ add_executable(Bloom
build/resources/TargetDescriptionFiles/AVR/Mapping.json build/resources/TargetDescriptionFiles/AVR/Mapping.json
# Debug servers # Debug servers
src/DebugServers/DebugServer.cpp src/DebugServers/DebugServerComponent.cpp
src/DebugServers/GdbRsp/GdbRspDebugServer.cpp src/DebugServers/GdbRsp/GdbRspDebugServer.cpp
src/DebugServers/GdbRsp/GdbDebugServerConfig.cpp src/DebugServers/GdbRsp/GdbDebugServerConfig.cpp
src/DebugServers/GdbRsp/Connection.cpp src/DebugServers/GdbRsp/Connection.cpp

View File

@@ -390,12 +390,12 @@ namespace Bloom
} }
void Application::startDebugServer() { void Application::startDebugServer() {
this->debugServer = std::make_unique<DebugServers::DebugServer>( this->debugServer = std::make_unique<DebugServers::DebugServerComponent>(
this->debugServerConfig.value() this->debugServerConfig.value()
); );
this->debugServerThread = std::thread( this->debugServerThread = std::thread(
&DebugServers::DebugServer::run, &DebugServers::DebugServerComponent::run,
this->debugServer.get() this->debugServer.get()
); );

View File

@@ -10,7 +10,7 @@
#include "src/Helpers/Thread.hpp" #include "src/Helpers/Thread.hpp"
#include "src/TargetController/TargetController.hpp" #include "src/TargetController/TargetController.hpp"
#include "src/DebugServers/DebugServer.hpp" #include "src/DebugServers/DebugServerComponent.hpp"
#include "src/Insight/Insight.hpp" #include "src/Insight/Insight.hpp"
#include "src/SignalHandler/SignalHandler.hpp" #include "src/SignalHandler/SignalHandler.hpp"
@@ -85,7 +85,7 @@ namespace Bloom
* *
* See the DebugServer and GdbRspDebugServer class for more on this. * See the DebugServer and GdbRspDebugServer class for more on this.
*/ */
std::unique_ptr<DebugServers::DebugServer> debugServer = nullptr; std::unique_ptr<DebugServers::DebugServerComponent> debugServer = nullptr;
std::thread debugServerThread; std::thread debugServerThread;
/** /**

View File

@@ -1,4 +1,4 @@
#include "DebugServer.hpp" #include "DebugServerComponent.hpp"
#include <variant> #include <variant>
@@ -12,11 +12,11 @@ namespace Bloom::DebugServers
{ {
using namespace Bloom::Events; using namespace Bloom::Events;
DebugServer::DebugServer(const DebugServerConfig& debugServerConfig) DebugServerComponent::DebugServerComponent(const DebugServerConfig& debugServerConfig)
: debugServerConfig(debugServerConfig) : debugServerConfig(debugServerConfig)
{} {}
void DebugServer::run() { void DebugServerComponent::run() {
try { try {
this->startup(); this->startup();
@@ -33,7 +33,7 @@ namespace Bloom::DebugServers
this->shutdown(); this->shutdown();
} }
std::map<std::string, std::function<std::unique_ptr<ServerInterface>()>> DebugServer::getAvailableServersByName() { std::map<std::string, std::function<std::unique_ptr<ServerInterface>()>> DebugServerComponent::getAvailableServersByName() {
return std::map<std::string, std::function<std::unique_ptr<ServerInterface>()>> { return std::map<std::string, std::function<std::unique_ptr<ServerInterface>()>> {
{ {
"avr-gdb-rsp", "avr-gdb-rsp",
@@ -46,7 +46,7 @@ namespace Bloom::DebugServers
}, },
}; };
} }
void DebugServer::startup() { void DebugServerComponent::startup() {
this->setName("DS"); this->setName("DS");
Logger::info("Starting DebugServer"); Logger::info("Starting DebugServer");
@@ -55,7 +55,7 @@ namespace Bloom::DebugServers
// Register event handlers // Register event handlers
this->eventListener->registerCallbackForEventType<Events::ShutdownDebugServer>( this->eventListener->registerCallbackForEventType<Events::ShutdownDebugServer>(
std::bind(&DebugServer::onShutdownDebugServerEvent, this, std::placeholders::_1) std::bind(&DebugServerComponent::onShutdownDebugServerEvent, this, std::placeholders::_1)
); );
static const auto availableServersByName = this->getAvailableServersByName(); static const auto availableServersByName = this->getAvailableServersByName();
@@ -72,7 +72,7 @@ namespace Bloom::DebugServers
this->setThreadStateAndEmitEvent(ThreadState::READY); this->setThreadStateAndEmitEvent(ThreadState::READY);
} }
void DebugServer::shutdown() { void DebugServerComponent::shutdown() {
if (this->getThreadState() == ThreadState::STOPPED if (this->getThreadState() == ThreadState::STOPPED
|| this->getThreadState() == ThreadState::SHUTDOWN_INITIATED || this->getThreadState() == ThreadState::SHUTDOWN_INITIATED
) { ) {
@@ -86,7 +86,7 @@ namespace Bloom::DebugServers
EventManager::deregisterListener(this->eventListener->getId()); EventManager::deregisterListener(this->eventListener->getId());
} }
void DebugServer::onShutdownDebugServerEvent(const Events::ShutdownDebugServer& event) { void DebugServerComponent::onShutdownDebugServerEvent(const Events::ShutdownDebugServer& event) {
this->shutdown(); this->shutdown();
} }
} }

View File

@@ -28,10 +28,10 @@ namespace Bloom::DebugServers
* *
* Bloom currently only supports one DebugServer - the GdbRspDebugServer. * Bloom currently only supports one DebugServer - the GdbRspDebugServer.
*/ */
class DebugServer: public Thread class DebugServerComponent: public Thread
{ {
public: public:
explicit DebugServer(const DebugServerConfig& debugServerConfig); explicit DebugServerComponent(const DebugServerConfig& debugServerConfig);
/** /**
* Entry point for the DebugServer. This must called from a dedicated thread. * Entry point for the DebugServer. This must called from a dedicated thread.