Debugger

First you should realize that Eiffel provides for "programmed debugging" - all those nice assertions - invariants, preconditions, postconditions, check statements. They really save a lot of debugging time - experience has shown that more than 90% of bugs can be caught in this way.

Nevertheless Visual Eiffel includes a "traditional" type debugger. If you want to use the it, you should set the proper options before building the project (this dialog can be activated in "project settings").

Note also that the debugger is not included in the educational/evaluation version of Visual Eiffel. So, if you cannot start the debugger, check which license of Visual Eiffel you have.

One important note: It is always necessary to start the debugger by pressing the STEP INTO button.

Project options for debugger

Make sure that the flag Debug source text is checked. You should also activate assertion control.

Then press the STEP INTO button: "Step Into" button

Start the debugger

A text window showing the creation procedure of the root class appears . The current (to be executed) command is highlighted. In the View area you can see the local variables. Press the "Step Over" button to get the following screen:

Step over

Toolbar buttons provide control of single step debugging. From left to right they have the following meaning:

Debugger buttons

Toggle breakpoint
Sets or clears the breakpoint at the current cursor position in the editor
Go
stops execution at the first breakpoint
Restart
restarts execution from the beginning
Stop Debugging
terminates the debugging session
Step Over
executes the next instruction without tracing into routines
Step Into
if the routine has debug info (usually not if the class comes from a library) the call is traced. Otherwise works like Step Over
Step Out
returns from the innermost routine
Run to cursor
Executes the program until the current cursor position in the editor

In our example the first statement has been executed - the result can be seen in the console window. Now the execution seems to be stopped. Pushing the step over button does not move the active line marker. The reason for this is that it is time now to enter the number requested by io.get_int. Enter this number into the console window and try again.

Now have a look at the navigation area and the view area:

On the left we can see the call stack - the object, the class name and the routine - and on the right you can select between the attributes of the class, the local variables and the routine arguments. In our example we have shown the argument of some deeper level in the fibonacci call stack.

Another view (the locals of the creation class) demonstrates the surgery you can do now: Double-click a value and the result will be displayed in a editing window where you can change its value. So, you can do now "real", "hard" debugging.

Change values

Another useful debugging aid is breakpoints: setting them is rather simple. It is necessary to start debugging as before with the Go-button. Then you should position the cursor to the line where you want to set the breakpoint. Select in the menu: debug/set breakpoint. This dialog will confirm the exact place of the breakpoint.

Set Breakpoint

As a first result the line with the breakpoint set will be marked:

Breakpoint mark

beside this all breakpoints set will be shown on request in the view area. Note, that a breakpoint can be set anywhere - but only breakpoints set on instructions will be evaluated.

Same breakpoints


Copyright © Object Tools -- info@object-tools.com
Last updated: 2005/02/02 11:51:38