New GDB monitor command for Insight activation.
Created GdbHelpMonitorInfo.txt.in template for conditional commands
This commit is contained in:
40
src/DebugServer/Gdb/CommandPackets/ActivateInsight.cpp
Normal file
40
src/DebugServer/Gdb/CommandPackets/ActivateInsight.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "ActivateInsight.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
#include "src/EventManager/EventManager.hpp"
|
||||
#include "src/EventManager/Events/InsightActivationRequested.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ResponsePacket;
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using Bloom::Exceptions::Exception;
|
||||
|
||||
ActivateInsight::ActivateInsight(Monitor&& monitorPacket)
|
||||
: Monitor(std::move(monitorPacket))
|
||||
{}
|
||||
|
||||
void ActivateInsight::handle(DebugSession& debugSession, TargetControllerService&) {
|
||||
Logger::info("Handling ActivateInsight packet");
|
||||
|
||||
try {
|
||||
EventManager::triggerEvent(std::make_shared<Events::InsightActivationRequested>());
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(Services::StringService::toHex(
|
||||
"Insight requested\n"
|
||||
)));
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to activate Insight - " + exception.getMessage());
|
||||
debugSession.connection.writePacket(ErrorResponsePacket());
|
||||
}
|
||||
}
|
||||
}
|
||||
22
src/DebugServer/Gdb/CommandPackets/ActivateInsight.hpp
Normal file
22
src/DebugServer/Gdb/CommandPackets/ActivateInsight.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "Monitor.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
/**
|
||||
* The ActivateInsight class implements a structure for the "monitor insight" GDB command.
|
||||
*
|
||||
* This command will activate the Insight GUI.
|
||||
*/
|
||||
class ActivateInsight: public Monitor
|
||||
{
|
||||
public:
|
||||
explicit ActivateInsight(Monitor&& monitorPacket);
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
@@ -34,9 +34,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
* See src/DebugServer/CMakeLists.txt for more.
|
||||
*/
|
||||
auto helpFile = QFile(
|
||||
QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath() + "/src/DebugServer/Gdb/Resources/GdbHelpMonitorInfo.txt"
|
||||
)
|
||||
QString::fromStdString(":/compiled/src/DebugServer/Gdb/Resources/GdbHelpMonitorInfo.txt")
|
||||
);
|
||||
|
||||
if (!helpFile.open(QIODevice::ReadOnly)) {
|
||||
|
||||
Reference in New Issue
Block a user