home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / readme / fileins / dspatch2.st < prev    next >
Encoding:
Text File  |  1995-10-24  |  1.7 KB  |  49 lines

  1. " Distributed Feature patch 2
  2.   Patch neded to fix stack overflow reporting problem
  3.   in the Distributed Debugger "
  4.  
  5. DsKernelDebug becomeDefault!
  6.  
  7. !DsKernelDebugStartUp class publicMethods !
  8.  
  9. reportError: errorString resumable: resumable startBP: startBP
  10.     "Open a debugger on the receiver process.
  11.  
  12.      Technique is:
  13.  
  14.         1) Ensure that no processes switch me out.
  15.         2) Fork a new Event dispatcher
  16.         3) Enable process switches.
  17.     "
  18.  
  19.     | theProcess|
  20.  
  21.     [
  22.         self debuggerClass = EtDebugger
  23.         ifTrue: [^super reportError: errorString resumable: resumable startBP: startBP].
  24.         self cleanUpBeforeWalkback. 
  25.  
  26.         Processor disableProcessSwitches.
  27.         theProcess := Processor activeProcess.
  28.         theProcess changeStackSize: theProcess stack size + 1024.
  29.         self setupDebuggerFor: theProcess.  
  30.         (Process newProcessOn: [
  31.             [theProcess suspend.
  32.             CwAppContext default asyncExecInUI: [
  33.             "This will open the debugger from the UI process when the UI process
  34.              returns to the event loop."
  35.             [Processor
  36.                 addDebugProcess: theProcess
  37.                 errorString: errorString
  38.                 startBP: startBP
  39.                     resumable: resumable]
  40.                 when: ExError | ExHalt "ExHalt catches stack overflows" do: [:sig |
  41.                     self outputWalkback: errorString process: theProcess.
  42.                     self recursiveError: (sig argument isString ifTrue: [sig argument] ifFalse: [sig description])
  43.                         signal: sig]]] critical]) priority: 7; resume.
  44.         "Ensure there is a UI process running."
  45.         (UIProcess currentUI notNil and: [UIProcess currentUI isReady]) ifFalse: [UIProcess forkUserInterface].
  46.         Processor enableProcessSwitches.
  47.     ] when: ExError | ExHalt "ExHalt catches stack overflows."
  48.         do: [:sig | self recursiveError: errorString signal: sig].! !
  49.