[prev] [up]

Other Tools

This document is unfinished - there a quite a bunch of other tools to be documented ...

Index

Transcript - The Smalltalk Messages Window

In smalltalk, the Transcript plays the role of a console, where useful information is sent to. For example, the compiler outputs progress information onto the transcript when compiling methods from a file or from the browser.

From your programs, you can send output to the Transcript via the messages:

   Transcript show:String

   Transcript showCR:String

   Transcript cr

In very old Smalltalk versions, the Transcript and Launcher (described below) were two separate applications.
Today, these two applications have been merged into a new Launcher.

NewLauncher - Combined Launcher and Transcript Tool

The Launcher allows startup of commonly used tools and utilities, and contains the transcript window for messages to the user.
This application offers pulldown menus and buttons to open useful applications, monitors and to perform most common operations.

In addition, the language, viewStyle and compiler settings can be set via more convenient dialogs (in previous versions, these had to be set by evaluating Smalltalk expressions in a workspace or by editing the startup scripts).

The launcher is typically started from your "private.rc" startup file.

[missing fig.: newLauncher hardcopy]

Starting with ST/X rev 3.3, the Launcher was completely rewritten, using the new UI-builder framework.
The items found in the pullDown-menu and the toolBar panel can now be changed using the convenient menu-editor; i.e. it is very easy to create a user/project specific subclass with different functions offered.
Also, the launchers functionality was moved to an abstract generic launcher superclass, which does not provide any GUI, but is purely functional.
This architecture allows for future- and custom launchers to be build easily.

Workspace - A Tool for Expression Evaluation

Workspaces allow smalltalk expression to be entered and evaluated.
You can also use them as scratchpads or notepads for ordinary text.

Beside the general text editing features, Workspaces allow for Smalltalk code to be evaluated (interpreted); to do this, select some text which represents a valid smalltalk expression, and use one of the following pop-menu functions for evaluation:

There are also keyboard shortcuts for the above function - typically "ALT-d" , "ALT-p" , "ALT-i" and "ALT-Shift-B". (On Windows systems, the "CTRL" key is used instead of the "ALT"-Key).

An ongoing expression evaluation can be interrupted and a debugger is opened by pressing "CTRL-C" ("Break" under Windows).
By pressing the Abort key, "CTRL-Y", an ongoing expression evaluation can be aborted (without going into a debugger).
Aborting means: 'raising an AbortSignal', which is cought in all views' eventLoop.

Starting with release 4.1 of ST/X, workspaces support multiple pages (aka "buffers" or "tabs") and a pull down menu, with additional functions:

In addition, WorkspaceVariables and DoItVariables have been added.

The workspaces menu provides an item "Auto Define Workspace Variables" which can be checked to force all unknown variables to be automatically declared as workspace variables.
If this option is turned off, undefined variables trigger an error message, as usual.

Click here for a tutorial about workspaces.

Inspector - Looking into an Object

Introduction

Inspectors allow looking into an object. They usually consist of 2 subviews, one showing the names (and possibly indices) of the objects instance variables, the other showing the value of the selected instance variable.

There are some specialized inspectors (for example: image inspectors), which add more subviews and/or show the object additionally in a more user friendly form.

Opening an inspector

Inspectors can be started: Beside the obvious behavior, there are some special situations to consider: Examples (click to execute):

    #('one' #two 3.0 4) inspect
 
    #('one' #two 3.0 4) asOrderedCollection inspect
 
    #('one' #two 3.0 4) asOrderedCollection basicInspect
 
    ( #('one' #two 3.0 4) asOrderedCollection removeFirst; yourself ) inspect 
 
    ( #('one' #two 3.0 4) asOrderedCollection removeFirst; yourself ) basicInspect
 
    (Image fromFile:'bitmaps/SBrowser.xbm') inspect
 
    (Image fromFile:'bitmaps/SBrowser.xbm') basicInspect
 
    (Color yellow) inspect
 
    (Color yellow) basicInspect
 
    (Array new:400) inspect

Inspect vs. basicInspect

Sending #basicInspect to an object will always open a general inspector, which shows instance variables as they are physically present in the inspected object.

In contrast, #inspect is redefined in some classes to open an inspector showing the logical contents. In some collections, the physical implementation uses an extra collection to hold the contents. Try inspecting an (nonempty) instance of Dictionary to see the difference:


    |d|
    d := Dictionary new.
    d at:#foo put:1.
    d at:#bar put:2.
    d inspect.
    d basicInspect.

Process Monitor - Show & Manipulate Smalltalk Processes

This tool displays a list of active Smalltalk processes (i.e. threads) and their current state. Its popupMenu allows common operations to be applied to processes.
A process monitor is a very useful tool to find (and terminate or debug) leftover background processes - especially during program development & debugging.

[missing fig.: process monitor hardcopy]

To start a process monitor, press this button: .
The fields are: The states shown are: The process which ran at the time of the update is marked with an (*) character. If none is marked, the scheduler was active (or waiting for an event).
Processes which ran during the last timeSlicing period (1/10th second) are marked with a (+) character.

The list is updated every few seconds, so be prepared for some delayed visibility of new processes.

A popup-menu allows some operations to be performed on a selected process:

By holding down the "CTRL" key while pressing the middle button, another popupMenu is opened, which allows toggling the display details flag.
With details on, more info is shown (which you might not be interested in).
The additional information (among others) is: Other items are only of interest for ST/X runtime system debugging.

Probably the most useful item found is the debug function, which opens an inspector-like debugger on the selected process.
This may be useful if some process is waiting on a semaphore and you want to see exactly where the wait is and how it reached it. With the debuggers monitor option, you can even watch & see what that process is doing !

Note:
Since at the time of the view update, the active process is always the process monitor itself, the distinction between run and active states is useless here: you will always see that process as being active in the monitors display.

Semaphore Monitor - Show semaphores

This tool displays a list of Smalltalk semaphores, their internal count and the list of processes on its waiting list.
This tool is useful to debug deadlock or endless-wait situations in multithread applications.

[missing fig.: semaphore monitor hardcopy]

To start a semaphore monitor, press this button: .
The columns shown are:

Memory Monitor - Displays overall Memory Usage

This utility displays the amount of object memory used by the system, and displays various other statistic values.
Its popUpMenu offers functions to manually perform either blocking- or nonBlocking background garbage collects.
Some of those functions are provided as debugging & measuring tools, and not required by the typical user.

[missing fig.: memory monitor hardcopy]

To start a memory monitor, press this button: .
The numbers shown are (top to bottom):
the other numbers are less of interest to normal users, but give some info to VM developers: the graphic displays a history of the used amount. Newspace size is shown in yellow (light grey in b&w displays), freelistspace in green (dark grey) and oldspace in white.

The history is updated twice a second. Use the key-commands 'f' (for faster) and 's' (for slower) to change the update interval.
Pressing 'r' (for reset) rescales the display.

The typical picture shown is some saw-tooth figure; memory use is usually growing until a new-space collection reduces the amount.

The memoryMonitor also provides a popup menu for common garbage collect operations:

The others submenu allows less frequently needed operations to be invoked:

Memory usage - Displays Statistics on Memory Usage by Class

This utility displays the amount of memory allocated by individual classes. The display can be sorted by different criteria - use its popupMenu to change this.

[missing fig.: memory usage view hardcopy]

To start a memory usage monitor, press this button: .

Since scanning the memory is a time consuming operation, there is no automatic update of the list; use the menus update function to manually update the display.

A memoryUsageView is useful to find memory leaks. In Smalltalk, these are not caused by not freeing memory, but instead by keeping references to objects in globals or class variables.
(so, if you find those leaks, dont blame it on the garbage collector; the collector cannot free the memory as long as any reachable reference to an object exists.)
The menu includes two very useful functions, which help in finding those references:

Thus, if you have trouble finding out why some object is not garbage collected, open a memory usage view, select the class and use the ref chains menu function to find out how those instances are still references.

Notice, that the owners function will not be much of a help, if the object in question is kept from being freed by a long chain of references (for example, if its in a long linked list which is anchored in a global variable).

Also notice, that the ref chains function may be very time consuming.

Event monitor - Displays Events sent to a View

This tool is useful when keyboard mappings are changed or tested. It outputs the incoming event-messages on the standard output (xterm-window).
(comparable to the 'xev' XWindow utility).
To try it, open an eventMonitor, place the mouse pointer into it, and press some key(s) on the keyboard. Watch the xterms output.
To start an event monitor, press this button: .

Graphical view tree - Shows a Views Widget Hierarchy

This tool displays a views widget hierarchy graphically (Smalltalk views only). When started via the launcher, a crosshair cursor is shown, and you should click on some (smalltalk-) view on the screen.
That views widget hierarchy will then be displayed; visible components are displayed in red color, invisible (i.e. hidden or unmapped views) are drawn black.
The popupMenu shows various details about a selected widget and allows further inspection.

[missing fig.: treeview hardcopy]

A graphical viewTree can be opened via the launchers "tools-views" pullDown menu; either on a single view (which is to be selected with the mouse), or on all views. cvs add: TOP.html already exists, with version number 1.48

Method Finder - Find a Selector by argument & result

A tool ported from squeak that can be started via the Laucher "classes-special-methodFinder".

Use an example to find a method in the system. Type receiver, args, and answer in the top panes, like 4 5 1. Then press the search button. The lower left pane will show all messages which - when send to the receiver 4 with an argument of 5 answer the value 1.
Try it again with a receiver of 'hello', and argument of 3 and an answer of 'llo'.

You can write expressions in the fields to create a non-literal object such as a Dictionary (rather than using strings and numbers).
In addition, a limited browser is included: selecting an item in the lower left pane shows the implementors in the upper right pane; selecting any of the implementors will display the methods code in the lower right pane (which is readOnly; i.e. no accept is possible).

The methodFinder-GUI is actually using the MethodFinder-class to do the actual work. This one provides even more search functionality;
for example, if you evaluate (printIt) the following in a workspace

    MethodFinder methodFor: #( 
				(4 3) 7  
				(0 5) 5  
				(5 5) 10)

it will discover (data1 + data2) - i.e. a message selector which satisfies all of the three constraints.

This tools was originally written by Dan Ingalls (? not 100% sure here) for Squeak.

SUnit - Unit testing framework and TestRunner GUI

This framework (-> Kent Beck, Ward Cunningham and others) allows for convenient component testing.
This tool was ported to ST/X by Samuel Shuster and Travis Triggs - thanks to you and all other Camp Smalltalk freaks !

For automatic testing, testcases (subclasses of TestCase) should define a bunch of methods named 'test*', which test various aspects of your code.
For checks, the inherited messages #assert:, #should, #shouldNot etc. should be used.
See the provided ExampleSetTest for more info on how to use this.

The TestRunner GUI interface automatically searches for all testCases as present in the system, and offers execution via a convenient pull-down list:

[missing fig.: sunit testRunner hardcopy]

After selection of the test, run its test-methods by pressing the Run-Button.
All failures will be collected and provided in the lower pull-down list for debugging.

Although simple, this is a very useful tool and we highly recommend its use - it will make your life MUCH easier. Please read some good book(s) on eXtreme programming or Kent Becks original "Smalltalk Testing"" paper for more information.

Using the TestRunner

The TestRunner is started either by double-clicking on a TestCase class in the browser, by evaluating:
    TestRunner open.
or via the launchers "tools-SUnit" menu item.

A test runner can also be started with this button: .
The main information windows shows progress information (while executing testCases) and the final result. Its color is changed to yellow while executing, and back to green (if all ok) or red if any testCase failed.

[stx logo] Copyright © 1995 Claus Gittinger Development & Consulting, all rights reserved

<cg@exept.de>

Doc $Revision: 1.64 $ $Date: 2003/03/31 09:42:00 $