We’re still here for you! Read about Cincom’s response to COVID-19 here.
Largest Provider of Commercial Smalltalk
Cincom is one of the largest commercial providers of Smalltalk, with twice as many partners and customers than other commercial providers.

Tom Nies

Introducing: New Cincom Smalltalk™ Spy Tool

Cincom Smalltalk has the most powerful debugger in the world, but even in Smalltalk, there are things that are difficult to debug. For instance, you can’t step through a drag-and-drop operation in the debugger the way you might wish. In this case, you might want something that can watch the message sends without interfering and report them to you; much like the Spy++ tool that Windows API programmers are familiar with. This is exactly the capability we are providing in the next release of Cincom Smalltalk.

We’ll quickly explain how this can be done.

  1. In the Refactoring Browser, right-mouse-click on a class or a method and select the menu item “Spy it.”
  2. After this, message sends to instances of the selected class will be logged to the transcript.
  3. The (s) suffix after a class or method name in the browser shows you that you are spying on that item.

Can all methods be spied upon?

Some methods are protected from spying (See class shared variable – Refactory.Wrappers.SpyMethodWrapper>>excludedFromTracing), because they can produce an enormous output.  Another reason is because of the current implementation of MethodWrapper (See MethodWrapper class>>canWrap: inClass:).

What if I don’t want to spy on every instance of a class?

It is possible to spy on individual objects as well. Use the “Spy it” option in the “Object” and context menus in the Trippy inspector.

So, once spying is started, how can it be stopped?

There are a couple ways you can do it:

  • Stop spying all classes – Menu item “stop spying all classes” in context menu for class.
  • Stop spying all methods for current class – Menu item “stop spying” in context menu for class.
  • Stop spying some methods for current class – Menu item “stop spying” in context menu for methods.

What is the difference between “stop spying” and “pause spying”?  

“Pause spying” gives you the ability to temporarily stop spying while keeping the spying configuration intact.  You can resume spying at any time by selecting the “continue spying” menu item.  “Stop spying” completely stops the spying action.

Can spying be used on class side methods?

In short, yes it can. 

If I select “Spy it” on a class, will it spy on super classes or subclasses too?

No, only message sends that dispatch to the method implemented in the selected class will be spied upon.  When spying on individual instances, all messages sent to that object (outside of the limits mentioned above) will be spied upon.

Where is the spy output?

Output is written to the transcript. Look at the transcript window for  Cincom® ObjectStudio® and the launcher window for Cincom® VisualWorks®.

What do the Stack Lookup >> level 0,1,2,3,4 menu items do?

In the output, it shows the stack context path to the current method.

How do you see the spying status of a class or object?

In RB and in Trippy Inspector, it will be shown with the following suffixes: (s) – for instance methods, [s] – for class methods, {s} – for object spying.  The red color means “active spying” while gray means “paused.”

A few tips for using the Spy Tool for the first time:

  1. Please do not try to spy the Object class. Theoretically it is possible, but you will sink in output information.
  2. Please “stop spying” all objects and classes before publishing or loading from Store.