diff --git a/src/Application.cpp b/src/Application.cpp index d38e46ad..339c8ce0 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -114,6 +114,10 @@ namespace Bloom std::bind(&Application::onDebugServerThreadStateChanged, this, std::placeholders::_1) ); + applicationEventListener->registerCallbackForEventType( + std::bind(&Application::onDebugSessionFinished, this, std::placeholders::_1) + ); + this->startTargetController(); this->startDebugServer(); @@ -449,4 +453,10 @@ namespace Bloom this->shutdown(); } } + + void Application::onDebugSessionFinished(const Events::DebugSessionFinished& event) { + if (this->environmentConfig->shutdownPostDebugSession) { + this->shutdown(); + } + } } diff --git a/src/Application.hpp b/src/Application.hpp index 75223da1..785c9ec2 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -301,5 +301,12 @@ namespace Bloom * @param event */ void onDebugServerThreadStateChanged(const Events::DebugServerThreadStateChanged& event); + + /** + * If configured to do so, Bloom will shutdown upon the end of the current debug session. + * + * @param event + */ + void onDebugSessionFinished(const Events::DebugSessionFinished& event); }; }