-->
Previous Table of Contents Next


Using the Debugger

The Debugger is displayed whenever an error occurs in your Smalltalk code. It shows you where the error occurred and how the system got there. The Debugger runs in one of three modes; normal, modal, and inspecting.

When in normal mode and an error occurs in a process, which is not the event handler process, the debugger starts up on top of the erroneous process. This blocks all interaction with the affected process and its views. Other views are still active and respond as usual.

When an error occurs in the Smalltalk event handler process, the debugger starts in modal mode. While a modal debugger is active, you can not interact with any other view.

The inspecting mode can be entered from the ProcessMonitor by the pop-up menu and allows inspection of the state of other processes. But because the debugged process may continue to run, it is only possible to inspect a snapshot of the affected process.

The Debugger contains four subviews:

  The Context Walkback List shows the context chain which lead to the error.
  The Method Source View shows the method that caused the error.
  The Receiver Inspector allows inspection of the receiver of the selected message.
  The Context Inspector provides information about the arguments and local variables of this context.

The Debugger is shown in Figure 31.16.


Figure 31.16.  The Debugger.

The functions that are common to each view appear as a set of buttons below the context walkback list. These functions are described in Table 31.13.

Table 31.13. The Debugger function buttons.

Button Description

continue Continues execution.
terminate Terminates the erroneous process.
abort Abort the current activity if possible.
step (single step) Lets the process continue execution until the next send is executed in the currently selected context.
send (single send) Lets the process continue execution for one message send.
return Continues execution as if the selected context returned.
restart Continues execution by restarting the selected context.

The walkback subview has a pop-up menu with the functions described in Table 31.14.

Table 31.14. Walkback Subview pop-up menu function.

Function Description

exit smalltalk Leaves ST/X without saving an image.
show more Shows 50 more contexts of the walk-back.
breakpoints Not yet available.
trace on/off Not yet available.
trace step Not yet available.

A miniDebugger is entered if an error occurs within the Debugger itself. This is a line-by-line debugger that allows limited debugging without the use of a graphical user interface. It is controlled by entering commands in the Xterm window where ST/X was started. If you type ? at the miniDebugger prompt, you will get a list of commands that are available for use in this stripped-down debugger.

Summary

This chapter introduces you to the Smalltalk environment that is provided by the Smalltalk/X application. If you are interested in learning how to program using Smalltalk and don’t have access to one of the commercial versions of Smalltalk, then Smalltalk/X is perfect for you. Not only does Smalltalk/X come with all the tools and programming aids that are talked about in this chapter, but it also comes with many examples and some fairly complete documentation that will make learning Smalltalk easier for you.

It is worth mentioning that Linux also comes with the GNU version of Smalltalk called mst. This chapter was devoted to talking about Smalltalk/X because it is much more complete than GNU Smalltalk. From here, you can learn:

About the Perl programming language, which is used for many quick-and-dirty programming tasks, in Chapter 28, “Perl.”
How to back up your system so all your Smalltalk/X programs are not lost, read Chapter 45, “Backups.”
How to set up your Linux system so people on the Internet can access your system, read Chapter 47, “Setting up an Internet Site.”


Previous Table of Contents Next