Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

Commit

Permalink
v1.18.9: Added loading of 16-bit Windows binary symbol data (for non-…
Browse files Browse the repository at this point in the history
…COMPILED BACKTRACK configs only)
  • Loading branch information
jeffpar committed Aug 18, 2015
1 parent f6d7c57 commit 3d78172
Show file tree
Hide file tree
Showing 9 changed files with 4,176 additions and 3,681 deletions.
2 changes: 1 addition & 1 deletion devices/pc/machine/compaq/deskpro386/vga/4096kb/state.json

Large diffs are not rendered by default.

2,164 changes: 1,082 additions & 1,082 deletions docs/pcjs/demos/pc-dbg.js

Large diffs are not rendered by default.

1,470 changes: 735 additions & 735 deletions docs/pcjs/demos/pc.js

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions modules/pcjs/lib/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1131,13 +1131,15 @@ Bus.prototype.getBackTrackObjectFromAddr = function(addr)
};

/**
* getBackTrackInfo(bti)
* getBackTrackInfo(bti, fSymbol, fNearest)
*
* @this {Bus}
* @param {number} bti
* @param {boolean} [fSymbol] (true to return only symbol)
* @param {boolean} [fNearest] (true to return nearest symbol)
* @return {string|null}
*/
Bus.prototype.getBackTrackInfo = function(bti)
Bus.prototype.getBackTrackInfo = function(bti, fSymbol, fNearest)
{
if (BACKTRACK) {
var bto = this.getBackTrackObject(bti);
Expand All @@ -1146,9 +1148,11 @@ Bus.prototype.getBackTrackInfo = function(bti)
var file = bto.obj.file;
if (file) {
this.assert(!bto.off);
return file.sName + '[' + str.toHexLong(bto.obj.offFile + off) + ']';
return file.getSymbol(bto.obj.offFile + off, fNearest);
}
if (!fSymbol || fNearest) {
return bto.obj.idComponent + '+' + str.toHexLong(bto.off + off);
}
return bto.obj.idComponent + '[' + str.toHexLong(bto.off + off) + ']';
}
}
return null;
Expand All @@ -1166,6 +1170,19 @@ Bus.prototype.getBackTrackInfoFromAddr = function(addr)
return BACKTRACK? this.getBackTrackInfo(this.readBackTrack(addr)) : null;
};

/**
* getSymbol(addr, fNearest)
*
* @this {Bus}
* @param {number} addr
* @param {boolean} [fNearest] (true to return nearest symbol)
* @return {string|null}
*/
Bus.prototype.getSymbol = function(addr, fNearest)
{
return BACKTRACK? this.getBackTrackInfo(this.readBackTrack(addr), true, fNearest) : null;
};

/**
* saveMemory()
*
Expand Down
34 changes: 24 additions & 10 deletions modules/pcjs/lib/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3689,8 +3689,9 @@ if (DEBUGGER) {
disp = this.getWord(dbgAddr, true);
}
offset = (dbgAddr.off + disp) & (dbgAddr.fData32? -1 : 0xffff);
sOperand = str.toHex(offset, dbgAddr.fData32? 8: 4);
var aSymbol = this.findSymbolAtAddr(this.newAddr(offset, dbgAddr.sel));
sOperand = aSymbol[0] || str.toHex(offset, dbgAddr.fData32? 8: 4);
if (aSymbol[0]) sOperand += " (" + aSymbol[0] + ")";
}
else if (typeMode == Debugger.TYPE_IMPREG) {
sOperand = this.getRegOperand((type & Debugger.TYPE_IREG) >> 8, type, dbgAddr);
Expand Down Expand Up @@ -3754,6 +3755,7 @@ if (DEBUGGER) {
{
var sOperand = ' ';
var typeSize = type & Debugger.TYPE_SIZE;

switch (typeSize) {
case Debugger.TYPE_BYTE:
/*
Expand All @@ -3779,7 +3781,10 @@ if (DEBUGGER) {
sOperand = str.toHex(this.getShort(dbgAddr, 2), 4);
break;
case Debugger.TYPE_FARP:
sOperand = this.hexAddr(this.newAddr(this.getWord(dbgAddr, true), this.getShort(dbgAddr, 2), null, dbgAddr.fProt, dbgAddr.fData32, dbgAddr.fAddr32));
dbgAddr = this.newAddr(this.getWord(dbgAddr, true), this.getShort(dbgAddr, 2), null, dbgAddr.fProt, dbgAddr.fData32, dbgAddr.fAddr32);
sOperand = this.hexAddr(dbgAddr);
var aSymbol = this.findSymbolAtAddr(dbgAddr);
if (aSymbol[0]) sOperand += " (" + aSymbol[0] + ")";
break;
default:
sOperand = "imm(" + str.toHexWord(type) + ')';
Expand Down Expand Up @@ -4714,7 +4719,7 @@ if (DEBUGGER) {
* @this {Debugger}
* @param {DbgAddr} dbgAddr
* @param {boolean} [fNearest]
* @return {Array|null} where [0] == symbol name, [1] == symbol value, [2] == any annotation, and [3] == any associated comment
* @return {Array} where [0] == symbol name, [1] == symbol value, [2] == any annotation, and [3] == any associated comment
*/
Debugger.prototype.findSymbolAtAddr = function(dbgAddr, fNearest)
{
Expand Down Expand Up @@ -4742,6 +4747,13 @@ if (DEBUGGER) {
break;
}
}
if (!aSymbol.length) {
var sSymbol = this.bus.getSymbol(addr, true);
if (sSymbol) {
aSymbol.push(sSymbol);
aSymbol.push(addr);
}
}
return aSymbol;
};

Expand Down Expand Up @@ -5084,7 +5096,7 @@ if (DEBUGGER) {
if (BACKTRACK && sCmd == "di") {
var addr = this.getAddr(dbgAddr);
sDump += '%' + str.toHex(addr) + ": ";
var sInfo = this.bus.getBackTrackInfoFromAddr(addr);
var sInfo = this.bus.getSymbol(addr, true);
sDump += sInfo || "no information";
}
else {
Expand Down Expand Up @@ -6221,7 +6233,7 @@ if (DEBUGGER) {
}
}
if (!sCall) break;
sCall = str.pad(sCall, 50) + ";stack=" + this.hexAddr(dbgAddrStack) + " return=" + this.hexAddr(dbgAddrCall);
sCall = str.pad(sCall, 50) + " ;stack=" + this.hexAddr(dbgAddrStack) + " return=" + this.hexAddr(dbgAddrCall);
this.println(sCall);
cFrames++;
}
Expand Down Expand Up @@ -6347,10 +6359,12 @@ if (DEBUGGER) {
var sComment = (nSequence != null? "cycles" : null);
var aSymbol = this.findSymbolAtAddr(dbgAddr);

if (aSymbol[0]) {
var sLabel = aSymbol[0] + ':';
if (aSymbol[2]) sLabel += ' ' + aSymbol[2];
this.println(sLabel);
if (aSymbol[0] && n) {
if (!cLines && n || aSymbol[0].indexOf('+') < 0) {
var sLabel = aSymbol[0] + ':';
if (aSymbol[2]) sLabel += ' ' + aSymbol[2];
this.println(sLabel);
}
}

if (aSymbol[3]) {
Expand Down Expand Up @@ -6453,7 +6467,7 @@ if (DEBUGGER) {
sCmd = "a " + this.hexAddr(this.dbgAddrAssemble) + ' ' + sCmd;
}

var asArgs = sCmd.split(' ');
var asArgs = sCmd.replace(/ +/g, ' ').split(' ');
var ch0 = asArgs[0].charAt(0).toLowerCase();

switch (ch0) {
Expand Down
Loading

0 comments on commit 3d78172

Please sign in to comment.