View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Jacob Bolton

Jacob Bolton - gte189u

Coweb Assignment 2 - Debugger

Almost any programming endeavor will at some point come across a bug, and Squeak is no different. The purpose of this article is to help the reader recognize an error and utilize the debugger to find the root of the problem.

When an error occurs in Squeak, a window similar to the one below will appear.

Uploaded Image: errorbox.png

This is the error window. The title of the window describes the type of error that was encountered. Proceed allows the programmer to try to step through the error and continue processing, and abandon halts program execution. However, the debug button and the list in the window are of greater interest. The list, from top to bottom, is the stack trace of function calls from the most recent down to the first. This is important to the debugging process because it allows the programmer see the different calls leading up to the error and gain a better understanding of the scenarios in which the error occurs. To begin debugging, either click on the debug button or select an item from the stack trace list, and the debugger window will appear (see below).

Uploaded Image: debuggerbox.png

In the debugger, the stack list is still present, there are some new button for tracing into/through/around the error, editor shows the currently selected function, and some boxes on the bottom display some variable names. When a part of the stack trace is selected, the debugger will bring up the relevant function in the editor and attempt to highlight the spot in the code where the error occurred. If the higlight is missing or lost siomply press the where button to do the highlight again. At this point, the programmer may need to be able to determine the values of variables, and this is where the boxes at the bottom of the window enter the scene. They allow the programmer to select a variable from the list of variables used/available to the current function and see what their current values are. The two boxes to the left are for instance variables and the
two on the right are for temporary variables.

Once the cause of the error is determined the editor allows the programmer to perform the correction immediately (provided the cause is actually withing the scope of the stack trace). If the cause of an error can not directly be determined by tracing through the error stack, the programmer must investigate further into functions that were not listed but do, in fact, affect the outcome. Initialization functions are a good point to start if it is discovered that an instance variable is nil.

The debugger is not a tool that will always immediately give the location and underlying cause of an error, and traditional debugging techniques still apply. However, the debugger definitely facilitates the locating and investigating into a runtime error.

Coweb Assignment 1

Link to this Page