More instruction history fixes
This commit is contained in:
parent
c2187e1e1b
commit
8d98dedd1c
4 changed files with 990 additions and 979 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -73,7 +73,7 @@ var Bc={Ce:4,N:5,da:6,ba:7,ca:8,J:9,R:11,S:12,kd:4,Lg:60,Mg:83,Eb:3,qb:9,Qb:16,A
|
|||
vf:7,wf:11,Cf:18,Df:7,Ef:15,Hf:15,If:7,Jf:13,Nf:11,Of:7,Pf:8,Gh:8,Jh:12,Hh:18,Ih:17,Kh:15,Lf:8,Kf:20,Mf:2,Sf:3,ae:9,Rf:5,Qf:11,Uf:4,Tf:17,Lh:11},Ac={Ce:0,N:0,da:0,ba:0,ca:0,J:0,R:1,S:1,kd:3,Lg:14,Mg:16,Eb:2,qb:7,Qb:7,Ae:0,Qg:7,Sg:13,Ug:7,Tg:11,Rg:16,Og:3,qf:6,Pg:2,Ng:13,sf:5,rf:5,Yd:2,Xd:7,ih:23,jh:0,kh:1,lh:3,hh:17,tf:7,nh:11,Ja:7,Ka:3,ph:7,oh:11,mh:15,ub:2,qh:3,zd:7,rh:8,yf:8,sh:8,xf:4,zf:4,xh:2,wh:3,uh:5,vh:2,th:3,Af:5,Bf:3,Wg:14,Yg:22,Vg:17,Xg:25,$g:17,bh:25,Zg:20,ah:28,zh:13,Bh:21,yh:16,Ah:24,
|
||||
eh:13,gh:21,dh:16,fh:24,$d:2,Zd:7,Gf:5,Ff:5,Ch:19,Fb:5,Dh:5,Eh:17,Ub:3,Fh:5,ld:3,lc:0,nf:8,of:5,pf:9,uf:5,vf:5,wf:4,Cf:5,Df:5,Ef:4,Hf:7,If:5,Jf:8,Nf:3,Of:4,Pf:3,Gh:11,Jh:11,Hh:15,Ih:15,Kh:7,Lf:5,Kf:8,Mf:0,Sf:2,ae:6,Rf:3,Qf:6,Uf:3,Tf:5,Lh:5},zc={Ce:0,N:0,da:0,ba:0,ca:0,J:0,R:1,S:1,kd:3,Lg:14,Mg:16,Eb:2,qb:7,Qb:7,Ae:0,Qg:7,Sg:13,Ug:7,Tg:11,Rg:16,Og:3,qf:6,Pg:2,Ng:13,sf:5,rf:5,Yd:2,Xd:7,ih:23,jh:0,kh:1,lh:3,hh:17,tf:7,nh:11,Ja:7,Ka:3,ph:7,oh:11,mh:15,ub:2,qh:3,zd:7,rh:8,yf:8,sh:8,xf:4,zf:4,xh:2,wh:3,
|
||||
uh:5,vh:2,th:3,Af:5,Bf:3,Wg:14,Yg:22,Vg:17,Xg:25,$g:17,bh:25,Zg:20,ah:28,zh:13,Bh:21,yh:16,Ah:24,eh:13,gh:21,dh:16,fh:24,$d:2,Zd:7,Gf:5,Ff:5,Ch:19,Fb:5,Dh:5,Eh:17,Ub:3,Fh:5,ld:3,lc:0,nf:8,of:5,pf:9,uf:5,vf:5,wf:4,Cf:5,Df:5,Ef:4,Hf:7,If:5,Jf:8,Nf:3,Of:4,Pf:3,Gh:11,Jh:11,Hh:15,Ih:15,Kh:7,Lf:5,Kf:8,Mf:0,Sf:2,ae:6,Rf:3,Qf:6,Uf:3,Tf:5,Lh:5};
|
||||
function id(a){if(a.fa===a.xc){a.fa=Array(a.Me);a.kg=new g(null,0,0,5,null,a);for(var b=0;b<a.Me;b++)a.fa[b]=a.kg}else for(b=0;b<a.Ne.length;b++)a.fa[a.Ne[b]]=a.kg;a.Ne=[];cc(a)}
|
||||
function id(a){if(a.fa===a.xc){a.fa=Array(a.Me);a.kg=new g(null,0,0,5,null,a);for(var b=0;b<a.Me;b++)a.fa[b]=a.kg}else for(b=0;b<a.Ne.length;b++)a.fa[a.Ne[b]]=a.kg;a.Ne=[]}
|
||||
function Tb(a,b,c,d){var e=(b&-4194304)>>>20,m=a.xc[(a.Sc+e&a.Fd)>>>a.sa],n=m.Yc(e);if(!(n&1))return d||jd.call(a,b,!1,c),null;if(!(n&4)&&3==a.ea.Ra)return d||jd.call(a,b,!0,c),null;var p=(b&4190208)>>>10,n=a.xc[((n&-4096)+p&a.Fd)>>>a.sa],q=n.Yc(p);if(!(q&1||d))return d||jd.call(a,b,!1,c),null;if(!(q&4)&&3==a.ea.Ra)return d||jd.call(a,b,!0,c),null;c=a.xc[((q&-4096)+(b&4095)&a.Fd)>>>a.sa];if(d)return c;d=new g(b&-4096,0,0,6);Mb(d,c,m,e,n,p);b>>>=a.sa;a.fa[b]=d;a.Ne.push(b);return d}f=yc.prototype;
|
||||
f.reset=function(){this.ja.Db&&cc(this);hd(this);Yb(this);this.ja.Dc=!1};
|
||||
function hd(a){a.G=0;a.D=0;a.F=0;a.H=0;a.wb=0;a.L=0;a.K=0;a.I=0;a.Na=!1;a.ya=a.Qa=0;a.Hc=0;a.Pe=0;a.Ea=65520;a.Ib=0;a.Fc=1023;a.T=a.Re=0;a.nd=a.Je=a.Wc=a.od=0;a.Qe=-1;a.ea=new nc(a,oc,"CS");a.Ga=new nc(a,2,"DS");a.ua=new nc(a,2,"ES");a.ia=new nc(a,3,"SS");k(a,0);sc(a,0);80386<=a.ha&&(a.H=772,a.Ea=16,a.gi=0,a.Qc=0,a.Sc=0,a.$h=Array(8),a.ai=Array(8),a.Jb=new nc(a,2,"FS"),a.Yb=new nc(a,2,"GS"));a.hi=new nc(a,0,"NULL");a.U=a.Ga;a.W=a.ia;a.O=a.la=0;a.P=a.pa=-1;a.Ca=0;xc(a,0,65535);if(80286<=a.ha){a.Hb=
|
||||
|
|
|
|||
|
|
@ -1454,7 +1454,7 @@ if (DEBUGGER) {
|
|||
if (sel === this.cpu.getFS()) return this.cpu.segFS;
|
||||
if (sel === this.cpu.getGS()) return this.cpu.segGS;
|
||||
}
|
||||
if (this.nBreakSuppress) return null;
|
||||
if (this.nSuppressBreaks) return null;
|
||||
var seg = new X86Seg(this.cpu, X86Seg.ID.DEBUG, "DBG");
|
||||
/*
|
||||
* Note the load() function's fSuppress parameter, which the Debugger should ALWAYS set to true
|
||||
|
|
@ -1945,27 +1945,33 @@ if (DEBUGGER) {
|
|||
if (sCount !== undefined) {
|
||||
this.println(n + " instructions earlier:");
|
||||
}
|
||||
while (cLines && iHistory != this.iOpcodeHistory) {
|
||||
this.nSuppressBreaks++;
|
||||
var fData32 = null, fAddr32 = null;
|
||||
while (cLines > 0 && iHistory != this.iOpcodeHistory) {
|
||||
var dbgAddr = aHistory[iHistory++];
|
||||
if (dbgAddr.sel == null) break;
|
||||
/*
|
||||
* We must create a new dbgAddr from the address we obtained from aHistory, because dbgAddr
|
||||
* was a reference, not a copy, and we don't want getInstruction() modifying the original.
|
||||
* We must create a new dbgAddr from the address in aHistory, because dbgAddr was
|
||||
* a reference, not a copy, and we don't want getInstruction() modifying the original.
|
||||
*/
|
||||
dbgAddr = this.newAddr(dbgAddr.off, dbgAddr.sel, dbgAddr.addr);
|
||||
dbgAddr = this.newAddr(dbgAddr.off, dbgAddr.sel, dbgAddr.addr, fData32 == null? dbgAddr.fData32 : fData32, fAddr32 == null? dbgAddr.fAddr32 : fAddr32);
|
||||
this.println(this.getInstruction(dbgAddr, "history", n--));
|
||||
/*
|
||||
* If there was an OPERAND or ADDRESS override on the previous instruction, getInstruction()
|
||||
* will have automatically disassembled the next instruction, so skip one more history entry.
|
||||
*/
|
||||
if (dbgAddr.fOverride) {
|
||||
iHistory++; n--;
|
||||
if (!dbgAddr.fOverride) {
|
||||
fData32 = fAddr32 = null;
|
||||
} else {
|
||||
iHistory++; cLines--; n--;
|
||||
fData32 = dbgAddr.fData32; fAddr32 = dbgAddr.fAddr32;
|
||||
}
|
||||
if (iHistory >= aHistory.length) iHistory = 0;
|
||||
this.nextHistory = n;
|
||||
cHistory++;
|
||||
cLines--;
|
||||
}
|
||||
this.nSuppressBreaks--;
|
||||
}
|
||||
if (!cHistory) {
|
||||
this.println("no " + sMore + "history available");
|
||||
|
|
@ -2867,6 +2873,8 @@ if (DEBUGGER) {
|
|||
dbgAddr.off = this.cpu.getIP();
|
||||
dbgAddr.sel = this.cpu.getCS();
|
||||
dbgAddr.addr = addr;
|
||||
dbgAddr.fData32 = (this.cpu && this.cpu.segCS.dataSize == 4);
|
||||
dbgAddr.fAddr32 = (this.cpu && this.cpu.segCS.addrSize == 4);
|
||||
if (++this.iOpcodeHistory == this.aOpcodeHistory.length) this.iOpcodeHistory = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -2973,11 +2981,11 @@ if (DEBUGGER) {
|
|||
}
|
||||
this.aBreakWrite = ["write"];
|
||||
/*
|
||||
* nBreakSuppress ensures we can't get into an infinite loop where a breakpoint lookup requires
|
||||
* nSuppressBreaks ensures we can't get into an infinite loop where a breakpoint lookup requires
|
||||
* reading a segment descriptor via getSegment(), and that triggers more memory reads, which triggers
|
||||
* more breakpoint checks.
|
||||
*/
|
||||
this.nBreakSuppress = 0;
|
||||
this.nSuppressBreaks = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -3165,7 +3173,7 @@ if (DEBUGGER) {
|
|||
* or history data (see checkInstruction), since we might not actually execute the current instruction.
|
||||
*/
|
||||
var fBreak = false;
|
||||
if (!this.nBreakSuppress++) {
|
||||
if (!this.nSuppressBreaks++) {
|
||||
|
||||
addr = this.mapBreakpoint(addr);
|
||||
|
||||
|
|
@ -3212,7 +3220,7 @@ if (DEBUGGER) {
|
|||
}
|
||||
}
|
||||
}
|
||||
this.nBreakSuppress--;
|
||||
this.nSuppressBreaks--;
|
||||
return fBreak;
|
||||
};
|
||||
|
||||
|
|
@ -3378,11 +3386,13 @@ if (DEBUGGER) {
|
|||
|
||||
var sLine = this.hexAddr(dbgAddrIns) + " ";
|
||||
var sBytes = "";
|
||||
do {
|
||||
sBytes += str.toHex(this.getByte(dbgAddrIns, 1), 2);
|
||||
} while (dbgAddrIns.addr != dbgAddr.addr);
|
||||
if (dbgAddrIns.addr != X86.ADDR_INVALID && dbgAddr.addr != X86.ADDR_INVALID) {
|
||||
do {
|
||||
sBytes += str.toHex(this.getByte(dbgAddrIns, 1), 2);
|
||||
} while (dbgAddrIns.addr != dbgAddr.addr);
|
||||
}
|
||||
|
||||
sLine += str.pad(sBytes, 16);
|
||||
sLine += str.pad(sBytes, dbgAddrIns.fAddr32? 22 : 16);
|
||||
sLine += str.pad(sOpcode, 8);
|
||||
if (sOperands) sLine += " " + sOperands;
|
||||
|
||||
|
|
@ -3391,7 +3401,7 @@ if (DEBUGGER) {
|
|||
}
|
||||
|
||||
if (sComment && fNonPrefix) {
|
||||
sLine = str.pad(sLine, 56) + ';' + sComment;
|
||||
sLine = str.pad(sLine, dbgAddrIns.fAddr32? 66 : 56) + ';' + sComment;
|
||||
if (!this.cpu.aFlags.fChecksum) {
|
||||
sLine += (nSequence != null? '=' + nSequence.toString() : "");
|
||||
} else {
|
||||
|
|
@ -3400,7 +3410,7 @@ if (DEBUGGER) {
|
|||
}
|
||||
}
|
||||
|
||||
this.initAddrSize(dbgAddr, fNonPrefix);
|
||||
this.initAddrSize(dbgAddr, fNonPrefix, fDataPrefix || fAddrPrefix);
|
||||
return sLine;
|
||||
};
|
||||
|
||||
|
|
@ -5424,18 +5434,19 @@ if (DEBUGGER) {
|
|||
};
|
||||
|
||||
/**
|
||||
* initAddrSize(dbgAddr, fNonPrefix)
|
||||
* initAddrSize(dbgAddr, fNonPrefix, fOverride)
|
||||
*
|
||||
* @this {Debugger}
|
||||
* @param {{DbgAddr}} dbgAddr
|
||||
* @param {boolean} fNonPrefix
|
||||
* @param {boolean} [fOverride]
|
||||
*/
|
||||
Debugger.prototype.initAddrSize = function(dbgAddr, fNonPrefix)
|
||||
Debugger.prototype.initAddrSize = function(dbgAddr, fNonPrefix, fOverride)
|
||||
{
|
||||
/*
|
||||
* Use dbgAddr.fOverride to record whether we previously processed any OPERAND or ADDRESS overrides.
|
||||
* Use fOverride to record whether we previously processed any OPERAND or ADDRESS overrides.
|
||||
*/
|
||||
dbgAddr.fOverride = (dbgAddr.fData32 || dbgAddr.fAddr32);
|
||||
dbgAddr.fOverride = fOverride;
|
||||
/*
|
||||
* For proper disassembly of instructions preceded by an OPERAND (0x66) size prefix, we set
|
||||
* dbgAddr.fData32 to true whenever the operand size is 32-bit; similarly, for an ADDRESS (0x67)
|
||||
|
|
|
|||
|
|
@ -705,7 +705,6 @@ X86CPU.prototype.enablePageBlocks = function()
|
|||
}
|
||||
}
|
||||
this.aBlocksPaged = [];
|
||||
this.stopCPU();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue