Passed target state to GDB command handlers, and removed unnecessary PC read
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "src/DebugServer/Gdb/DebugSession.hpp"
|
||||
#include "src/DebugServer/Gdb/AvrGdb/AvrGdbTargetDescriptor.hpp"
|
||||
#include "src/Targets/TargetDescriptor.hpp"
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
@@ -25,6 +26,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) = 0;
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling EepromFill packet");
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling FlashDone packet");
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling FlashErase packet");
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling FlashWrite packet");
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling ReadMemory packet");
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling ReadMemoryMap packet");
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling ReadRegister packet");
|
||||
@@ -46,12 +47,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
Logger::debug("Reading GDB register ID: " + std::to_string(this->registerId));
|
||||
|
||||
if (this->registerId == AvrGdbTargetDescriptor::PROGRAM_COUNTER_GDB_REGISTER_ID) {
|
||||
/*
|
||||
* 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),
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling ReadRegisters packet");
|
||||
@@ -76,7 +77,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
buffer[33] = static_cast<unsigned char>(spValue);
|
||||
buffer[34] = static_cast<unsigned char>(spValue >> 8);
|
||||
|
||||
const auto pcValue = targetControllerService.getProgramCounter();
|
||||
const auto pcValue = targetState.programCounter.load().value();
|
||||
buffer[35] = static_cast<unsigned char>(pcValue);
|
||||
buffer[36] = static_cast<unsigned char>(pcValue >> 8);
|
||||
buffer[37] = static_cast<unsigned char>(pcValue >> 16);
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor&,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling RemoveBreakpoint packet");
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor&,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling SetBreakpoint packet");
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
using Targets::Microchip::Avr8::OpcodeDecoder::Decoder;
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling VContSupportedActionsQuery packet");
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling WriteMemory packet");
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling WriteRegister packet");
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const AvrGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "src/Services/ProcessService.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Targets/TargetDescriptor.hpp"
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/EventManager/Events/TargetStateChanged.hpp"
|
||||
@@ -104,6 +105,7 @@ namespace DebugServer::Gdb
|
||||
, gdbTargetDescriptor(std::move(gdbTargetDescriptor))
|
||||
, eventListener(eventListener)
|
||||
, interruptEventNotifier(eventNotifier)
|
||||
, targetState(this->targetControllerService.getTargetState())
|
||||
{};
|
||||
|
||||
GdbRspDebugServer() = delete;
|
||||
@@ -238,6 +240,7 @@ namespace DebugServer::Gdb
|
||||
*(this->debugSession),
|
||||
this->gdbTargetDescriptor,
|
||||
this->targetDescriptor,
|
||||
this->targetState,
|
||||
this->targetControllerService
|
||||
);
|
||||
|
||||
@@ -321,6 +324,8 @@ namespace DebugServer::Gdb
|
||||
|
||||
Services::TargetControllerService targetControllerService = {};
|
||||
|
||||
const Targets::TargetState& targetState;
|
||||
|
||||
struct sockaddr_in socketAddress = {};
|
||||
std::optional<int> serverSocketFileDescriptor;
|
||||
|
||||
|
||||
@@ -23,6 +23,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 FlashDone packet");
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -40,6 +40,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 FlashErase packet");
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -43,6 +43,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 FlashWrite packet");
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,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 ReadMemory packet");
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
using Targets::TargetMemorySegmentType;
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,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 ReadRegisters packet");
|
||||
@@ -58,13 +59,11 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
|
||||
assert((buffer.size() - bufferOffset) >= regVal.size());
|
||||
|
||||
/*
|
||||
* GDB expects register values in LSB form, which is why we use reverse iterators below.
|
||||
*/
|
||||
// GDB expects register values in LSB form, which is why we use reverse iterators below.
|
||||
std::copy(regVal.rbegin(), regVal.rend(), buffer.begin() + bufferOffset);
|
||||
}
|
||||
|
||||
const auto pcValue = targetControllerService.getProgramCounter();
|
||||
const auto pcValue = targetState.programCounter.load().value();
|
||||
buffer[totalRegBytes - 4] = static_cast<unsigned char>(pcValue);
|
||||
buffer[totalRegBytes - 3] = static_cast<unsigned char>(pcValue >> 8);
|
||||
buffer[totalRegBytes - 2] = static_cast<unsigned char>(pcValue >> 16);
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor&,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling RemoveBreakpoint packet");
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "src/DebugServer/Gdb/DebugSession.hpp"
|
||||
#include "src/DebugServer/Gdb/RiscVGdb/RiscVGdbTargetDescriptor.hpp"
|
||||
#include "src/Targets/TargetDescriptor.hpp"
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
@@ -13,18 +14,11 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
public:
|
||||
virtual ~RiscVGdbCommandPacketInterface() = default;
|
||||
|
||||
/**
|
||||
* Should handle the command for the current active debug session.
|
||||
*
|
||||
* @param debugSession
|
||||
* The current active debug session.
|
||||
*
|
||||
* @param TargetControllerService
|
||||
*/
|
||||
virtual void handle(
|
||||
DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) = 0;
|
||||
};
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor&,
|
||||
const Targets::TargetState& targetState,
|
||||
TargetControllerService& targetControllerService
|
||||
) {
|
||||
Logger::info("Handling SetBreakpoint packet");
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -16,6 +16,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 VContSupportedActionsQuery packet");
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
@@ -24,6 +24,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 WriteMemory packet");
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
|
||||
@@ -49,6 +49,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 WriteRegister packet");
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace DebugServer::Gdb::RiscVGdb::CommandPackets
|
||||
Gdb::DebugSession& debugSession,
|
||||
const RiscVGdbTargetDescriptor& gdbTargetDescriptor,
|
||||
const Targets::TargetDescriptor& targetDescriptor,
|
||||
const Targets::TargetState& targetState,
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user