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

@ -556,8 +556,7 @@ BusPDP11.prototype.unknownAccess = function(addr, data, fByte)
* TODO: For 22-bit machines, let's display addr as a 3-byte value (for a total of 9 octal digits)
*/
this.dbg.printMessage("warning: unknown I/O access (" + this.dbg.toStrBase(addr, 3) + "," + this.dbg.toStrBase(data) + "," + fByte + ")", true, true);
this.cpu.setPC(this.cpu.getLastPC());
this.cpu.stopCPU();
if (this.dbg.stopInstruction()) return 0;
}
if (!this.nDisableTraps) {
this.cpu.trap(PDP11.TRAP.BUS_ERROR, addr);

View file

@ -1763,6 +1763,9 @@ PDP11.opXOR = function(opCode)
*/
PDP11.opUndefined = function(opCode)
{
if (DEBUGGER && this.dbg) {
this.dbg.undefinedInstruction(opCode);
}
this.trap(PDP11.TRAP.RESERVED, PDP11.REASON.RESERVED);
};

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)
*