Preparation for support for the GDB vCont command packet

Also fixed a bug in the `StepExecution` and `ContinueExecution` constructors, where the from address wasn't being extracted properly
This commit is contained in:
Nav
2023-04-01 12:37:59 +01:00
parent 837f6d0af3
commit 56ea97369d
11 changed files with 40 additions and 22 deletions

View File

@@ -15,9 +15,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
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)
if (this->data.size() > 2) {
this->fromAddress = static_cast<Targets::TargetProgramCounter>(
std::stoi(std::string(this->data.begin() + 2, this->data.end()), nullptr, 16)
);
}
}
@@ -26,7 +26,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
Logger::debug("Handling ContinueExecution packet");
try {
targetControllerService.continueTargetExecution(this->fromProgramCounter);
targetControllerService.continueTargetExecution(this->fromAddress, std::nullopt);
debugSession.waitingForBreak = true;
} catch (const Exception& exception) {

View File

@@ -24,7 +24,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
*
* Although the packet *can* contain this address, it is not required, hence the std::optional type.
*/
std::optional<Targets::TargetProgramCounter> fromProgramCounter;
std::optional<Targets::TargetMemoryAddress> fromAddress;
explicit ContinueExecution(const RawPacket& rawPacket);

View File

@@ -16,9 +16,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
StepExecution::StepExecution(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)
if (this->data.size() > 2) {
this->fromAddress = static_cast<Targets::TargetProgramCounter>(
std::stoi(std::string(this->data.begin() + 2, this->data.end()), nullptr, 16)
);
}
}
@@ -27,7 +27,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
Logger::debug("Handling StepExecution packet");
try {
targetControllerService.stepTargetExecution(this->fromProgramCounter);
targetControllerService.stepTargetExecution(this->fromAddress);
debugSession.waitingForBreak = true;
} catch (const Exception& exception) {

View File

@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
/**
* The address from which to begin the step.
*/
std::optional<Targets::TargetProgramCounter> fromProgramCounter;
std::optional<Targets::TargetMemoryAddress> fromAddress;
explicit StepExecution(const RawPacket& rawPacket);