home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / MacApp / MacApp CD Release / MacApp 2.0.1 (Many Libraries) / Interfaces / PInterfaces / UDebug.p < prev    next >
Encoding:
Text File  |  1990-10-25  |  5.9 KB  |  166 lines  |  [TEXT/MPS ]

  1. {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
  2. { UDebug.p }
  3. { Copyright © 1985-1990 by Apple Computer, Inc.  All rights reserved. }
  4.  
  5. {$IFC UNDEFINED UsingIncludes}
  6. {$SETC UsingIncludes := FALSE}
  7. {$ENDC}
  8.  
  9. {$IFC NOT UsingIncludes}
  10. UNIT UDebug;
  11.  
  12.     INTERFACE
  13.         {$ENDC}
  14.  
  15.         {$IFC UNDEFINED __UDebug__}
  16.         {$SETC __UDebug__ := FALSE}
  17.         {$ENDC}
  18.  
  19.         {$IFC NOT __UDebug__}
  20.         {$SETC __UDebug__ := TRUE}
  21.  
  22.         { • Auto-Include the requirements for this unit's interface. }
  23.         {$SETC UDebugIncludes := UsingIncludes}
  24.         {$SETC UsingIncludes := TRUE}
  25.         {$I+}
  26.         {$IFC UNDEFINED __UMacAppUtilities__} {$I UMacAppUtilities.p} {$ENDC}
  27.         {$SETC UsingIncludes := UDebugIncludes}
  28.  
  29.         {$IFC UNDEFINED qMPW31}
  30.         {$SETC qMPW31 := FALSE}
  31.         {$ENDC}
  32.         
  33.         CONST
  34.             kMaxFlags            = 20;                    { maximum flags that can be remembered by
  35.                                                          the debugger }
  36.             kMaxSyms            = 20;                    { maximum symbols remembered by the debugger
  37.                                                          }
  38.  
  39.         TYPE
  40.             DebugForceOptions    = (forceOn, forceOff, forceUnchanged);
  41.             { Used with DebugForceOptions procedure. }
  42.  
  43.             {$IFC NOT qMPW31}
  44.             DisAsmStr80 = Str255;
  45.             {$ENDC}
  46.             
  47.         VAR
  48.             gMastReport:        BOOLEAN;                { When TRUE, report changes in # master
  49.                                                          pointers. }
  50.             gMaxStackDepth:     LONGINT;                { Maximum stack space used to date in the
  51.                                                          program. This is computed every
  52.                                                          %_BP/%_EP/%_EX. }
  53.             gReportInfo:        Str255;                 { If gReportNext and gReportInfo <>'' then
  54.                                                          display the text of gReportInfo on next
  55.                                                          %_BP or %_EP, then clear the buffer. }
  56.             gReportNext:        BOOLEAN;                { If set to TRUE, report pending information
  57.                                                          (e.g., gReportInfo) at the very next %_BP
  58.                                                          or %_EP. }
  59.             gReportTime:        BOOLEAN;                { if TRUE, report TickCount during tracing }
  60.             gSingleStep:        BOOLEAN;                { if TRUE, break into debugger at next
  61.                                                          opportunity }
  62.             gTracing:            BOOLEAN;                { TRUE when the debugger is tracing. Set
  63.                                                          this using TrcEnable function. }
  64.  
  65.         FUNCTION DebugCanReadLn: BOOLEAN;
  66.         { Returns True if you can ReadLn to the user. This in turn is true when there is a debug view
  67.         (pDebugView), that view can currently write to its window, and this unit is initialized. }
  68.  
  69.         FUNCTION DebugCanWriteLn: BOOLEAN;
  70.         { Returns true if you can WriteLn to the user in the debug window. This is true if there
  71.         exists a debug view and this unit is initialized. }
  72.  
  73.         PROCEDURE GetCallersMethodName(VAR s: MAName);
  74.         { Return the name of the calling method in s. }
  75.  
  76.         PROCEDURE GetMethodName(ppc: LONGINT;
  77.                                 VAR s: MAName);
  78.         { Returns in s the name of the method or procedure into which address ppc points. Calls
  79.         GetProcName to do the work. }
  80.  
  81.         PROCEDURE GetProcName(ppc: LONGINT;
  82.                               VAR className, procName: MAName);
  83.         { Returns in procName the name of the method, procedure, or function into which address ppc
  84.         points. If it is a method, the method's class is returned in className. If not a method,
  85.         className is set to ''. }
  86.  
  87.         PROCEDURE ShowMemory(startAddress, numBytes: LONGINT);
  88.         { Dump memory to Transcript from startaddress for numBytes }
  89.  
  90.         PROCEDURE IDUDebug;
  91.         { Prints in the debug window the compile date and time of this unit. }
  92.  
  93.         FUNCTION TrcEnable(okToTrace: BOOLEAN): BOOLEAN;
  94.         { When a WriteLn call is made, the captureregistered through this function is called with the
  95.         sequence }
  96.  
  97.         {$IFC qPerform}
  98.  
  99.         FUNCTION DebugPerfMonitor(turnOn: BOOLEAN): BOOLEAN;
  100.         { When a WriteLn call is made, the captureregistered through this function is called with the
  101.         sequence }
  102.         {$EndC}
  103.  
  104.         {$IFC qDebug}
  105.  
  106.         FUNCTION DebugCapture(captureProc: ProcPtr): ProcPtr;
  107.         { When a WriteLn call is made, the captureproc registered through this function is called
  108.         with the sequence:
  109.         captureProc(textBuf: Ptr; byteCount: INTEGER);
  110.         The return value is the address of the previous captureProc. The debug view's AddText method
  111.         is called immediately after the captureProc.}
  112.  
  113.         FUNCTION DebugRedirect(vRefnum: INTEGER;        {CONST}
  114.                                fileName: StringPtr): OSErr;
  115.         { Returns number of characters per line in current transcript window. }
  116.  
  117.         FUNCTION DebugTranscriptWidth: INTEGER;
  118.         { Returns number of characters per line in current transcript window. }
  119.  
  120.         PROCEDURE EnterMacAppDebugger;
  121.         { Invokes the debugger. Called by ProgramBreak in UFailure. }
  122.  
  123.         PROCEDURE DebugEndForce;
  124.         { Calls the EndForce method of the debug view (see UTranscriptView.) }
  125.  
  126.         PROCEDURE DebugFlag(flagAddr: BooleanPtr;
  127.                             flagChar: CHAR;
  128.                             theActionProc: ProcPtr;
  129.           {CONST}
  130.                             flagDesc: StringPtr);
  131.         { Register a BOOLEAN flag for the X debugger command; flagAddr should be the address of the
  132.         flag; theActionshould be a procPtr for a to be called to change the flag (optional - may be
  133.         NIL).flagChar should be the character to use in the debugger to toggle the flag; desc
  134.         should be a short description of the flag.No checking is done for duplicate flagChars. }
  135.  
  136.         PROCEDURE DebugForceOutput(DebugToWindow, DebugToFile: DebugForceOptions);
  137.         { Calls the ForceOutput method of the debug view (see UTranscriptView.) }
  138.  
  139.         PROCEDURE DebugGlobalHandle(globAddr: Ptr;
  140.                                     theActionProc: ProcPtr; {CONST}
  141.                                     globSym: MANamePtr);
  142.         { Register a symbol name of a global variable that contains a handle; case does not matter.
  143.         The global variable should contain a Handle.The Action is a Function to be called to derive
  144.         the handle if necessary. Symbolic handles registered in this way may be entered in response
  145.         to the F and I commands of the debugger. }
  146.  
  147.         PROCEDURE DebugShowTranscriptWindow;
  148.         { Opens the debug transcript window. }
  149.  
  150.         PROCEDURE DebugTerminate;
  151.         { Called to initialize the UDebug unit. }
  152.  
  153.         PROCEDURE InitUDebug(segTable, nonRes: Handle;
  154.                              enterProc, inspectProc, symbolProc: Ptr);
  155.  
  156.         PROCEDURE InitUDebugAfterIApplication;
  157.         { Call this once at the end of IApplication to finish initialization of the debugger.
  158.         Installs the debug window in the event handler chain and installs a print handler in the
  159.         debug view. }
  160.  
  161.         {$ENDC qDebug}
  162.         {$EndC}
  163.         {$IFC NOT UsingIncludes}
  164. END.
  165. {$ENDC}
  166.