Improved preservation of read/write breakpoints in dynamic memory regions

The old solution was Debugger-specific (ie, redoBreakpoints), the new solution works for both the Debugger and for Debug register support
This commit is contained in:
Jeff Parsons 2015-08-06 11:25:56 -07:00
commit 33d28a29de
3 changed files with 36 additions and 63 deletions

View file

@ -3234,36 +3234,6 @@ if (DEBUGGER) {
return aBreak.length - 1;
};
/**
* redoBreakpoints()
*
* This function is for the Memory component: whenever the Bus allocates a new Memory block, it calls
* the block's setDebugger() method, which clears the memory block's breakpoint counts. setDebugger(),
* in turn, must call this function to re-apply any existing breakpoints to that block.
*
* This ensures that, even if a memory region is remapped (which creates new Memory blocks in the process),
* any breakpoints that were previously applied to that region will still work.
*
* @this {Debugger}
* @param {number} addr of memory block
* @param {number} size of memory block
* @param {Array} [aBreak]
*/
Debugger.prototype.redoBreakpoints = function(addr, size, aBreak)
{
if (aBreak === undefined) {
this.redoBreakpoints(addr, size, this.aBreakRead);
this.redoBreakpoints(addr, size, this.aBreakWrite);
return;
}
for (var i = 1; i < aBreak.length; i++) {
var addrBreak = this.getAddr(aBreak[i]);
if (addrBreak >= addr && addrBreak < addr + size) {
this.bus.addMemBreak(addrBreak, aBreak == this.aBreakWrite);
}
}
};
/**
* setTempBreakpoint(dbgAddr)
*