DebugView.st
changeset 1765 a704122c92dc
parent 1764 e7aa6f50e766
child 1776 590f728bcfd4
equal deleted inserted replaced
1764:e7aa6f50e766 1765:a704122c92dc
  1291     v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25).
  1291     v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25).
  1292 
  1292 
  1293     contextView := v scrolledView.
  1293     contextView := v scrolledView.
  1294     contextView action:[:lineNr | self showSelection:lineNr].
  1294     contextView action:[:lineNr | self showSelection:lineNr].
  1295     contextView doubleClickAction:[:line | self browse].
  1295     contextView doubleClickAction:[:line | self browse].
       
  1296     contextView selectConditionBlock:[:line | self checkSelectionChangeAllowed].
  1296 
  1297 
  1297     v := HVScrollableView 
  1298     v := HVScrollableView 
  1298                 for:CodeView 
  1299                 for:CodeView 
  1299                 miniScrollerH:true
  1300                 miniScrollerH:true
  1300                 miniScrollerV:false
  1301                 miniScrollerV:false
  1314     contextInspector := ContextInspectorView
  1315     contextInspector := ContextInspectorView
  1315                                 origin:(0.5 @ 0.0) corner:(1.0 @ 1.0)
  1316                                 origin:(0.5 @ 0.0) corner:(1.0 @ 1.0)
  1316                                     in:hpanel.
  1317                                     in:hpanel.
  1317     contextInspector label:'context'.
  1318     contextInspector label:'context'.
  1318 
  1319 
  1319     "Modified: / 16.1.1998 / 23:29:44 / cg"
  1320     "Modified: / 29.7.1998 / 21:56:51 / cg"
  1320 !
  1321 !
  1321 
  1322 
  1322 initializeMiddleButtonMenu
  1323 initializeMiddleButtonMenu
  1323     <resource: #programMenu >
  1324     <resource: #programMenu >
  1324 
  1325 
  2016 doAbort
  2017 doAbort
  2017     "abort - send Object>>abortSignal, which is usually caught
  2018     "abort - send Object>>abortSignal, which is usually caught
  2018      at save places (for example: in the event loop) and returns back
  2019      at save places (for example: in the event loop) and returns back
  2019      from whatever the process is doing, but does not terminate it."
  2020      from whatever the process is doing, but does not terminate it."
  2020 
  2021 
       
  2022     codeView modified ifTrue:[
       
  2023         (self confirm:('Code modified - abort anyway ?'))
       
  2024         ifFalse:[
       
  2025             ^ self
       
  2026         ]
       
  2027     ].
       
  2028 
  2021     inspecting ifTrue:[
  2029     inspecting ifTrue:[
  2022         inspectedProcess isDead ifTrue:[
  2030         inspectedProcess isDead ifTrue:[
  2023             self showTerminated.
  2031             self showTerminated.
  2024             ^ self
  2032             ^ self
  2025         ].
  2033         ].
  2044         'DebugView [warning]: abort failed' errorPrintCR.
  2052         'DebugView [warning]: abort failed' errorPrintCR.
  2045     ].
  2053     ].
  2046 
  2054 
  2047     ^ self.
  2055     ^ self.
  2048 
  2056 
  2049     "Modified: 10.1.1997 / 17:38:28 / cg"
  2057     "Modified: / 29.7.1998 / 21:48:50 / cg"
  2050 !
  2058 !
  2051 
  2059 
  2052 doContinue
  2060 doContinue
  2053     "continue from menu"
  2061     "continue from menu"
  2054 
  2062 
  2055     |proc exContext ex answer|
  2063     |proc exContext ex answer|
       
  2064 
       
  2065     codeView modified ifTrue:[
       
  2066         (self confirm:('Code modified - continue anyway ?'))
       
  2067         ifFalse:[
       
  2068             ^ self
       
  2069         ]
       
  2070     ].
  2056 
  2071 
  2057     inspecting ifTrue:[
  2072     inspecting ifTrue:[
  2058         device hasColors ifTrue:[
  2073         device hasColors ifTrue:[
  2059             continueButton foregroundColor:Color red darkened.
  2074             continueButton foregroundColor:Color red darkened.
  2060         ].
  2075         ].
  2101             self showSelection:1.
  2116             self showSelection:1.
  2102             self doReturn
  2117             self doReturn
  2103         ]
  2118         ]
  2104     ]
  2119     ]
  2105 
  2120 
  2106     "Modified: / 16.7.1998 / 19:21:59 / cg"
  2121     "Modified: / 29.7.1998 / 21:49:06 / cg"
  2107 !
  2122 !
  2108 
  2123 
  2109 doMicroSend
  2124 doMicroSend
  2110     "single send; reenter with next message send"
  2125     "single send; reenter with next message send"
  2111 
  2126 
  2112     inspecting ifTrue:[^ self].
  2127     inspecting ifTrue:[^ self].
       
  2128 
       
  2129     codeView modified ifTrue:[
       
  2130         (self confirm:('Code modified - step anyway ?'))
       
  2131         ifFalse:[
       
  2132             ^ self
       
  2133         ]
       
  2134     ].
  2113 
  2135 
  2114     canContinue ifTrue:[
  2136     canContinue ifTrue:[
  2115         steppedContext := wrapperContext := nil.
  2137         steppedContext := wrapperContext := nil.
  2116         haveControl := false.
  2138         haveControl := false.
  2117         exitAction := #step.
  2139         exitAction := #step.
  2122         "/ not reached
  2144         "/ not reached
  2123         'DebugView [warning]: send failed' errorPrintCR.
  2145         'DebugView [warning]: send failed' errorPrintCR.
  2124         sendButton turnOff.
  2146         sendButton turnOff.
  2125     ]
  2147     ]
  2126 
  2148 
  2127     "Modified: 10.1.1997 / 17:38:41 / cg"
  2149     "Created: / 6.3.1997 / 21:09:36 / cg"
  2128     "Created: 6.3.1997 / 21:09:36 / cg"
  2150     "Modified: / 29.7.1998 / 21:49:29 / cg"
  2129 !
  2151 !
  2130 
  2152 
  2131 doNext
  2153 doNext
  2132     "skip for next source-code line; entering blocks"
  2154     "skip for next source-code line; entering blocks"
  2133 
  2155 
  2166 !
  2188 !
  2167 
  2189 
  2168 doRestart
  2190 doRestart
  2169     "restart - the selected context will be restarted"
  2191     "restart - the selected context will be restarted"
  2170 
  2192 
       
  2193     codeView modified ifTrue:[
       
  2194         (self confirm:('Code modified - restart anyway ?'))
       
  2195         ifFalse:[
       
  2196             ^ self
       
  2197         ]
       
  2198     ].
       
  2199 
  2171     inspecting ifTrue:[
  2200     inspecting ifTrue:[
  2172         selectedContext isNil ifTrue:[
  2201         selectedContext isNil ifTrue:[
  2173             ^ self showError:'** select a context first **'
  2202             ^ self showError:'** select a context first **'
  2174         ].
  2203         ].
  2175         self interruptProcessWith:[selectedContext unwindAndRestart].
  2204         self interruptProcessWith:[selectedContext unwindAndRestart].
  2185 
  2214 
  2186     "/ not reached
  2215     "/ not reached
  2187     'DebugView [warning]: restart failed' errorPrintCR.
  2216     'DebugView [warning]: restart failed' errorPrintCR.
  2188     restartButton turnOff.
  2217     restartButton turnOff.
  2189 
  2218 
  2190     "Modified: 10.1.1997 / 17:38:36 / cg"
  2219     "Modified: / 29.7.1998 / 21:49:53 / cg"
  2191 !
  2220 !
  2192 
  2221 
  2193 doReturn
  2222 doReturn
  2194     "return - the selected context will do a ^nil"
  2223     "return - the selected context will do a ^nil"
       
  2224 
       
  2225     codeView modified ifTrue:[
       
  2226         (self confirm:('Code modified - return anyway ?'))
       
  2227         ifFalse:[
       
  2228             ^ self
       
  2229         ]
       
  2230     ].
  2195 
  2231 
  2196     inspecting ifTrue:[
  2232     inspecting ifTrue:[
  2197         selectedContext isNil ifTrue:[
  2233         selectedContext isNil ifTrue:[
  2198             ^ self showError:'** select a context first **'
  2234             ^ self showError:'** select a context first **'
  2199         ].
  2235         ].
  2210 
  2246 
  2211     "/ not reached
  2247     "/ not reached
  2212     'DebugView [warning]: return failed' errorPrintCR.
  2248     'DebugView [warning]: return failed' errorPrintCR.
  2213     returnButton turnOff.
  2249     returnButton turnOff.
  2214 
  2250 
  2215     "Modified: 10.1.1997 / 17:38:39 / cg"
  2251     "Modified: / 29.7.1998 / 21:50:03 / cg"
  2216 !
  2252 !
  2217 
  2253 
  2218 doSend
  2254 doSend
  2219     "single send; reenter with next message send"
  2255     "single send; reenter with next message send"
  2220 
  2256 
  2255 
  2291 
  2256     |con method|
  2292     |con method|
  2257 
  2293 
  2258     inspecting ifTrue:[^ self].
  2294     inspecting ifTrue:[^ self].
  2259 
  2295 
       
  2296     codeView modified ifTrue:[
       
  2297         (self confirm:('Code modified - step anyway ?'))
       
  2298         ifFalse:[
       
  2299             ^ self
       
  2300         ]
       
  2301     ].
       
  2302 
  2260     canContinue ifTrue:[
  2303     canContinue ifTrue:[
  2261         selectedContext notNil ifTrue:[
  2304         selectedContext notNil ifTrue:[
  2262             con := actualContext. "/ selectedContext.
  2305             con := actualContext. "/ selectedContext.
  2263             steppedContextLineno := actualContext lineNumber.
  2306             steppedContextLineno := actualContext lineNumber.
  2264         ] ifFalse:[
  2307         ] ifFalse:[
  2314         "/ not reached
  2357         "/ not reached
  2315         'DebugView [warning]: step failed' errorPrintCR.
  2358         'DebugView [warning]: step failed' errorPrintCR.
  2316         stepButton turnOff. nextButton turnOff. sendButton turnOff.
  2359         stepButton turnOff. nextButton turnOff. sendButton turnOff.
  2317     ]
  2360     ]
  2318 
  2361 
  2319     "Modified: / 13.1.1998 / 15:34:14 / cg"
  2362     "Modified: / 29.7.1998 / 21:50:16 / cg"
  2320 !
  2363 !
  2321 
  2364 
  2322 doStop
  2365 doStop
  2323     "stop the process (if its running, otherwise this is a no-op)"
  2366     "stop the process (if its running, otherwise this is a no-op)"
  2324 
  2367 
  2337     "Modified: 20.10.1996 / 18:30:48 / cg"
  2380     "Modified: 20.10.1996 / 18:30:48 / cg"
  2338 !
  2381 !
  2339 
  2382 
  2340 doTerminate
  2383 doTerminate
  2341     "terminate - the process has a chance for cleanup"
  2384     "terminate - the process has a chance for cleanup"
       
  2385 
       
  2386     codeView modified ifTrue:[
       
  2387         (self confirm:('Code modified - terminate anyway ?'))
       
  2388         ifFalse:[
       
  2389             ^ self
       
  2390         ]
       
  2391     ].
  2342 
  2392 
  2343     inspecting ifTrue:[
  2393     inspecting ifTrue:[
  2344         self processPerform:#terminate.
  2394         self processPerform:#terminate.
  2345         ^ self
  2395         ^ self
  2346     ].
  2396     ].
  2357         'DebugView [warning]: terminate failed' errorPrintCR.
  2407         'DebugView [warning]: terminate failed' errorPrintCR.
  2358         self warn:'terminate failed'.
  2408         self warn:'terminate failed'.
  2359     ].
  2409     ].
  2360     terminateButton turnOff.
  2410     terminateButton turnOff.
  2361 
  2411 
  2362     "Modified: 10.1.1997 / 17:38:22 / cg"
  2412     "Modified: / 29.7.1998 / 21:50:35 / cg"
  2363 !
  2413 !
  2364 
  2414 
  2365 doTrace
  2415 doTrace
  2366     "tracing - not really implemented ..."
  2416     "tracing - not really implemented ..."
  2367 
  2417 
  3285     "Modified: / 29.7.1998 / 15:08:05 / cg"
  3335     "Modified: / 29.7.1998 / 15:08:05 / cg"
  3286 ! !
  3336 ! !
  3287 
  3337 
  3288 !DebugView methodsFor:'user interaction'!
  3338 !DebugView methodsFor:'user interaction'!
  3289 
  3339 
       
  3340 checkSelectionChangeAllowed
       
  3341     codeView modified ifTrue:[
       
  3342         ^ self confirm:('Code modified - change selection anyway ?')
       
  3343     ].
       
  3344 
       
  3345     ^ true
       
  3346 
       
  3347     "Created: / 29.7.1998 / 21:57:02 / cg"
       
  3348     "Modified: / 29.7.1998 / 21:57:34 / cg"
       
  3349 !
       
  3350 
  3290 codeAccept:someCode
  3351 codeAccept:someCode
  3291     "user wants some code to be recompiled - must unwind stack since everything above
  3352     "user wants some code to be recompiled - must unwind stack since everything above
  3292      and including selected method cannot be continued."
  3353      and including selected method cannot be continued."
  3293 
  3354 
  3294     "
  3355     "
  3348          from context chain
  3409          from context chain
  3349         "
  3410         "
  3350         (newMethod notNil and:[newMethod ~~ #Error]) ifTrue:[
  3411         (newMethod notNil and:[newMethod ~~ #Error]) ifTrue:[
  3351             self setContext:(top sender).
  3412             self setContext:(top sender).
  3352 
  3413 
       
  3414             codeView modified:false.
       
  3415 
  3353             "
  3416             "
  3354              continue/step is no longer possible
  3417              continue/step is no longer possible
  3355             "
  3418             "
  3356             canContinue := false.
  3419             canContinue := false.
  3357             self showSelection:1.
  3420             self showSelection:1.
  3358             exitAction := #return
  3421             exitAction := #return
  3359         ].
  3422         ].
  3360     ].
  3423     ].
  3361     codeView cursor:Cursor normal
  3424     codeView cursor:Cursor normal.
  3362 
  3425 
  3363     "Modified: / 18.6.1998 / 14:47:30 / cg"
  3426     "Modified: / 29.7.1998 / 21:44:54 / cg"
  3364 !
  3427 !
  3365 
  3428 
  3366 destroy
  3429 destroy
  3367     "closing the debugger implies an abort or continue"
  3430     "closing the debugger implies an abort or continue"
       
  3431 
       
  3432     codeView modified ifTrue:[
       
  3433         (self confirm:('Code modified - exit anyway ?'))
       
  3434         ifFalse:[
       
  3435             ^ self
       
  3436         ]
       
  3437     ].
  3368 
  3438 
  3369     contextView middleButtonMenu hide.
  3439     contextView middleButtonMenu hide.
  3370     inspecting ifFalse:[
  3440     inspecting ifFalse:[
  3371         "I am running on top of a process, abort or continue it"
  3441         "I am running on top of a process, abort or continue it"
  3372 
  3442 
  3402 
  3472 
  3403     "/ since I am going to be destroyed, remove me from the cache
  3473     "/ since I am going to be destroyed, remove me from the cache
  3404     self uncacheMyself.
  3474     self uncacheMyself.
  3405     super destroy.
  3475     super destroy.
  3406 
  3476 
  3407     "Modified: 10.7.1997 / 17:15:41 / stefan"
  3477     "Modified: / 10.7.1997 / 17:15:41 / stefan"
  3408     "Modified: 12.8.1997 / 02:07:19 / cg"
  3478     "Modified: / 29.7.1998 / 21:48:11 / cg"
  3409 !
  3479 !
  3410 
  3480 
  3411 doShowSelection:lineNr
  3481 doShowSelection:lineNr
  3412     "user clicked on a header line - show selected code in textView.
  3482     "user clicked on a header line - show selected code in textView.
  3413      Also sent to autoselect an interesting context on entry."
  3483      Also sent to autoselect an interesting context on entry."
  3458         ex return.
  3528         ex return.
  3459     ] do:[
  3529     ] do:[
  3460         self doShowSelection:lineNr
  3530         self doShowSelection:lineNr
  3461     ]
  3531     ]
  3462 
  3532 
  3463     "Modified: / 8.11.1997 / 19:38:03 / cg"
  3533     "Modified: / 29.7.1998 / 21:57:11 / cg"
  3464 !
  3534 !
  3465 
  3535 
  3466 updateForContext:lineNr
  3536 updateForContext:lineNr
  3467     "show selected code for lineNr in contextList in textView.
  3537     "show selected code for lineNr in contextList in textView.
  3468      Also used to autoselect an interesting context on entry."
  3538      Also used to autoselect an interesting context on entry."
  3740             actualContext := con
  3810             actualContext := con
  3741         ].
  3811         ].
  3742     ] ifFalse:[
  3812     ] ifFalse:[
  3743         codeView contents:nil.
  3813         codeView contents:nil.
  3744     ].
  3814     ].
       
  3815     codeView modified:false.
  3745 
  3816 
  3746     con isContext ifFalse:[
  3817     con isContext ifFalse:[
  3747         sendButton disable.
  3818         sendButton disable.
  3748     ] ifTrue:[
  3819     ] ifTrue:[
  3749         sendButton enable.
  3820         sendButton enable.
  3781             m disableAll:#(browse browseClass browseClassHierarchy browseFullClassProtocol).
  3852             m disableAll:#(browse browseClass browseClassHierarchy browseFullClassProtocol).
  3782         ].
  3853         ].
  3783     ]
  3854     ]
  3784 
  3855 
  3785     "Created: / 14.8.1997 / 20:15:00 / cg"
  3856     "Created: / 14.8.1997 / 20:15:00 / cg"
  3786     "Modified: / 17.6.1998 / 15:38:40 / cg"
  3857     "Modified: / 29.7.1998 / 21:45:27 / cg"
  3787 ! !
  3858 ! !
  3788 
  3859 
  3789 !DebugView class methodsFor:'documentation'!
  3860 !DebugView class methodsFor:'documentation'!
  3790 
  3861 
  3791 version
  3862 version
  3792     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.211 1998-07-29 17:04:07 cg Exp $'
  3863     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.212 1998-07-30 09:21:43 cg Exp $'
  3793 ! !
  3864 ! !
  3794 DebugView initialize!
  3865 DebugView initialize!