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:
parent
5a9348c75f
commit
33d28a29de
3 changed files with 36 additions and 63 deletions
|
|
@ -110,6 +110,7 @@ function Memory(addr, used, size, type, controller, cpu)
|
|||
this.controller = null;
|
||||
this.cpu = cpu; // If a CPU reference is provided, then this must be an UNPAGED Memory block allocation
|
||||
this.fDirty = this.fDirtyEver = false;
|
||||
this.cReadBreakpoints = this.cWriteBreakpoints = 0;
|
||||
this.setPhysBlock();
|
||||
|
||||
if (BACKTRACK) {
|
||||
|
|
@ -265,8 +266,9 @@ Memory.prototype = {
|
|||
* @this {Memory}
|
||||
* @param {Memory} mem
|
||||
* @param {number} [type]
|
||||
* @param {Debugger} [dbg]
|
||||
*/
|
||||
clone: function(mem, type) {
|
||||
clone: function(mem, type, dbg) {
|
||||
/*
|
||||
* Original memory block IDs are even; cloned memory block IDs are odd;
|
||||
* the original ID of the current block is lost, but that's OK, since it was presumably
|
||||
|
|
@ -279,6 +281,7 @@ Memory.prototype = {
|
|||
this.type = type;
|
||||
this.fReadOnly = (type == Memory.TYPE.ROM);
|
||||
}
|
||||
this.dbg = dbg;
|
||||
if (TYPEDARRAYS) {
|
||||
this.buffer = mem.buffer;
|
||||
this.dv = mem.dv;
|
||||
|
|
@ -471,22 +474,6 @@ Memory.prototype = {
|
|||
this.writeShort = this.fReadOnly? this.writeShortDefault : this.writeShortDirect;
|
||||
this.writeLong = this.fReadOnly? this.writeLongDefault : this.writeLongDirect;
|
||||
},
|
||||
/**
|
||||
* setDebugger(dbg, addr, size)
|
||||
*
|
||||
* @this {Memory}
|
||||
* @param {Debugger} dbg
|
||||
* @param {number} addr of block
|
||||
* @param {number} size of block
|
||||
*/
|
||||
setDebugger: function(dbg, addr, size) {
|
||||
if (DEBUGGER) {
|
||||
this.dbg = dbg;
|
||||
this.cReadBreakpoints = this.cWriteBreakpoints = 0;
|
||||
Component.assert(this.dbg);
|
||||
this.dbg.redoBreakpoints(addr, size);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* getPageBlock(addr, fWrite)
|
||||
*
|
||||
|
|
@ -559,8 +546,8 @@ Memory.prototype = {
|
|||
* existence of a CPU reference only impacts the performance of the "checked" memory access functions, so it's
|
||||
* not critical to eliminate it.
|
||||
*
|
||||
* TODO: Another option would be to count CPU references separately from Debugger references, so that when the
|
||||
* former goes to zero, we can unconditionally remove the CPU reference; UNPAGED blocks would automatically
|
||||
* TODO: Another option would be to count CPU references separately from Debugger references, so that when
|
||||
* the former goes to zero, we can unconditionally remove the CPU reference; UNPAGED blocks would automatically
|
||||
* increment that reference count, so their CPU reference would never go away.
|
||||
*
|
||||
* @this {Memory}
|
||||
|
|
@ -583,6 +570,25 @@ Memory.prototype = {
|
|||
Component.assert(this.cWriteBreakpoints >= 0);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* copyBreakpoints(mem)
|
||||
*
|
||||
* @this {Memory}
|
||||
* @param {Memory|undefined} mem (outgoing Memory block to copy breakpoints from, if any)
|
||||
* @param {Debugger} [dbg]
|
||||
*/
|
||||
copyBreakpoints: function(mem, dbg) {
|
||||
if (mem) {
|
||||
if (dbg) this.dbg = dbg;
|
||||
if (mem.cpu) this.cpu = mem.cpu;
|
||||
if ((this.cReadBreakpoints = mem.cReadBreakpoints)) {
|
||||
this.setReadAccess(Memory.afnChecked, false);
|
||||
}
|
||||
if ((this.cWriteBreakpoints = mem.cWriteBreakpoints)) {
|
||||
this.setWriteAccess(Memory.afnChecked, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* readNone(off)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue