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
|
|
|
|
2022-03-24 19:17:41 +00:00
|
|
|
#include "src/Logger/Logger.hpp"
|
|
|
|
|
#include "src/Exceptions/Exception.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-03-31 16:05:39 +01:00
|
|
|
namespace Bloom::DebugServer::Gdb::CommandPackets
|
2022-02-05 15:32:08 +00:00
|
|
|
{
|
2022-04-09 15:57:24 +01:00
|
|
|
using TargetController::TargetControllerConsole;
|
|
|
|
|
|
2022-03-24 19:17:41 +00:00
|
|
|
using ResponsePackets::ErrorResponsePacket;
|
|
|
|
|
using Exceptions::Exception;
|
2021-10-06 21:12:31 +01:00
|
|
|
|
2022-04-08 23:39:51 +01:00
|
|
|
ContinueExecution::ContinueExecution(const RawPacketType& rawPacket)
|
2022-04-03 17:25:21 +01:00
|
|
|
: CommandPacket(rawPacket)
|
|
|
|
|
{
|
2022-02-05 15:32:08 +00:00
|
|
|
if (this->data.size() > 1) {
|
|
|
|
|
this->fromProgramCounter = static_cast<std::uint32_t>(
|
|
|
|
|
std::stoi(std::string(this->data.begin(), this->data.end()), nullptr, 16)
|
|
|
|
|
);
|
|
|
|
|
}
|
2021-04-04 21:04:12 +01:00
|
|
|
}
|
2022-03-24 19:17:41 +00:00
|
|
|
|
|
|
|
|
void ContinueExecution::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
|
|
|
|
Logger::debug("Handling ContinueExecution packet");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
targetControllerConsole.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
|
|
|
}
|