Made VCont step/continue command handlers generic (non-target-specific)
This commit is contained in:
@@ -13,8 +13,6 @@
|
||||
#include "CommandPackets/FlashWrite.hpp"
|
||||
#include "CommandPackets/FlashDone.hpp"
|
||||
#include "CommandPackets/VContSupportedActionsQuery.hpp"
|
||||
#include "CommandPackets/VContContinueExecution.hpp"
|
||||
#include "CommandPackets/VContStepExecution.hpp"
|
||||
#include "CommandPackets/VContRangeStep.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/CommandPackets/Monitor.hpp"
|
||||
@@ -56,8 +54,6 @@ namespace DebugServer::Gdb::AvrGdb
|
||||
using CommandPackets::FlashWrite;
|
||||
using CommandPackets::FlashDone;
|
||||
using CommandPackets::VContSupportedActionsQuery;
|
||||
using CommandPackets::VContContinueExecution;
|
||||
using CommandPackets::VContStepExecution;
|
||||
using CommandPackets::VContRangeStep;
|
||||
using CommandPackets::EepromFill;
|
||||
|
||||
@@ -108,14 +104,6 @@ namespace DebugServer::Gdb::AvrGdb
|
||||
return std::make_unique<VContSupportedActionsQuery>(rawPacket);
|
||||
}
|
||||
|
||||
if (rawPacketString.find("vCont;c") == 0 || rawPacketString.find("vCont;C") == 0) {
|
||||
return std::make_unique<VContContinueExecution>(rawPacket);
|
||||
}
|
||||
|
||||
if (rawPacketString.find("vCont;s") == 0 || rawPacketString.find("vCont;S") == 0) {
|
||||
return std::make_unique<VContStepExecution>(rawPacket);
|
||||
}
|
||||
|
||||
if (this->debugServerConfig.rangeStepping) {
|
||||
if (rawPacketString.find("vCont;r") == 0) {
|
||||
return std::make_unique<VContRangeStep>(rawPacket);
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "VContContinueExecution.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
|
||||
using ::Exceptions::Exception;
|
||||
|
||||
VContContinueExecution::VContContinueExecution(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void VContContinueExecution::handle(
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling VContContinueExecution packet");
|
||||
|
||||
try {
|
||||
targetControllerService.resumeTargetExecution();
|
||||
debugSession.waitingForBreak = true;
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to continue execution on target - " + exception.getMessage());
|
||||
debugSession.connection.writePacket(ErrorResponsePacket{});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
/**
|
||||
* The VContContinueExecution class implements a structure for "vCont;c" and "vCont;C" packets. These packets
|
||||
* instruct the server to continue execution on the target.
|
||||
*/
|
||||
class VContContinueExecution: public CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
explicit VContContinueExecution(const RawPacket& rawPacket);
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "VContStepExecution.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
|
||||
using ::Exceptions::Exception;
|
||||
|
||||
VContStepExecution::VContStepExecution(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void VContStepExecution::handle(
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling VContStepExecution packet");
|
||||
|
||||
try {
|
||||
targetControllerService.stepTargetExecution();
|
||||
debugSession.waitingForBreak = true;
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to step execution on target - " + exception.getMessage());
|
||||
debugSession.connection.writePacket(ErrorResponsePacket{});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
/**
|
||||
* The VContStepExecution class implements a structure for "vCont;s" and "vCont;S" packets.
|
||||
*/
|
||||
class VContStepExecution: public CommandPackets::CommandPacket
|
||||
{
|
||||
public:
|
||||
explicit VContStepExecution(const RawPacket& rawPacket);
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user