DebugView.st
changeset 3723 250da8f1a968
parent 3702 cfbc382adfbe
child 3769 3c6e68ee0593
equal deleted inserted replaced
3722:0a1edec5d83b 3723:250da8f1a968
   735         ((sel == #halt) or:[sel == #halt:]) ifTrue:[
   735         ((sel == #halt) or:[sel == #halt:]) ifTrue:[
   736             ^ i + 1
   736             ^ i + 1
   737         ].
   737         ].
   738         ((sel == #raise) or:[sel == #raiseRequest]) ifTrue:[
   738         ((sel == #raise) or:[sel == #raiseRequest]) ifTrue:[
   739             rcvr := con receiver.
   739             rcvr := con receiver.
   740             (rcvr isKindOf:Exception) ifTrue:[
   740             (rcvr isException) ifTrue:[
   741                 ex := rcvr.
   741                 ex := rcvr.
   742                 offset := i.
   742                 offset := i.
   743                 found := con
   743                 found := con
   744             ] ifFalse:[
   744             ] ifFalse:[
   745                 rcvr isSignal ifTrue:[
   745                 rcvr isExceptionCreator ifTrue:[
   746                     offset := i.
   746                     offset := i.
   747                     found := con
   747                     found := con
   748                 ]
   748                 ]
   749             ]
   749             ]
   750         ].
   750         ].
   828      Exception contexts
   828      Exception contexts
   829     "
   829     "
   830     prev := nil.
   830     prev := nil.
   831     rcvr := con receiver.
   831     rcvr := con receiver.
   832     [   
   832     [   
   833         (rcvr isSignal) or:[(rcvr isKindOf:Exception)]
   833         (rcvr isExceptionHandler) or:[rcvr isException]
   834     ] whileTrue:[
   834     ] whileTrue:[
   835         prev := con.
   835         prev := con.
   836         (con := con sender) isNil ifTrue:[^ offset].
   836         (con := con sender) isNil ifTrue:[^ offset].
   837         offset := offset + 1.
   837         offset := offset + 1.
   838         rcvr := con receiver.
   838         rcvr := con receiver.
   881      We move up the calling chain, skipping all intermediate Signal
   881      We move up the calling chain, skipping all intermediate Signal
   882      and Exception contexts, to present the context in which the error
   882      and Exception contexts, to present the context in which the error
   883      actually occured.
   883      actually occured.
   884      Just for your convenience :-)"
   884      Just for your convenience :-)"
   885 
   885 
   886     |con idx found offset sel prev ex rcvr nMax|
   886     |con found offset sel prev ex rcvr nMax|
   887 
   887 
   888     nMax := aContextArray size.
   888     nMax := aContextArray size.
   889     nMax <= 1 ifTrue:[^ 1].
   889     nMax <= 1 ifTrue:[^ 1].
   890     con := aContextArray at:1.
   890     con := aContextArray at:1.
   891     con isBlockContext ifTrue:[^ 1].
   891     con isBlockContext ifTrue:[^ 1].
   901             ((sel == #halt) or:[sel == #halt:]) ifTrue:[
   901             ((sel == #halt) or:[sel == #halt:]) ifTrue:[
   902                 ^ i + 1
   902                 ^ i + 1
   903             ].
   903             ].
   904             ((sel == #raise) or:[sel == #raiseRequest]) ifTrue:[
   904             ((sel == #raise) or:[sel == #raiseRequest]) ifTrue:[
   905                 rcvr := con receiver.
   905                 rcvr := con receiver.
   906                 (rcvr isKindOf:Exception) ifTrue:[
   906                 (rcvr isException) ifTrue:[
   907                     ex := rcvr.
   907                     ex := rcvr.
   908                     offset := i.
   908                     offset := i.
   909                     found := con
   909                     found := con
   910                 ] ifFalse:[
   910                 ] ifFalse:[
   911                     rcvr isSignal ifTrue:[
   911                     rcvr isExceptionCreator ifTrue:[
   912                         offset := i.
   912                         offset := i.
   913                         found := con
   913                         found := con
   914                     ]
   914                     ]
   915                 ]
   915                 ]
   916             ].
   916             ].
  1005      Exception contexts
  1005      Exception contexts
  1006     "
  1006     "
  1007     prev := nil.
  1007     prev := nil.
  1008     rcvr := con receiver.
  1008     rcvr := con receiver.
  1009     [   
  1009     [   
  1010         (rcvr isSignal) or:[(rcvr isKindOf:Exception)]
  1010         (rcvr isExceptionHandler) or:[(rcvr isException)]
  1011     ] whileTrue:[
  1011     ] whileTrue:[
  1012         prev := con.
  1012         prev := con.
  1013         nMax > offset ifFalse:[^ offset].
  1013         nMax > offset ifFalse:[^ offset].
  1014 
  1014 
  1015         offset := offset + 1.
  1015         offset := offset + 1.
  3402                             findNextContextWithSelector:#raiseRequest 
  3402                             findNextContextWithSelector:#raiseRequest 
  3403                             or:nil or:nil.
  3403                             or:nil or:nil.
  3404         ].
  3404         ].
  3405         
  3405         
  3406         (exContext notNil
  3406         (exContext notNil
  3407         and:[((ex := exContext receiver) isKindOf:Exception)
  3407         and:[((ex := exContext receiver) isException)
  3408         and:[ex signal == Signal noHandlerSignal
  3408         and:[ex signal == Signal noHandlerSignal
  3409         and:[ex parameter signal == Object recursionInterruptSignal]]])
  3409         and:[ex parameter signal == Object recursionInterruptSignal]]])
  3410         ifTrue:[
  3410         ifTrue:[
  3411             "/ debug due to unhandled recursionInterrupt.
  3411             "/ debug due to unhandled recursionInterrupt.
  3412             "/ ask if we should proceed with more stack.
  3412             "/ ask if we should proceed with more stack.
  4232     ^ contextView hasSelection
  4232     ^ contextView hasSelection
  4233 
  4233 
  4234     "Created: / 17.11.2001 / 19:57:03 / cg"
  4234     "Created: / 17.11.2001 / 19:57:03 / cg"
  4235 !
  4235 !
  4236 
  4236 
  4237 hidingContext:aContext
       
  4238     |sel rec mthd mthdClass|
       
  4239 
       
  4240     verboseBacktrace == true ifTrue:[ ^false ].
       
  4241 
       
  4242     sel := aContext selector.
       
  4243     rec := aContext receiver.
       
  4244     mthd := aContext method.
       
  4245     mthd notNil ifTrue:[ mthdClass := mthd mclass ].
       
  4246 
       
  4247     (#( #'doCallHandler:'  
       
  4248         #'doRaise'
       
  4249     ) includes:sel)
       
  4250         ifTrue:[
       
  4251             (rec isSignal or:[rec isException])
       
  4252             ifTrue:[ ^true ].
       
  4253         ].
       
  4254 
       
  4255     (#( #'raise:'  
       
  4256     ) includes:sel)
       
  4257         ifTrue:[
       
  4258             rec isException ifTrue:[
       
  4259                 aContext sender receiver isSignal ifTrue:[^ true].
       
  4260             ].
       
  4261         ].
       
  4262 
       
  4263     (#( 
       
  4264         #handleDo:
       
  4265       ) includes:sel)
       
  4266         ifTrue:[ 
       
  4267             (mthdClass isSubclassOf:Exception) ifTrue:[^ true].
       
  4268             (mthdClass == ExceptionHandlerSet) ifTrue:[^ true].
       
  4269             (mthdClass == HandlerCollection) ifTrue:[^ true].
       
  4270             (mthdClass == SignalSet) ifTrue:[^ true].
       
  4271         ].
       
  4272     (#( 
       
  4273         #withCursor:do:
       
  4274         #withWaitCursorDo:
       
  4275       ) includes:sel)
       
  4276         ifTrue:[ 
       
  4277             (mthdClass == TopView) ifTrue:[^ true].
       
  4278             (mthdClass == ApplicationModel) ifTrue:[^ true].
       
  4279             (mthdClass == WindowGroup) ifTrue:[^ true].
       
  4280         ].
       
  4281 
       
  4282     (#( 
       
  4283         #wait
       
  4284       ) includes:sel)
       
  4285         ifTrue:[ 
       
  4286             (mthdClass == Semaphore) ifTrue:[^ true].
       
  4287             (mthdClass == SemaphoreSet) ifTrue:[^ true].
       
  4288         ].
       
  4289 
       
  4290     ^ false
       
  4291 
       
  4292     "Created: / 17.11.2001 / 19:25:48 / cg"
       
  4293 !
       
  4294 
       
  4295 ignoreBreakpoints
  4237 ignoreBreakpoints
  4296     ^ ignoreBreakpoints
  4238     ^ ignoreBreakpoints
  4297 
  4239 
  4298     "Created: / 17.11.2001 / 18:20:16 / cg"
  4240     "Created: / 17.11.2001 / 18:20:16 / cg"
  4299 !
  4241 !
  4656     sel := aContext selector.
  4598     sel := aContext selector.
  4657     rec := aContext receiver.
  4599     rec := aContext receiver.
  4658     mthd := aContext method.
  4600     mthd := aContext method.
  4659     mthd notNil ifTrue:[ mthdClass := mthd mclass ].
  4601     mthd notNil ifTrue:[ mthdClass := mthd mclass ].
  4660 
  4602 
  4661     (#( #'doCallHandler:'  
  4603     (#(doCallHandler: doRaise
  4662         #'doRaise'
       
  4663     ) includes:sel)
  4604     ) includes:sel)
  4664         ifTrue:[
  4605         ifTrue:[
  4665             (rec isSignal or:[rec isException])
  4606             rec isException ifTrue:[ ^ false].
  4666             ifTrue:[ ^false ].
  4607         ].
  4667         ].
  4608 
  4668 
  4609     (#(raise raiseRequest
  4669     (#( #'raise'
       
  4670         #'raiseRequest'
       
  4671     ) includes:sel)
  4610     ) includes:sel)
  4672         ifTrue:[
  4611         ifTrue:[
  4673             rec isException ifTrue:[
  4612             rec isException ifTrue:[
  4674                 aContext sender receiver isSignal ifTrue:[^ false].
  4613                 aContext sender receiver isExceptionCreator ifTrue:[^ false].
  4675             ].
  4614             ].
  4676         ].
  4615         ].
  4677 
  4616 
  4678     (#( #'doWhile:'
  4617     (#(doWhile:
  4679     ) includes:sel)
  4618     ) includes:sel)
  4680         ifTrue:[
  4619         ifTrue:[
  4681             rec isBlock ifTrue:[
  4620             rec isBlock ifTrue:[
  4682                 aContext sender isBlockContext ifTrue:[^ false].
  4621                 aContext sender isBlockContext ifTrue:[^ false].
  4683             ].
  4622             ].
  4685 
  4624 
  4686     calledContext notNil ifTrue:[
  4625     calledContext notNil ifTrue:[
  4687         calledSel := calledContext selector.
  4626         calledSel := calledContext selector.
  4688         calledRec := calledContext receiver.
  4627         calledRec := calledContext receiver.
  4689 
  4628 
  4690         ((calledSel == #'doWhile:')
  4629         ((calledSel == #doWhile:)
  4691         and:[calledRec isBlock])
  4630         and:[calledRec isBlock])
  4692             ifTrue:[^ false].
  4631             ifTrue:[^ false].
  4693 
  4632 
  4694         ((#( #'valueNowOrOnUnwindDo:'
  4633         ((#(ensure: ifCurtailed: valueNowOrOnUnwindDo: valueOnUnwindDo:   
  4695              #'valueOnUnwindDo:'   
  4634             ) includes:calledSel)
  4696         ) includes:calledSel)
  4635          and:[calledRec isBlock])
  4697         and:[calledRec isBlock])
       
  4698             ifTrue:[^ false].
  4636             ifTrue:[^ false].
  4699 
  4637 
  4700         ((calledSel == #'handle:do:')
  4638         ((calledSel == #handle:do:)
  4701         and:[calledRec isSignalOrSignalSet])
  4639          and:[calledRec isExceptionHandler])
  4702             ifTrue:[^ false].
  4640             ifTrue:[^ false].
  4703     ].
  4641     ].
  4704 
  4642 
       
  4643     (#(handleDo:) includes:sel)
       
  4644         ifTrue:[ 
       
  4645             (calledRec isExceptionHandler) ifTrue:[^ false].
       
  4646         ].
  4705     (#( 
  4647     (#( 
  4706         #handleDo:
  4648         withCursor:do:
  4707       ) includes:sel)
  4649         withWaitCursorDo:
  4708         ifTrue:[ 
       
  4709             (mthdClass isSubclassOf:Exception) ifTrue:[^ false].
       
  4710             (mthdClass == ExceptionHandlerSet) ifTrue:[^ false].
       
  4711             (mthdClass == HandlerCollection) ifTrue:[^ false].
       
  4712             (mthdClass == SignalSet) ifTrue:[^ false].
       
  4713         ].
       
  4714     (#( 
       
  4715         #withCursor:do:
       
  4716         #withWaitCursorDo:
       
  4717       ) includes:sel)
  4650       ) includes:sel)
  4718         ifTrue:[ 
  4651         ifTrue:[ 
  4719             (mthdClass == TopView) ifTrue:[^ false].
  4652             (mthdClass == TopView) ifTrue:[^ false].
  4720             (mthdClass == ApplicationModel) ifTrue:[^ false].
  4653             (mthdClass == ApplicationModel) ifTrue:[^ false].
  4721             (mthdClass == WindowGroup) ifTrue:[^ false].
  4654             (mthdClass == WindowGroup) ifTrue:[^ false].
  4722         ].
  4655         ].
  4723 
  4656 
  4724     (#( 
  4657     (#( 
  4725         #wait
  4658         wait
  4726       ) includes:sel)
  4659       ) includes:sel)
  4727         ifTrue:[ 
  4660         ifTrue:[ 
  4728             (mthdClass == Semaphore) ifTrue:[^ false].
  4661             (mthdClass == Semaphore) ifTrue:[^ false].
  4729             (mthdClass == SemaphoreSet) ifTrue:[^ false].
  4662             (mthdClass == SemaphoreSet) ifTrue:[^ false].
  4730         ].
  4663         ].
  4735     "Modified: / 17.11.2001 / 22:41:42 / cg"
  4668     "Modified: / 17.11.2001 / 22:41:42 / cg"
  4736 !
  4669 !
  4737 
  4670 
  4738 showingContext2:aContext nesting:nesting
  4671 showingContext2:aContext nesting:nesting
  4739     "return false, if this context is to be skipped.
  4672     "return false, if this context is to be skipped.
  4740      Here, we hide some wellKnown methods, which are usually
  4673      Here, we hide some well known methods, which are usually
  4741      not too interesting; 
  4674      not too interesting; 
  4742      the set of methods which are suppressed is my (claus's) own choice."
  4675      the set of methods which are suppressed is my (claus's) own choice."
  4743 
  4676 
  4744     |sel rec mClass 
  4677     |sel rec mClass 
  4745      sender senderReceiver senderSelector senderReceiverClass|
  4678      sender senderReceiver senderSelector senderReceiverClass|
  4797         (sel == #to:do:) ifTrue:[^ false].
  4730         (sel == #to:do:) ifTrue:[^ false].
  4798         (sel == #to:by:do:) ifTrue:[^ false].
  4731         (sel == #to:by:do:) ifTrue:[^ false].
  4799     ].
  4732     ].
  4800 
  4733 
  4801     (mClass == Block) ifTrue:[
  4734     (mClass == Block) ifTrue:[
       
  4735         sel == #ensure: ifTrue:[^ false].
       
  4736         sel == #ifCurtailed: ifTrue:[^ false].
  4802         sel == #valueNowOrOnUnwindDo: ifTrue:[^ false].
  4737         sel == #valueNowOrOnUnwindDo: ifTrue:[^ false].
  4803         sel == #valueOnUnwindDo: ifTrue:[^ false].
  4738         sel == #valueOnUnwindDo: ifTrue:[^ false].
       
  4739         sel == #on:do: ifTrue:[^ false].
  4804 
  4740 
  4805         sel == #value ifTrue:[^ false].
  4741         sel == #value ifTrue:[^ false].
  4806         sel == #value: ifTrue:[^ false].
  4742         sel == #value: ifTrue:[^ false].
  4807         sel == #value:value: ifTrue:[^ false].
  4743         sel == #value:value: ifTrue:[^ false].
  4808         sel == #value:value:value: ifTrue:[^ false].
  4744         sel == #value:value:value: ifTrue:[^ false].
  4831                 (aContext home selector == #wait) ifTrue:[^ false]
  4767                 (aContext home selector == #wait) ifTrue:[^ false]
  4832             ]
  4768             ]
  4833         ]
  4769         ]
  4834     ].
  4770     ].
  4835 
  4771 
  4836     ((mClass == Signal) 
  4772     (rec isExceptionHandler) ifTrue:[
  4837     or:[(mClass == QuerySignal)
       
  4838     or:[mClass == SignalSet]]
       
  4839     ) ifTrue:[
       
  4840         sel == #handle:do: ifTrue:[^ false].
  4773         sel == #handle:do: ifTrue:[^ false].
  4841         sel == #raise ifTrue:[^ false].
  4774         sel == #handleDo: ifTrue:[^ false].
  4842         (sel startsWith:#raiseRequest) ifTrue:[^ false].
  4775         (sel startsWith:#raise) ifTrue:[^ false].
  4843     ].
       
  4844     (mClass == QuerySignal) ifTrue:[
       
  4845         sel == #answer:do: ifTrue:[^ false].
  4776         sel == #answer:do: ifTrue:[^ false].
  4846     ].
  4777     ].
  4847     (mClass == Exception) ifTrue:[
  4778     (rec isException) ifTrue:[
  4848         sel == #doRaise ifTrue:[^ false].
  4779         sel == #doRaise ifTrue:[^ false].
  4849         sel == #doCallHandler: ifTrue:[^ false].
  4780         sel == #doCallHandler: ifTrue:[^ false].
  4850         (sel == #raise or:[sel == #raiseRequest]) ifTrue:[
  4781         (sel == #raise or:[sel == #raiseRequest]) ifTrue:[
  4851             senderReceiverClass == Signal ifTrue:[^ false].
  4782             senderReceiverClass == Signal ifTrue:[^ false].
  4852         ]
  4783         ]
  5870 ! !
  5801 ! !
  5871 
  5802 
  5872 !DebugView class methodsFor:'documentation'!
  5803 !DebugView class methodsFor:'documentation'!
  5873 
  5804 
  5874 version
  5805 version
  5875     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.323 2002-07-09 14:39:17 stefan Exp $'
  5806     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.324 2002-07-15 09:49:06 stefan Exp $'
  5876 ! !
  5807 ! !
  5877 DebugView initialize!
  5808 DebugView initialize!