Files
BloomPatched/src/DebugServer/Gdb/CommandPackets/ContinueExecution.cpp

38 lines
1.2 KiB
C++
Raw Normal View History

2021-10-02 17:39:27 +01:00
#include "ContinueExecution.hpp"
2022-03-31 21:52:46 +01:00
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
2021-04-04 21:04:12 +01:00
#include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp"
2021-04-04 21:04:12 +01:00
namespace Bloom::DebugServer::Gdb::CommandPackets
{
using Services::TargetControllerService;
using ResponsePackets::ErrorResponsePacket;
using Exceptions::Exception;
2022-10-01 21:01:37 +01:00
ContinueExecution::ContinueExecution(const RawPacket& rawPacket)
: CommandPacket(rawPacket)
{
if (this->data.size() > 1) {
this->fromProgramCounter = static_cast<Targets::TargetProgramCounter>(
std::stoi(std::string(this->data.begin(), this->data.end()), nullptr, 16)
);
}
2021-04-04 21:04:12 +01:00
}
void ContinueExecution::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
Logger::debug("Handling ContinueExecution packet");
try {
targetControllerService.continueTargetExecution(this->fromProgramCounter);
debugSession.waitingForBreak = true;
} catch (const Exception& exception) {
Logger::error("Failed to continue execution on target - " + exception.getMessage());
debugSession.connection.writePacket(ErrorResponsePacket());
}
}
2021-04-04 21:04:12 +01:00
}