Debugger now stops on undefined opcodes, as well as on unknown I/O accesses

This commit is contained in:
Jeff Parsons 2016-10-15 11:32:51 -07:00 committed by Jeff Parsons
commit c14f919f4f
5 changed files with 232 additions and 195 deletions

View file

@ -1607,6 +1607,37 @@ if (DEBUGGER) {
return false;
};
/**
* stopInstruction()
*
* TODO: Currently, the only way to prevent this call from stopping the CPU is when you're single-stepping.
*
* @this {DebuggerPDP11}
* @return {boolean} true if stopping is enabled, false if not
*/
DebuggerPDP11.prototype.stopInstruction = function()
{
var cpu = this.cpu;
if (cpu.isRunning()) {
cpu.setPC(this.cpu.getLastPC());
this.stopCPU();
return true;
}
return false;
};
/**
* undefinedInstruction(opCode)
*
* @this {DebuggerPDP11}
* @param {number} opCode
*/
DebuggerPDP11.prototype.undefinedInstruction = function(opCode)
{
this.printMessage("undefined opcode " + this.toStrBase(opCode), true, true);
this.stopInstruction(); // allow the caller to step over it if they really want a trap generated
};
/**
* checkMemoryRead(addr, nb)
*