This commit is contained in:
Nav
2024-12-14 16:17:54 +00:00
parent 48a7ae5dd0
commit 9e5d69dee4
5 changed files with 20 additions and 15 deletions

View File

@@ -156,17 +156,17 @@ namespace DebugServer::Gdb::AvrGdb
return output; return output;
} }
void AvrGdbRsp::handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programAddress) { void AvrGdbRsp::handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programCounter) {
using Services::StringService; using Services::StringService;
Logger::debug("Target stopped at byte address: 0x" + StringService::toHex(programAddress)); Logger::debug("Target stopped at byte address: 0x" + StringService::toHex(programCounter));
auto& activeRangeSteppingSession = this->debugSession->activeRangeSteppingSession; auto& activeRangeSteppingSession = this->debugSession->activeRangeSteppingSession;
if ( if (
activeRangeSteppingSession.has_value() activeRangeSteppingSession.has_value()
&& programAddress >= activeRangeSteppingSession->range.startAddress && programCounter >= activeRangeSteppingSession->range.startAddress
&& programAddress < activeRangeSteppingSession->range.endAddress && programCounter < activeRangeSteppingSession->range.endAddress
) { ) {
/* /*
* The target stopped within the stepping range of an active range stepping session. * The target stopped within the stepping range of an active range stepping session.
@@ -176,7 +176,7 @@ namespace DebugServer::Gdb::AvrGdb
if ( if (
this->debugSession->externalBreakpointRegistry.contains( this->debugSession->externalBreakpointRegistry.contains(
activeRangeSteppingSession->addressSpaceDescriptor.id, activeRangeSteppingSession->addressSpaceDescriptor.id,
programAddress programCounter
) )
) { ) {
/* /*
@@ -187,10 +187,10 @@ namespace DebugServer::Gdb::AvrGdb
Logger::debug("Reached external breakpoint within stepping range"); Logger::debug("Reached external breakpoint within stepping range");
this->debugSession->terminateRangeSteppingSession(this->targetControllerService); this->debugSession->terminateRangeSteppingSession(this->targetControllerService);
return GdbRspDebugServer::handleTargetStoppedGdbResponse(programAddress); return GdbRspDebugServer::handleTargetStoppedGdbResponse(programCounter);
} }
if (activeRangeSteppingSession->interceptedAddresses.contains(programAddress)) { if (activeRangeSteppingSession->interceptedAddresses.contains(programCounter)) {
/* /*
* The target stopped due to an intercepting breakpoint, but we're still within the stepping range, * The target stopped due to an intercepting breakpoint, but we're still within the stepping range,
* which can only mean that we weren't sure where this instruction would lead to. * which can only mean that we weren't sure where this instruction would lead to.
@@ -199,7 +199,7 @@ namespace DebugServer::Gdb::AvrGdb
* range, we'll end the session and report back to GDB. * range, we'll end the session and report back to GDB.
*/ */
Logger::debug("Reached intercepting breakpoint within stepping range"); Logger::debug("Reached intercepting breakpoint within stepping range");
Logger::debug("Attempting single step from 0x" + StringService::toHex(programAddress)); Logger::debug("Attempting single step from 0x" + StringService::toHex(programCounter));
activeRangeSteppingSession->singleStepping = true; activeRangeSteppingSession->singleStepping = true;
this->targetControllerService.stepTargetExecution(); this->targetControllerService.stepTargetExecution();
@@ -232,6 +232,6 @@ namespace DebugServer::Gdb::AvrGdb
} }
// Report the stop to GDB // Report the stop to GDB
return GdbRspDebugServer::handleTargetStoppedGdbResponse(programAddress); return GdbRspDebugServer::handleTargetStoppedGdbResponse(programCounter);
} }
} }

View File

@@ -27,6 +27,6 @@ namespace DebugServer::Gdb::AvrGdb
const RawPacket& rawPacket const RawPacket& rawPacket
) override; ) override;
std::set<std::pair<Feature, std::optional<std::string>>> getSupportedFeatures() override; std::set<std::pair<Feature, std::optional<std::string>>> getSupportedFeatures() override;
void handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programAddress) override; void handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programCounter) override;
}; };
} }

View File

@@ -573,7 +573,7 @@ namespace DebugServer::Gdb
} }
} }
virtual void handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programAddress) { virtual void handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programCounter) {
if (this->debugSession->activeRangeSteppingSession.has_value()) { if (this->debugSession->activeRangeSteppingSession.has_value()) {
this->debugSession->terminateRangeSteppingSession(this->targetControllerService); this->debugSession->terminateRangeSteppingSession(this->targetControllerService);
} }

View File

@@ -103,7 +103,7 @@ namespace Targets::Microchip::Avr8
&& this->targetConfig.physicalInterface != TargetPhysicalInterface::JTAG && this->targetConfig.physicalInterface != TargetPhysicalInterface::JTAG
) { ) {
Logger::warning( Logger::warning(
"The 'manageOcdenFuseBit' parameter only applies to JTAG targets. It will be ignored in this session." "The 'manage_ocden_fuse_bit' parameter only applies to JTAG targets. It will be ignored in this session."
); );
} }
} }

View File

@@ -6,6 +6,7 @@
#include "src/Exceptions/InvalidConfig.hpp" #include "src/Exceptions/InvalidConfig.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Services/StringService.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
namespace Targets::RiscV::Wch namespace Targets::RiscV::Wch
@@ -256,6 +257,8 @@ namespace Targets::RiscV::Wch
} }
TargetMemoryAddress WchRiscV::getProgramCounter() { TargetMemoryAddress WchRiscV::getProgramCounter() {
using Services::StringService;
const auto programCounter = RiscV::getProgramCounter(); const auto programCounter = RiscV::getProgramCounter();
if (this->mappedSegmentDescriptor.addressRange.contains(programCounter)) { if (this->mappedSegmentDescriptor.addressRange.contains(programCounter)) {
@@ -283,12 +286,14 @@ namespace Targets::RiscV::Wch
* aliased address. That way, it will be clear to all external entities, that the target is currently * aliased address. That way, it will be clear to all external entities, that the target is currently
* executing code in a different memory segment to the one that was selected for debugging. * executing code in a different memory segment to the one that was selected for debugging.
*/ */
const auto transformedAddress = this->transformMappedAddress(programCounter, actualAliasedSegment);
Logger::warning( Logger::warning(
"The mapped program memory segment is currently aliasing a foreign segment (\"" "The mapped program memory segment is currently aliasing a foreign segment (\""
+ actualAliasedSegment.key + "\") - the program counter will be transformed to its aliased" + actualAliasedSegment.key + "\") - the program counter (0x"
" address" + StringService::toHex(programCounter) + ") has been transformed to the aliased address (0x"
+ StringService::toHex(transformedAddress) + ")"
); );
return this->transformMappedAddress(programCounter, actualAliasedSegment); return transformedAddress;
} }
} }