Made VCont step/continue command handlers generic (non-target-specific)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#include "VContContinueExecution.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
|
||||
using ::Exceptions::Exception;
|
||||
|
||||
VContContinueExecution::VContContinueExecution(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void VContContinueExecution::handle(
|
||||
DebugSession& debugSession,
|
||||
const TargetDescriptor& 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{});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::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 CommandPacket
|
||||
{
|
||||
public:
|
||||
explicit VContContinueExecution(const RawPacket& rawPacket);
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
const TargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
34
src/DebugServer/Gdb/CommandPackets/VContStepExecution.cpp
Normal file
34
src/DebugServer/Gdb/CommandPackets/VContStepExecution.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "VContStepExecution.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
|
||||
using ::Exceptions::Exception;
|
||||
|
||||
VContStepExecution::VContStepExecution(const RawPacket& rawPacket)
|
||||
: CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void VContStepExecution::handle(
|
||||
DebugSession& debugSession,
|
||||
const TargetDescriptor& 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{});
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/DebugServer/Gdb/CommandPackets/VContStepExecution.hpp
Normal file
24
src/DebugServer/Gdb/CommandPackets/VContStepExecution.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "CommandPacket.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
/**
|
||||
* The VContStepExecution class implements a structure for "vCont;s" and "vCont;S" packets.
|
||||
*/
|
||||
class VContStepExecution: public CommandPacket
|
||||
{
|
||||
public:
|
||||
explicit VContStepExecution(const RawPacket& rawPacket);
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
const TargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user