PackageDescription: Zork-Analysis


Zork - Analysis

Last published: May 12, 2020 by 'heeg'

Defines 26 Classes
Extends 40 Classes


Zork-Analysis may dynamically recover type (and coverage) information as code is run. This version prereqs John Brant's Method Wrappers Base. It has been tested on VW9.0.

The original Analysis Browser was written by Michel Tilman (mtilman@acm.org). It has been replaced with an integration of the code coverage analysis machinery into the normal SystemBrowser.
- MenuItems are provided to install/uninstall coverage analysis wrappers to pundle/class/protocol/method.
- Installing/Uninstalling for selected pundles will instrument all instance and class methods belonging to the selected pundles.
- Installing/Uninstalling for a single class or protocols will instrument either instance or class methods.

The result display of coverage percentages is added to the list items of the pundle/class/protocol/method lists; percentages for a class will not be shown when in class hierarchy mode.
Currently, the result display for Bundles slows down the SystemBrowser operation because of extensive calculations, therefore a setting is available which switches the bundle display off by default (Settings -> Zork-Analysis -> Display Coverage Values for Bundles); use at your own risk!

Coverage results for classes are displayed according to another setting: (Settings -> Zork-Analysis -> Display Instance and Class Coverage Values for Classes). By default, either instance or class coverage values are displayed, like '[28%] Array'. With the setting switched on, the display will be like: '[28%/70%] Array'.

Coverage results are displayed in every open SystemBrowser.
If a method with coverage information is selected, an additional Tab 'Coverage' is provided as a CodeTool, allowing to analyze the collected information for the method. Statements in the methods source will be displayed with a green background where coverage information was collected. Such statements will show their collected type information in a hover help window. When clicking into such a staement, either a broeser opens on the tracked type (a.k. the class), or if multiple types were traced, a Menu opens with all available types (a.k. class names).
Implementation details:
- display of the percentage values for PundleModels reuses some methods also to be found in package 'SUnitToo(lsoverage)'.
PLEASE do not try to load both coverage tools at the same time!
(Authors: Ralf Propach, Roland Wagener, Georg Heeg eK)

Use
===
1) Launch the SystemBrowser from the VisualLauncher. Select a pundle, or a class, or a protocol, or a method, and choose 'Install Coverage' from the respective list menu. As a first feedback, the initial percentage of coverage of the selected items in the lists will show '[0%]' in front of each item.

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 should be almost instantly, if you re-select the pundle containing the instrumented code. Now browse the code:
- for an instrumented method, the Coverage-Tab will show the collected information,
- hover over an expression element in the code pane to see the recovered type(s) in a hover help window,
- click on the expression element to navigate directly to a single collected type, or choose the desired type from the menu;
+ click on the browsers back button to go back to the selected method again.
- code colored green means: these statements of the method were executed,
- code that is not colored means: the statements were not executed
+ no hover help will be shown, because there was no information collected.

4) Uninstall wrappers when you are done. This may be done selectively for a single method, a protocoll or a class, or for all code of a pundle.
Closing the SystemBrowser window will NOT uninstall wrappers! If you save the image, installed wrappers will also be saved.
(FYI, "Refactory.Wrappers.MethodWrapper nuke" is a last ditch method for eliminating wrappers from your image if you 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.

- 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).

- 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.

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