DebugView.st
changeset 1284 091454814297
parent 1281 21d1a15c13da
child 1289 9b84a29da934
equal deleted inserted replaced
1283:8218384b04c2 1284:091454814297
  3244 
  3244 
  3245     "Modified: 10.7.1997 / 17:15:41 / stefan"
  3245     "Modified: 10.7.1997 / 17:15:41 / stefan"
  3246     "Modified: 12.8.1997 / 02:07:19 / cg"
  3246     "Modified: 12.8.1997 / 02:07:19 / cg"
  3247 !
  3247 !
  3248 
  3248 
  3249 showSelection:lineNr
  3249 doShowSelection:lineNr
  3250     "user clicked on a header line - show selected code in textView.
  3250     "user clicked on a header line - show selected code in textView.
  3251      Also sent to autoselect an interesting context on entry."
  3251      Also sent to autoselect an interesting context on entry."
  3252 
  3252 
  3253     |con homeContext sel method code canAccept
  3253     |con homeContext sel method code canAccept
  3254      implementorClass lineNrInMethod rec m line
  3254      implementorClass lineNrInMethod rec m line
  3373                     sel notNil ifTrue:[
  3373                     sel notNil ifTrue:[
  3374                         canAccept := true.
  3374                         canAccept := true.
  3375 
  3375 
  3376                         implementorClass := homeContext methodClass.
  3376                         implementorClass := homeContext methodClass.
  3377                         implementorClass isNil ifTrue:[
  3377                         implementorClass isNil ifTrue:[
  3378                             "
  3378                             Object errorSignal handle:[:ex |
  3379                              special: look if this context was created by
  3379                                 code := 'error while asking method for its source'.
  3380                              valueWithReceiver kind of method invocation;
       
  3381                              if so, grab the method from the sender and show it
       
  3382                             "
       
  3383                             ((sender := homeContext sender) notNil
       
  3384                             and:[(sender selector startsWith:'valueWithReceiver:')
       
  3385                             and:[sender receiver isMethod]]) ifTrue:[
       
  3386                                 method := sender receiver.
       
  3387                                 self sensor shiftDown ifTrue:[
       
  3388                                     code := method decompiledSource
       
  3389                                 ] ifFalse:[
       
  3390                                     code := method source.
       
  3391                                 ].
       
  3392                                 canAccept := false.
  3380                                 canAccept := false.
  3393                             ] ifFalse:[
  3381                                 ex return.
  3394                                 (method := con method) notNil ifTrue:[
  3382                             ] do:[
       
  3383                                 "
       
  3384                                  special: look if this context was created by
       
  3385                                  valueWithReceiver kind of method invocation;
       
  3386                                  if so, grab the method from the sender and show it
       
  3387                                 "
       
  3388                                 ((sender := homeContext sender) notNil
       
  3389                                 and:[(sender selector startsWith:'valueWithReceiver:')
       
  3390                                 and:[sender receiver isMethod]]) ifTrue:[
       
  3391                                     method := sender receiver.
  3395                                     self sensor shiftDown ifTrue:[
  3392                                     self sensor shiftDown ifTrue:[
  3396                                         code := method decompiledSource
  3393                                         code := method decompiledSource
  3397                                     ] ifFalse:[
  3394                                     ] ifFalse:[
  3398                                         code := method source.
  3395                                         code := method source.
  3399                                     ].
  3396                                     ].
  3400                                     canAccept := false.
  3397                                     canAccept := false.
       
  3398                                 ] ifFalse:[
       
  3399                                     (method := con method) notNil ifTrue:[
       
  3400                                         self sensor shiftDown ifTrue:[
       
  3401                                             code := method decompiledSource
       
  3402                                         ] ifFalse:[
       
  3403                                             code := method source.
       
  3404                                         ].
       
  3405                                         canAccept := false.
       
  3406                                     ]
  3401                                 ]
  3407                                 ]
  3402                             ]
  3408                             ]
  3403                         ] ifFalse:[
  3409                         ] ifFalse:[
  3404                             method := implementorClass compiledMethodAt:sel.
  3410                             method := implementorClass compiledMethodAt:sel.
  3405                         ].
  3411                         ].
  3407                 ].
  3413                 ].
  3408 
  3414 
  3409                 code isNil ifTrue:[
  3415                 code isNil ifTrue:[
  3410                     errMsg := nil.
  3416                     errMsg := nil.
  3411                     method notNil ifTrue:[
  3417                     method notNil ifTrue:[
  3412                         self sensor shiftDown ifTrue:[
  3418                         Object errorSignal handle:[:ex |
  3413                             code := method decompiledSource
  3419                             code := 'error while asking method for its source'.
  3414                         ] ifFalse:[
  3420                             canAccept := false.
  3415                             code := method source.
  3421                             ex return.
       
  3422                         ] do:[
       
  3423                             self sensor shiftDown ifTrue:[
       
  3424                                 code := method decompiledSource
       
  3425                             ] ifFalse:[
       
  3426                                 code := method source.
       
  3427                             ].
  3416                         ].
  3428                         ].
  3417                         code isNil ifTrue:[
  3429                         code isNil ifTrue:[
  3418                             method sourceFilename notNil ifTrue:[
  3430                             method sourceFilename notNil ifTrue:[
  3419                                 codeView contents:(resources 
  3431                                 codeView contents:(resources 
  3420                                                            string:'** no sourcefile: %1 **'
  3432                                                            string:'** no sourcefile: %1 **'
  3536                 m disableAll:#(browse browseClass browseClassHierarchy browseFullClassProtocol).
  3548                 m disableAll:#(browse browseClass browseClassHierarchy browseFullClassProtocol).
  3537             ].
  3549             ].
  3538         ]
  3550         ]
  3539     ].
  3551     ].
  3540 
  3552 
  3541     "Modified: 5.8.1997 / 02:11:50 / cg"
  3553     "Created: 14.8.1997 / 20:15:00 / cg"
       
  3554     "Modified: 14.8.1997 / 20:19:14 / cg"
       
  3555 !
       
  3556 
       
  3557 showSelection:lineNr
       
  3558     "user clicked on a header line - show selected code in textView.
       
  3559      Also sent to autoselect an interesting context on entry."
       
  3560 
       
  3561     Object errorSignal handle:[:ex |
       
  3562         'DebugView [info]: error when showing selection in debugger ignored' infoPrintCR.
       
  3563         ex return
       
  3564     ] do:[
       
  3565         self doShowSelection:lineNr
       
  3566     ]
       
  3567 
       
  3568     "Modified: 14.8.1997 / 20:16:21 / cg"
  3542 ! !
  3569 ! !
  3543 
  3570 
  3544 !DebugView class methodsFor:'documentation'!
  3571 !DebugView class methodsFor:'documentation'!
  3545 
  3572 
  3546 version
  3573 version
  3547     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.168 1997-08-12 00:29:47 cg Exp $'
  3574     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.169 1997-08-14 18:39:48 cg Exp $'
  3548 ! !
  3575 ! !
  3549 DebugView initialize!
  3576 DebugView initialize!