DisassembleSPARC.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Last tweaked by Mike Spreitzer July 23, 1992 2:00 pm PDT
DIRECTORY IO, Rope;
DisassembleSPARC: DEFINITIONS ~ {
ROPE: TYPE ~ Rope.ROPE;
SymID: TYPE ~ CARD;
nullID: SymID = 0;
SymEntry: TYPE = RECORD[
symID: SymID,
name: ROPE,
type: CARD,
value: CARD,
size: CARD,
fileSeqNum: CARD];
nullSymEntry: SymEntry ~ [nullID, NIL, 0, 0, 0, 0];
Sym: TYPE = RECORD [name: ROPE, value, nBytes: CARD];
unknownSize: CARD = CARD.LAST;
PCInfo: TYPE = RECORD[
procName: ROPE,
procSymID: CARD,
fileName: ROPE,
fileSeqNum: CARD,
guessedEmbeddedFileName: ROPE,
guessedEmbeddedFileSymID: CARD];
nullPCInfo: PCInfo = [NIL, 0, NIL, 0, NIL, 0];
nullAddr: CARD = 0;
RegisterModel: TYPE ~ REF RegisterModelRep;
RegisterModelRep: TYPE ~ ARRAY Register OF RegisterContents := ALL[[0,FALSE]];
RegisterContents: TYPE ~ RECORD [
val: CARD,
known: BOOL
];
Register: TYPE ~ [0 .. 32);
DebugNub: TYPE ~ REF DebugNubPrivate;
DebugNubPrivate: TYPE ~ RECORD [
GetMatchingSymEntryByName: PROC [nub: DebugNub, pattern: ROPE ¬ NIL, caseSensitive: BOOLEAN, types: CARD ¬ allTypes, classes: Classes ¬ all, nth: INT, from: SymID ¬ nullID] RETURNS [SymEntry],
When from#NIL, pattern defaults to from's name.
type matches types iff types=allTypes or type&typeMask=types&typeMask.
Returns nullSymEntry if not found.
GetMatchingSymEntryByValue: PROC [nub: DebugNub, val: CARD ¬ nullVal, types: CARD ¬ allTypes, classes: Classes ¬ all, nth: INT, from: SymID ¬ nullID] RETURNS [SymEntry],
GetSymEntryByID: PROC [nub: DebugNub, id: SymID] RETURNS [SymEntry],
GetInterfaceSlot: PROC [nub: DebugNub, ifc, item: ROPE] RETURNS [addr: CARD],
May return nullAddr.
PCtoInfo: PROC [nub: DebugNub, pc: CARD] RETURNS [PCInfo],
May return nullPCInfo.
FetchWord: PROC [nub: DebugNub, addr: CARD] RETURNS [WORD],
May raise AddressFault.
data: REF ANY ¬ NIL];
AddressFault: ERROR [address: LONG POINTER];
Classes: TYPE ~ {all, external, internal, none};
typeUndef: CARD ~ 0;
typeExternal: CARD ~ 1;
typeAbs: CARD ~ 2;
typeText: CARD ~ 4;
typeData: CARD ~ 6;
typeBss: CARD ~ 8;
typePatch: CARD ~ 1CH;
typeModule: CARD ~ 1EH;
typeMask: CARD ~ 1EH;
allTypes: CARD ~ CARD.LAST;
nullVal: CARD = 0;
DisassembleProc: PROC [to: IO.STREAM, startPC, nBytes: CARD, nub: DebugNub, regs: RegisterModel ¬ NIL, stop: REF BOOL ¬ NIL];
May raise Failed, AddressFault.
DisassembleInstr: PROC [to: REF TEXT, pc: CARD, word: WORD, nub: DebugNub, regs: RegisterModel ¬ NIL] RETURNS [REF TEXT];
May raise Failed, AddressFault.
FindSym: PROC [name: ROPE, nub: DebugNub, textOnly: BOOL] RETURNS [SymEntry];
name may be
A number (as accepted by CardFromRope);
N1.N2 (where N1 names an interface record and N2 names an item in that interface);
N1.N2 (where N1 names a compilation unit and N2 names a text item in that interface); or
Gn (a name defined in the loader symbols (ie, underscore plus a top-level C name)).
May raise Failed, AddressFault.
EstSize: PROC [nub: DebugNub, e1: SymEntry, textOnly: BOOL] RETURNS [nBytes: CARD];
May return nBytes=unknownSize.
CardFromRope: PROC [ROPE] RETURNS [CARD];
Accepts both Mesa syntax and C's hex syntax. May raise Convert.Error.
LocalGetInterfaceSlot: PROC [nub: DebugNub, ifc, item: ROPE] RETURNS [addr: CARD];
For local world; ignores nub.
Failed: ERROR [errMsg: ROPE];
}.