-- File: CoreSwapDefs.mesa
-- Last edited by Sandman; June 30, 1980  4:50 PM
-- Copyright  Xerox Corporation 1979, 1980

DIRECTORY
  AltoFileDefs USING [CFA, CFP],
  ControlDefs USING [GlobalFrameHandle, StateVector, SVPointer, WordPC];

CoreSwapDefs: DEFINITIONS =
  BEGIN

  SVPointer: TYPE = ControlDefs.SVPointer;

  ExternalStateVector: TYPE = MACHINE DEPENDENT RECORD [
    state: SVPointer,
    reason: CoreSwapDefs.SwapReason,
    level: [0..3777B],
    tables: POINTER,
    drumFile: POINTER,
    parameter: POINTER TO CoreSwapDefs.DebugParameter,
    versionident: CARDINAL,
    loadstateCFA: AltoFileDefs.CFA,
    lspages: CARDINAL,
    mds: CARDINAL,
    bitmap: LONG POINTER,
    bitmapPages: CARDINAL,
    fill: ARRAY [17..19) OF WORD];

  VersionID: CARDINAL = 04140;

  SwapReason: TYPE = {
    -- handled by debugnub
    proceed, -- THIS MUST BE FIRST !!
    start, call, resume, quit, showscreen, kill, -- handled by external debugger
    install, breakpoint, worrybreak, worrycall, uncaughtsignal, explicitcall,
    return, punt, interrupt, cleanmaplog};

  DebugParameter: TYPE = MACHINE DEPENDENT RECORD [
    string: STRING,
    body:
      SELECT OVERLAID SwapReason FROM
	uncaughtsignal => [msg: UNSPECIFIED, signal: UNSPECIFIED],
	return => [value: UNSPECIFIED],
	start => [frame: ControlDefs.GlobalFrameHandle],
	call => [sv: ControlDefs.StateVector],
	ENDCASE];

  UncaughtSignalDP: TYPE = POINTER TO uncaughtsignal DebugParameter;
  ReturnDP: TYPE = POINTER TO return DebugParameter;
  StartDP: TYPE = POINTER TO start DebugParameter;
  CallDP: TYPE = POINTER TO call DebugParameter;

  level: INTEGER;
  FreeDebuggerBitmap: PROCEDURE;
  CoreSwap: PROCEDURE [why: SwapReason, sp: SVPointer];
  CantSwap: SIGNAL;
  CAbort: SIGNAL;

  -- Conditional Breakpoint Stuff

  BBArray: TYPE = RECORD [
    length: CARDINAL, blocks: ARRAY [0..0) OF UserBreakBlock];

  BBHandle: TYPE = POINTER TO BBArray;

  UserBreakBlock: TYPE = RECORD [
    frame: ControlDefs.GlobalFrameHandle,
    pc: ControlDefs.WordPC,
    ptrL: POINTER,
    ptrR: POINTER,
    posnL: [0..16),
    posnR: [0..16),
    sizeL: [1..16],
    sizeR: [1..16],
    inst: [0..377B],
    relation: Relations,
    immediateR: BOOLEAN,
    counterL: BOOLEAN,
    localL: BOOLEAN,
    localR: BOOLEAN,
    stackRelative: BOOLEAN];

  UBBPointer: TYPE = POINTER TO UserBreakBlock;

  Relations: TYPE = {eq, ne, lt, ge, gt, le};

  -- Punt and Swapping Information

  CFP: TYPE = AltoFileDefs.CFP;

  PuntTable: TYPE = MACHINE DEPENDENT RECORD [
    pDebuggerFP: POINTER TO CFP,
    pCoreFP: POINTER TO CFP,
    puntESV: ExternalStateVector,
    debuggerFP: CFP,
    coreFP: CFP,
    other: UNSPECIFIED];

  PuntInfo: POINTER TO POINTER TO PuntTable = LOOPHOLE[456B];

  END...