Passed target state to GDB command handlers, and removed unnecessary PC read
This commit is contained in:
@@ -38,6 +38,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling ReadRegister packet");
|
||||
@@ -46,12 +47,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Logger::debug("Reading GDB register ID: " + std::to_string(this->registerId));
|
||||
|
||||
if (this->registerId == gdbTargetDescriptor.programCounterGdbRegisterId) {
|
||||
/*
|
||||
* GDB has requested the program counter. We can't access this in the same way as we do with other
|
||||
* registers.
|
||||
*/
|
||||
const auto programCounter = targetControllerService.getProgramCounter();
|
||||
|
||||
const auto programCounter = targetState.programCounter.load().value();
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket{Services::StringService::toHex(Targets::TargetMemoryBuffer{
|
||||
static_cast<unsigned char>(programCounter),
|
||||
|
||||
Reference in New Issue
Block a user