WCH RISC-V software breakpoints, and a few other bits of refactoring/tidying

This commit is contained in:
Nav
2024-12-05 23:09:01 +00:00
parent 966244a01a
commit 33ed399337
55 changed files with 1530 additions and 686 deletions

View File

@@ -242,6 +242,8 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr
void EdbgAvr8Interface::deactivate() {
if (this->targetAttached) {
this->clearAllBreakpoints();
if (
this->session.targetConfig.physicalInterface == TargetPhysicalInterface::DEBUG_WIRE
&& this->session.targetConfig.disableDebugWireOnDeactivate
@@ -429,15 +431,6 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr
this->hardwareBreakpointNumbersByAddress.erase(address);
}
void EdbgAvr8Interface::clearAllBreakpoints() {
this->clearAllSoftwareBreakpoints();
// Clear all hardware breakpoints
while (!this->hardwareBreakpointNumbersByAddress.empty()) {
this->clearHardwareBreakpoint(this->hardwareBreakpointNumbersByAddress.begin()->first);
}
}
TargetRegisterDescriptorAndValuePairs EdbgAvr8Interface::readRegisters(
const Targets::TargetRegisterDescriptors& descriptors
) {
@@ -1244,6 +1237,15 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr
}
}
void EdbgAvr8Interface::clearAllBreakpoints() {
this->clearAllSoftwareBreakpoints();
// Clear all hardware breakpoints
while (!this->hardwareBreakpointNumbersByAddress.empty()) {
this->clearHardwareBreakpoint(this->hardwareBreakpointNumbersByAddress.begin()->first);
}
}
std::unique_ptr<AvrEvent> EdbgAvr8Interface::getAvrEvent() {
auto event = this->edbgInterface->requestAvrEvent();

View File

@@ -201,14 +201,6 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr
*/
void clearHardwareBreakpoint(Targets::TargetMemoryAddress address) override;
/**
* Clears all software and hardware breakpoints on the target.
*
* This function will not clear any untracked hardware breakpoints (breakpoints that were installed in a
* previous session).
*/
void clearAllBreakpoints() override;
/**
* Reads registers from the target.
*
@@ -463,6 +455,14 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr
*/
void clearAllSoftwareBreakpoints();
/**
* Clears all software and hardware breakpoints on the target.
*
* This function will not clear any untracked hardware breakpoints (breakpoints that were installed in a
* previous session).
*/
void clearAllBreakpoints();
/**
* Fetches any queued events belonging to the AVR8 Generic protocol (such as target break events).
*