Tidying
This commit is contained in:
@@ -100,10 +100,10 @@ namespace DebugServer::Gdb
|
|||||||
, eventListener(eventListener)
|
, eventListener(eventListener)
|
||||||
, interruptEventNotifier(eventNotifier)
|
, interruptEventNotifier(eventNotifier)
|
||||||
, targetState(this->targetControllerService.getTargetState())
|
, targetState(this->targetControllerService.getTargetState())
|
||||||
{};
|
{}
|
||||||
|
|
||||||
GdbRspDebugServer() = delete;
|
GdbRspDebugServer() = delete;
|
||||||
virtual ~GdbRspDebugServer() = default;
|
~GdbRspDebugServer() override = default;
|
||||||
|
|
||||||
GdbRspDebugServer(const GdbRspDebugServer& other) = delete;
|
GdbRspDebugServer(const GdbRspDebugServer& other) = delete;
|
||||||
GdbRspDebugServer(GdbRspDebugServer&& other) = delete;
|
GdbRspDebugServer(GdbRspDebugServer&& other) = delete;
|
||||||
@@ -111,9 +111,6 @@ namespace DebugServer::Gdb
|
|||||||
GdbRspDebugServer& operator = (const GdbRspDebugServer& other) = delete;
|
GdbRspDebugServer& operator = (const GdbRspDebugServer& other) = delete;
|
||||||
GdbRspDebugServer& operator = (GdbRspDebugServer&& other) = delete;
|
GdbRspDebugServer& operator = (GdbRspDebugServer&& other) = delete;
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepares the GDB server for listing on the selected address and port.
|
|
||||||
*/
|
|
||||||
void init() override {
|
void init() override {
|
||||||
this->socketAddress.sin_family = AF_INET;
|
this->socketAddress.sin_family = AF_INET;
|
||||||
this->socketAddress.sin_port = htons(this->debugServerConfig.listeningPortNumber);
|
this->socketAddress.sin_port = htons(this->debugServerConfig.listeningPortNumber);
|
||||||
@@ -189,9 +186,6 @@ namespace DebugServer::Gdb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminates any active debug session and closes the listening socket.
|
|
||||||
*/
|
|
||||||
void close() override {
|
void close() override {
|
||||||
this->endDebugSession();
|
this->endDebugSession();
|
||||||
|
|
||||||
@@ -200,11 +194,6 @@ namespace DebugServer::Gdb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Waits for a connection from a GDB client or services an active one.
|
|
||||||
*
|
|
||||||
* This function will return when any blocking operation is interrupted via this->interruptEventNotifier.
|
|
||||||
*/
|
|
||||||
void run() override {
|
void run() override {
|
||||||
try {
|
try {
|
||||||
if (!this->debugSession.has_value()) {
|
if (!this->debugSession.has_value()) {
|
||||||
@@ -443,10 +432,6 @@ namespace DebugServer::Gdb
|
|||||||
|
|
||||||
const auto rawPacketString = std::string{rawPacket.begin() + 1, rawPacket.end()};
|
const auto rawPacketString = std::string{rawPacket.begin() + 1, rawPacket.end()};
|
||||||
|
|
||||||
/*
|
|
||||||
* First byte of the raw packet will be 0x24 ('$'), so std::string::find() should return 1, not 0, when
|
|
||||||
* looking for a command identifier string.
|
|
||||||
*/
|
|
||||||
if (rawPacketString.find("qSupported") == 0) {
|
if (rawPacketString.find("qSupported") == 0) {
|
||||||
return std::make_unique<CommandPackets::SupportedFeaturesQuery>(rawPacket);
|
return std::make_unique<CommandPackets::SupportedFeaturesQuery>(rawPacket);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink::Commands::Control
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AttachTarget()
|
AttachTarget()
|
||||||
: Command(0x0d)
|
: Command(0x0D)
|
||||||
{
|
{
|
||||||
this->payload = {
|
this->payload = {
|
||||||
0x02
|
0x02
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink::Commands::Control
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DetachTarget()
|
DetachTarget()
|
||||||
: Command(0x0d)
|
: Command(0x0D)
|
||||||
{
|
{
|
||||||
this->payload = {
|
this->payload = {
|
||||||
0xff
|
0xFF
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink::Commands::Control
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GetDeviceInfo()
|
GetDeviceInfo()
|
||||||
: Command(0x0d)
|
: Command(0x0D)
|
||||||
{
|
{
|
||||||
this->payload = {
|
this->payload = {
|
||||||
0x01
|
0x01
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink::Commands::Control
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PostAttach()
|
PostAttach()
|
||||||
: Command(0x0d)
|
: Command(0x0D)
|
||||||
{
|
{
|
||||||
this->payload = {
|
this->payload = {
|
||||||
0x03
|
0x03
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink::Commands
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetClockSpeed(std::uint8_t targetGroupId, std::uint8_t speedId)
|
SetClockSpeed(std::uint8_t targetGroupId, std::uint8_t speedId)
|
||||||
: Command(0x0c)
|
: Command(0x0C)
|
||||||
{
|
{
|
||||||
this->payload = {
|
this->payload = {
|
||||||
targetGroupId,
|
targetGroupId,
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ namespace DebugToolDrivers::Wch
|
|||||||
* to the block size could result in breaching the boundary of the segment.
|
* to the block size could result in breaching the boundary of the segment.
|
||||||
*
|
*
|
||||||
* For example, the CH32X035 has a block size of 4096, but its main program segment (`main_program`) has a
|
* For example, the CH32X035 has a block size of 4096, but its main program segment (`main_program`) has a
|
||||||
* capacity of 62KiB (63488 bytes), which is not a multiple of 4096. This means we cannot access the final,
|
* capacity of 62 KiB (63488 bytes), which is not a multiple of 4096. This means we cannot access the final,
|
||||||
* partial block of that segment, via a full block write.
|
* partial block of that segment, via a full block write.
|
||||||
*
|
*
|
||||||
* Some segments on some WCH RISC-V targets don't even have the capacity to accommodate the block size.
|
* Some segments on some WCH RISC-V targets don't even have the capacity to accommodate the block size.
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ void InsightWindow::selectDefaultVariant() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logger::error(
|
Logger::error(
|
||||||
"Unsupported target variant (\"" + descriptor.name + "\") provided via 'defaultVariantKey' parameter"
|
"Unsupported target variant (\"" + descriptor.name + "\") provided via 'default_variant_key' parameter"
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -243,11 +243,9 @@ namespace Targets::Microchip::Avr8
|
|||||||
) {
|
) {
|
||||||
Logger::debug("Attempting OCDEN fuse bit management");
|
Logger::debug("Attempting OCDEN fuse bit management");
|
||||||
this->updateOcdenFuseBit(false);
|
this->updateOcdenFuseBit(false);
|
||||||
|
|
||||||
} else {
|
|
||||||
this->avr8DebugInterface->deactivate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->avr8DebugInterface->deactivate();
|
||||||
this->activated = false;
|
this->activated = false;
|
||||||
|
|
||||||
} catch (const Exception& exception) {
|
} catch (const Exception& exception) {
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ namespace Targets::RiscV::Opcodes
|
|||||||
|
|
||||||
enum class GprNumber: std::uint8_t
|
enum class GprNumber: std::uint8_t
|
||||||
{
|
{
|
||||||
X0 = 0, X2 = 2, X3 = 3, X4 = 4, X5 = 5, X6 = 6, X7 = 7, X8 = 8, X9 = 9, X10 = 10, X11 = 11, X12 = 12, X13 = 13,
|
X0 = 0, X1 = 1, X2 = 2, X3 = 3, X4 = 4, X5 = 5, X6 = 6, X7 = 7, X8 = 8, X9 = 9, X10 = 10, X11 = 11, X12 = 12,
|
||||||
X14 = 14, X15 = 15, X16 = 16, X17 = 17, X18 = 18, X19 = 19, X20 = 20, X21 = 21, X22 = 22, X23 = 23, X24 = 24,
|
X13 = 13, X14 = 14, X15 = 15, X16 = 16, X17 = 17, X18 = 18, X19 = 19, X20 = 20, X21 = 21, X22 = 22, X23 = 23,
|
||||||
X25 = 25, X26 = 26, X27 = 27, X28 = 28, X29 = 29, X30 = 30, X31 = 31,
|
X24 = 24, X25 = 25, X26 = 26, X27 = 27, X28 = 28, X29 = 29, X30 = 30, X31 = 31,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr auto Ebreak = Opcode{0x00100073};
|
static constexpr auto Ebreak = Opcode{0x00100073};
|
||||||
static constexpr auto EbreakCompressed = OpcodeCompressed{0x9002};
|
static constexpr auto EbreakCompressed = OpcodeCompressed{0x9002};
|
||||||
|
|
||||||
static constexpr auto Fence = Opcode{0x0000000f};
|
static constexpr auto Fence = Opcode{0x0000000F};
|
||||||
static constexpr auto FenceI = Opcode{0x0000100f};
|
static constexpr auto FenceI = Opcode{0x0000100F};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,11 +272,7 @@ namespace Targets::RiscV::Wch
|
|||||||
const auto& aliasedSegment = this->selectedProgramSegmentDescriptor;
|
const auto& aliasedSegment = this->selectedProgramSegmentDescriptor;
|
||||||
const auto transformedAddress = this->deAliasMappedAddress(startAddress, aliasedSegment);
|
const auto transformedAddress = this->deAliasMappedAddress(startAddress, aliasedSegment);
|
||||||
|
|
||||||
const auto addressRange = TargetMemoryAddressRange{
|
const auto addressRange = TargetMemoryAddressRange{transformedAddress, transformedAddress + bytes - 1};
|
||||||
transformedAddress,
|
|
||||||
static_cast<TargetMemoryAddress>(transformedAddress + bytes - 1)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!aliasedSegment.addressRange.contains(addressRange)) {
|
if (!aliasedSegment.addressRange.contains(addressRange)) {
|
||||||
throw Exceptions::Exception{
|
throw Exceptions::Exception{
|
||||||
"Read access range (0x" + StringService::toHex(addressRange.startAddress) + " -> 0x"
|
"Read access range (0x" + StringService::toHex(addressRange.startAddress) + " -> 0x"
|
||||||
|
|||||||
Reference in New Issue
Block a user