PackageDescription: Zork-Analysis
Zork - AnalysisLast published: August 5, 2003 by 'niallr'
Defines 40 Classes
Extends 43 Classes
The Analysis Browser dynamically recovers type (and coverage) information as code is run. This version prereqs John Brant's Method Wrappers Base (instead of using its own method wrapper clones) and the Arbor help system. It has been tested on VW7.0 with and without Aragon utilities loaded. (A version is available for VW5i4/Envy. This version will work on VW5i4/Store provided you implement CompiledMethod>>selector.)
The Analysis Browser was written by Michel Tilman (mtilman@acm.org). Niall Ross (nfr@bigwig.net) ported it to VW7 (and 5i.4/Store and 5i4/Envy), and fixed some bugs. Reinout Heeck (reinout@soops.nl) has provided useful feedback.
Use
===
1) Launch the browser by invoking 'Analysis Browser' from the VisualLauncher Tools menu. Select 'File>Install wrappers'. In the left-hand side of the dialog select a namespace (from the drop-down list invoked by clicking the top-left button) and select categories within that namespace. On the right-hand side, select the classes you want to monitor.
2) Exercise the code you have just instrumented (i.e. run the application you are interested in, run some tests, whatever).
3) Refresh the browser (select something or invoke 'Refresh' from the view menu or 'View>Toolbar' and hit third button), then browse the code:
- coverage is shown on the navigator pane
- move the mouse over an element in the code pane to see its types
- click an element in the code pane to see its recovered type(s) in the lower right pane
- click on a recovered type to have the browser show that type. Click on the toolbar back button to go back again.
Items that are blue or that turn blue when the mouse is over them are the ones that may be clicked. (Exception: the method name itself remanes black-bold but can be clicked to see what types the method returned.)
4) Uninstall wrappers when you are done. Closing the window will also uninstall wrappers (FYI, Refactory.Wrappers.MethodWrapper nuke is a last ditch method for eliminating wrappers from your image if you somehow crash the AB and don't know what is wrapped.)
Wrapped code runs some 6 times slower than unwrapped.
Known Limitations
==============
This is work in progress and needs refactoring in places. My (Niall Ross) intent is to make it a code tool in the Refactoring Browser, thence to integrate its features with the rewrite tool. Thus I do not plan to do significant work on the browser's current navigator UI. I do plan to look at refactoring the way analysis information is gathered in the #eval: methods to support a strategy pattern (keeping an eye on efficiency).
- There are currently no safeguards against tracing methods used by the tool. This may lead into all sorts of problems, hence either stay away from monitoring kernel classes until this is remedied or take the risk but save first (which might be prudent anyway when methods are being wrapped).
- Not all Smalltalk constructs are supported; e.g. 'thisContext' is not recognized.
- The hypertext functionality is currently rather ad-hoc (so is the implementation).
- if you have the drop-down namespace list set to view less than the whole system (i.e. not Smalltalk *) and you click on a traced type that is outside your viewed namespace(s), then nothing will happen; the browser will not jump to the class as it's outside the current viewing scope. Just widen the scope (back to Smalltalk *) and try again.
- The toolbar forward button is not yet implemented.
- The 'Install Wrappers' widget's labels do not scale with text size changes (so if you like 'Large text', they will be a pixel or two too large).
- The browser does not show namespaces in its navigator, thus selecting the blank line at the top of some namespaces' category lists will not show anything.
- In prior versions, with wrappers installed, the PDP debugger had trouble when selecting certain stack frames within an #eval: by an Analysis Browser wrapper. This is being examined.
- With Aragon utilities loaded, the scroll wheel may not work on the Namespaces drop-down list (and may cause an unhandled exception on some platforms); if you see this, just scroll by hand and don't use the wheel.
Further information
===============
Michel Tilman's web page describes the VW2.5 implementation and has a picture of the 5i.3 version: visit
http://users.pandora.be/michel.tilman/Smalltalk/
Niall Ross' ESUG2000 conference report describes the tool in the section on meta-programming, report on 'Building Run-Time Analysis Tools using Pluggable Interpreters': visit
http://www.esug.org/summerschools/2000_Southampton/report/ESUG2000publicV2.pdf
Fixed since release CS6.NFR.3
==========================
- The browser now works with Aragon utilities loaded.
- Clicking on a method that DNU-ed now takes you to the DNU implementation that was invoked (formerly raised an error).
- We now use John Brant's MethodWrappers. Our override of Behavior>>rebindMethod:oldVariableNames: have been eliminated in favour of John's ClassDescription>>rebindMethod:oldVariableNames:. Our duplicate method wrapper classes have been eliminated, except for Zork.CoverageMethodWrapper which differs significantly from Refactory.Wrappers.CoverageMethodWrapper; ours invokes the Zork.AG.* evaluation framework on the wrapped methods contents.
- Fixed the screen updating error that caused:
- select protocol or method in the browser
- install wrappers on classes including selected
- Reselect method causes walkback (failed #detect: inside a call of #protocolOf:)