LarkPrograms.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Last Edited by: Stewart, August 30, 1983 3:11 pm
Swinehart, April 6, 1987 9:39:32 am PDT
DIRECTORY
IO USING [STREAM],
Rope USING [ROPE],
TeleLoad USING [AddressSpace, CoreAddress, CoreBlock, State8086Object];
LarkPrograms: CEDAR DEFINITIONS = {
Here is the symbol table part
IDType: TYPE = {procedure, variable};
STObject: TYPE = RECORD [
id: Rope.ROPENIL,
addr: INT ← 0,
type: IDType ← variable
];
global variable with null stuff in it.
nullItem: STObject;
STItem: TYPE = REF STObject;
SymbolTable: TYPE = REF SymTabObject;
SymTabObject: TYPE = RECORD [
e: SEQUENCE length: NAT OF STObject
];
Dealing with programs for Lark
PatchItem: TYPE = REF PatchItemObject;
PatchItemObject: TYPE = RECORD [
name: Rope.ROPE,
address: TeleLoad.CoreAddress,
wordValue: CARDINAL
];
Program: TYPE = REF ProgramObject;
ProgramObject: TYPE = RECORD [
program: LIST OF TeleLoad.CoreBlock ← NIL,
patchList: LIST OF PatchItem ← NIL,
programName: Rope.ROPENIL,
addressSpace: TeleLoad.AddressSpace ← main,
startState: TeleLoad.State8086Object,
searchTable: REF SymTabObject ← NIL,
nameTable: REF SymTabObject ← NIL
];
Enumerate all programs on tap.
EnumeratePrograms: PROC [proc: PROC [program: Program] RETURNS [stop: BOOL]];
Search for the given program on the list of parsed programs
FetchProgram: PROC [programName: Rope.ROPE] RETURNS [p: Program];
Put the given program on the list of parsed programs, replacing a previous copy
AddOrReplaceProgram: PROC [program: Program];
Reset the patch list associated with the program. program.patchList ← NIL
ResetPatchList: PROC [program: Program];
Reads the program, but does not store it in the data base (use AddOrReplaceProgram)
ReadProgramFromDisk: PROC [objectFileName: Rope.ROPE, log: IO.STREAMNIL, addressSpace: TeleLoad.AddressSpace ← main, wDir: Rope.ROPE] RETURNS [Program];
ReadProgramFromMBFile: PROC [mbFileName: Rope.ROPE, baseAddress: TeleLoad.CoreAddress, log: IO.STREAMNIL, addressSpace: TeleLoad.AddressSpace ← main, wDir: Rope.ROPE] RETURNS [Program];
Read symbol tables for the program. Used internally by Monitor and ReadProgramFromDisk, probably not needed externally.
BuildSearchTable: PROC [program: Program, name: Rope.ROPE, log: IO.STREAMNIL, wDir: Rope.ROPE];
Add a patch item to the list for the given program.
PatchProgramWord: PROC [program: Program, address: TeleLoad.CoreAddress, wordValue: CARDINAL, name: Rope.ROPENIL];
Read patch items from the given file, checking symbol names against the symbol table for the given program.
PatchFromFile: PROC [program: Program, fileName: Rope.ROPE, log: IO.STREAMNIL, wDir: Rope.ROPE] RETURNS [LIST OF PatchItem];
Symbol table access. ProcedureEnclosing is handy for printing stack traces. It finds the symbol with the next lowest address. (Note: works fine for finding the static symbol most nearby.) If searchMonitor = TRUE, then the search will include monitor symbols, if any can be found.
ProcedureEnclosing: PROC [program: Program, addr: TeleLoad.CoreAddress, searchMonitor: BOOLTRUE, wDir: Rope.ROPE] RETURNS [s: STObject];
Usual kind of symbol table lookup. If searchMonitor = TRUE, then the search will include monitor symbols, if any can be found.
FindVariable: PROC [program: Program, name: Rope.ROPE, searchMonitor: BOOLTRUE, wDir: Rope.ROPE] RETURNS [item: STObject, found: BOOL];
Return, if possible, a handle for the EPROM monitor for Lark. This is useful for looking at monitor statics.
Monitor: PROC [log: IO.STREAMNIL, addressSpace: TeleLoad.AddressSpace ← main, wDir: Rope.ROPE] RETURNS [mon: Program];
}.
April 25, 1983 11:08 am, LCS, created from TeleDebOps
August 10, 1983 12:07 pm, LCS, added ReadProgramFromMBFile
April 6, 1987 9:33:05 am PDT, LCS, added addressSpace arg to Monitor, August
Swinehart, April 6, 1987 9:32:50 am PDT
Put wDir argument everywhere to compensate for not having any other way to pass it
changes to: ReadProgramFromDisk, ReadProgramFromMBFile, BuildSearchTable, PatchFromFile, ProcedureEnclosing, FindVariable, Monitor