home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 5.9 KB | 166 lines | [TEXT/MPS ] |
- {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
- { UDebug.p }
- { Copyright © 1985-1990 by Apple Computer, Inc. All rights reserved. }
-
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := FALSE}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT UDebug;
-
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __UDebug__}
- {$SETC __UDebug__ := FALSE}
- {$ENDC}
-
- {$IFC NOT __UDebug__}
- {$SETC __UDebug__ := TRUE}
-
- { • Auto-Include the requirements for this unit's interface. }
- {$SETC UDebugIncludes := UsingIncludes}
- {$SETC UsingIncludes := TRUE}
- {$I+}
- {$IFC UNDEFINED __UMacAppUtilities__} {$I UMacAppUtilities.p} {$ENDC}
- {$SETC UsingIncludes := UDebugIncludes}
-
- {$IFC UNDEFINED qMPW31}
- {$SETC qMPW31 := FALSE}
- {$ENDC}
-
- CONST
- kMaxFlags = 20; { maximum flags that can be remembered by
- the debugger }
- kMaxSyms = 20; { maximum symbols remembered by the debugger
- }
-
- TYPE
- DebugForceOptions = (forceOn, forceOff, forceUnchanged);
- { Used with DebugForceOptions procedure. }
-
- {$IFC NOT qMPW31}
- DisAsmStr80 = Str255;
- {$ENDC}
-
- VAR
- gMastReport: BOOLEAN; { When TRUE, report changes in # master
- pointers. }
- gMaxStackDepth: LONGINT; { Maximum stack space used to date in the
- program. This is computed every
- %_BP/%_EP/%_EX. }
- gReportInfo: Str255; { If gReportNext and gReportInfo <>'' then
- display the text of gReportInfo on next
- %_BP or %_EP, then clear the buffer. }
- gReportNext: BOOLEAN; { If set to TRUE, report pending information
- (e.g., gReportInfo) at the very next %_BP
- or %_EP. }
- gReportTime: BOOLEAN; { if TRUE, report TickCount during tracing }
- gSingleStep: BOOLEAN; { if TRUE, break into debugger at next
- opportunity }
- gTracing: BOOLEAN; { TRUE when the debugger is tracing. Set
- this using TrcEnable function. }
-
- FUNCTION DebugCanReadLn: BOOLEAN;
- { Returns True if you can ReadLn to the user. This in turn is true when there is a debug view
- (pDebugView), that view can currently write to its window, and this unit is initialized. }
-
- FUNCTION DebugCanWriteLn: BOOLEAN;
- { Returns true if you can WriteLn to the user in the debug window. This is true if there
- exists a debug view and this unit is initialized. }
-
- PROCEDURE GetCallersMethodName(VAR s: MAName);
- { Return the name of the calling method in s. }
-
- PROCEDURE GetMethodName(ppc: LONGINT;
- VAR s: MAName);
- { Returns in s the name of the method or procedure into which address ppc points. Calls
- GetProcName to do the work. }
-
- PROCEDURE GetProcName(ppc: LONGINT;
- VAR className, procName: MAName);
- { Returns in procName the name of the method, procedure, or function into which address ppc
- points. If it is a method, the method's class is returned in className. If not a method,
- className is set to ''. }
-
- PROCEDURE ShowMemory(startAddress, numBytes: LONGINT);
- { Dump memory to Transcript from startaddress for numBytes }
-
- PROCEDURE IDUDebug;
- { Prints in the debug window the compile date and time of this unit. }
-
- FUNCTION TrcEnable(okToTrace: BOOLEAN): BOOLEAN;
- { When a WriteLn call is made, the captureregistered through this function is called with the
- sequence }
-
- {$IFC qPerform}
-
- FUNCTION DebugPerfMonitor(turnOn: BOOLEAN): BOOLEAN;
- { When a WriteLn call is made, the captureregistered through this function is called with the
- sequence }
- {$EndC}
-
- {$IFC qDebug}
-
- FUNCTION DebugCapture(captureProc: ProcPtr): ProcPtr;
- { When a WriteLn call is made, the captureproc registered through this function is called
- with the sequence:
- captureProc(textBuf: Ptr; byteCount: INTEGER);
- The return value is the address of the previous captureProc. The debug view's AddText method
- is called immediately after the captureProc.}
-
- FUNCTION DebugRedirect(vRefnum: INTEGER; {CONST}
- fileName: StringPtr): OSErr;
- { Returns number of characters per line in current transcript window. }
-
- FUNCTION DebugTranscriptWidth: INTEGER;
- { Returns number of characters per line in current transcript window. }
-
- PROCEDURE EnterMacAppDebugger;
- { Invokes the debugger. Called by ProgramBreak in UFailure. }
-
- PROCEDURE DebugEndForce;
- { Calls the EndForce method of the debug view (see UTranscriptView.) }
-
- PROCEDURE DebugFlag(flagAddr: BooleanPtr;
- flagChar: CHAR;
- theActionProc: ProcPtr;
- {CONST}
- flagDesc: StringPtr);
- { Register a BOOLEAN flag for the X debugger command; flagAddr should be the address of the
- flag; theActionshould be a procPtr for a to be called to change the flag (optional - may be
- NIL).flagChar should be the character to use in the debugger to toggle the flag; desc
- should be a short description of the flag.No checking is done for duplicate flagChars. }
-
- PROCEDURE DebugForceOutput(DebugToWindow, DebugToFile: DebugForceOptions);
- { Calls the ForceOutput method of the debug view (see UTranscriptView.) }
-
- PROCEDURE DebugGlobalHandle(globAddr: Ptr;
- theActionProc: ProcPtr; {CONST}
- globSym: MANamePtr);
- { Register a symbol name of a global variable that contains a handle; case does not matter.
- The global variable should contain a Handle.The Action is a Function to be called to derive
- the handle if necessary. Symbolic handles registered in this way may be entered in response
- to the F and I commands of the debugger. }
-
- PROCEDURE DebugShowTranscriptWindow;
- { Opens the debug transcript window. }
-
- PROCEDURE DebugTerminate;
- { Called to initialize the UDebug unit. }
-
- PROCEDURE InitUDebug(segTable, nonRes: Handle;
- enterProc, inspectProc, symbolProc: Ptr);
-
- PROCEDURE InitUDebugAfterIApplication;
- { Call this once at the end of IApplication to finish initialization of the debugger.
- Installs the debug window in the event handler chain and installs a print handler in the
- debug view. }
-
- {$ENDC qDebug}
- {$EndC}
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-