home *** CD-ROM | disk | FTP | other *** search
- /*[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. */
- #ifndef __UDebug__
- #define __UDebug__ 0
- #endif
- #if ! __UDebug__
- #define __UDebug__ 1
-
- /* • Auto-Include the requirements for this unit's interface. */
- #ifndef __UMacAppUtilities__
- #include "UMacAppUtilities.h"
- #endif
-
- #ifndef qMPW31
- #define qMPW31 0
- #endif
-
- const short kMaxFlags = 20; /* maximum flags that can be remembered by
- the debugger */
- const short kMaxSyms = 20;
- /* maximum symbols remembered by the debugger
- */
-
- typedef enum {forceOn, forceOff, forceUnchanged} DebugForceOptions;
- /* Used with DebugForceOptions procedure. */
-
- #if qMPW31
- typedef DisAsmStr80 Str255;
- #endif
-
- extern pascal Boolean gMastReport; /* When TRUE, report changes in # master
- pointers. */
- extern pascal long gMaxStackDepth; /* Maximum stack space used to date in the
- program. This is computed every
- %_BP/%_EP/%_EX. */
- extern pascal Str255 gReportInfo; /* If gReportNext and gReportInfo <>'' then
- display the text of gReportInfo on next
- %_BP or %_EP, then clear the buffer. */
- extern pascal Boolean gReportNext;
- /* If set to TRUE, report pending information
- (e.g., gReportInfo) at the very next %_BP
- or %_EP. */
- extern pascal Boolean gReportTime;
- /* if TRUE, report TickCount during tracing */
- extern pascal Boolean gSingleStep; /* if TRUE, break into debugger at next
- opportunity */
- extern pascal Boolean gTracing; /* TRUE when the debugger is tracing. Set
- this using TrcEnable function. */
-
- extern pascal Boolean DebugCanReadLn(void);
- /* Returns True if you can ReadLn to the user. This in turn is true when there is a debu
- g view
- (pDebugView), that view can currently write to its window, and this unit is initialized. */
-
- extern pascal Boolean DebugCanWriteLn(void);
- /* 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. */
-
- extern pascal void GetCallersMethodName(StringPtr s);
- /* Return the name of the calling method in s. */
-
- extern pascal void GetMethodName(long ppc, StringPtr s);
- /* Returns in s the name of the method or procedure into which address ppc points. Calls
- GetProcName to do the work. */
-
- extern pascal void GetProcName(long ppc, StringPtr className, StringPtr procName);
- /* 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 ''. */
-
- extern pascal void ShowMemory(long startAddress, long numBytes);
- /* Dump memory to Transcript from startaddress for numBytes */
-
- extern pascal void IDUDebug(void);
- /* Prints in the debug window the compile date and time of this unit. */
-
- extern pascal Boolean TrcEnable(Boolean okToTrace);
- /* When a WriteLn call is made, the captureregistered through this function is called wi
- th the
- sequence */
-
- #if qPerform
-
- extern pascal Boolean DebugPerfMonitor(Boolean turnOn);
- /* When a WriteLn call is made, the captureregistered through this function is called wi
- th the
- sequence */
- #endif
- #if qDebug
-
- extern pascal Ptr DebugCapture(Ptr captureProc);
- /* 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.*/
-
- extern pascal OSErr DebugRedirect(short vRefnum, StringPtr fileName);
- /* Returns number of characters per line in current transcript window. */
-
- extern pascal short DebugTranscriptWidth(void);
- /* Returns number of characters per line in current transcript window. */
-
- extern pascal void EnterMacAppDebugger(void);
- /* Invokes the debugger. Called by ProgramBreak in UFailure. */
-
- extern pascal void DebugEndForce(void);
- /* Calls the EndForce method of the debug view (see UTranscriptView.) */
-
- extern pascal void DebugFlag(BooleanPtr flagAddr, short flagChar, Ptr theActionProc, StringPtr
- flagDesc);
- /* 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. */
-
- extern pascal void DebugForceOutput(DebugForceOptions DebugToWindow, DebugForceOptions DebugToFile);
- /* Calls the ForceOutput method of the debug view (see UTranscriptView.) */
-
- extern pascal void DebugGlobalHandle(Ptr globAddr, Ptr theActionProc, StringPtr *globSym);
- /* 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. */
-
- extern pascal void DebugShowTranscriptWindow(void);
- /* Opens the debug transcript window. */
-
- extern pascal void DebugTerminate(void);
- /* Called to initialize the UDebug unit. */
-
- extern pascal void InitUDebug(Handle segTable, Handle nonRes, Ptr enterProc, Ptr inspectProc, Ptr
- symbolProc);
-
- extern pascal void InitUDebugAfterIApplication(void);
- /* 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. */
-
- #endif
- #endif
-
-