Source Window Basics

The source window shows you the source code of your program. It can also displayassembly code for low level debugging. The window has three display modes availableon the View menu. Click on the following sample source window to learn more aboutvarious parts of the window.

Here is the same program with the source window in Both display mode.

Executing your program

The debugger provides various methods for you to control execution of your programvia the Run menu.

Command Action
Step Single step a line of source code. When assembly code is displayed a single instruction is executed. Execution steps over procedure calls.
Trace As Step, except execution steps into procedure calls.
Step Out Executes until the current procedure returns.
Execute to cursor Executes code to the line/instruction where the text caret is positioned.
Run Executes the program until a breakpoint is reached or the program terminates.
Run and sample As Run, but also the debugger samples program execution. This is used to profile the execution performance of you program. You can profile only certain parts of your program by only sampling execution a selected locations and times.
Stop running If you have a runaway program, you can use this option. If the program is deadlocked, this option is no help since nothing is executing due to the deadlock.
Release trapped exception The debugger traps most exceptions at the point of the exception. In some cases you might have an exception handler which will process and handle the exception. Use this command to let the exception be propagated to your programs exception handlers.
Restart Terminate and restart the program. Program termination code will not be executed.
Terminate Terminates the program. Program termination code will not be executed.
Simulate HALT The debugger tries to terminate the program by simulating a call to the HALT procedure. This means that program termination code will be executed.


Since stepping through code is a slow process. The debugger offers breakpointsto allow you to stop program execution at a given location in your program. The simplestway to set a breakpoint at a location is to position the caret in the source windowwhere you want the breakpoint and use the breakpoint keyboard shortcut, or the contextmenu.

The debugger offers various breakpoint types. Each one is best suited to certainsituations. Breakpoints can have various options such as pass counts and breakpointexpressions. You can also place breakpoints on a given memory location. These breakpointsstop program execution when the memory location specific by the breakpoint is writtento. This type of breakpoint is helpful when tracking down a memory clobber situation.

Use the context help in the breakpoints dialog for specific information aboutvarious breakpoint options.

Viewing data and expressions

From the source window you can easily examine the values of the data in your program.There are many methods of examining data from the source window. These are listedfrom most convenient to least convenient to use.

Point and shoot

This data examination method uses an algorithm to attempt to determine what youare trying to view. You can view array, record and pointer indirection expressionswith this method all with a single click. What this boils down to is double clickingon the variable name you want to view.

Consider the following expressions

  1. Rec.field
  2. ec^.field
  3. Rec[subscript].field

If you click anywhere in the name "field" the debugger will displaythe expression Rec.field. The debugger assumes that what you wanted was to view thefield of the record.

If you click anywhere in the name "Rec" you will view the entire recordvariable for items 1 and 2. For item 3 you view the array Rec[subscript].

If you click anywhere in the name "subscript" you will view only thevariable subscript, and not the array expression this variable is subscripting.

With these simple rules and practice you will quickly understand how the debuggerdetermines what to display. To use the keyboard with point and shoot place the caretat the appropriate location and issue the Inspect data command from the Debug menu,which has a keyboard shortcut of F4.

Viewing expressions

The debugger can evaluate expressions in addition to viewing data variables. Expressionsare entered and displayed in the same ways as variables, which is the same as youenter in source code. The debugger can evaluate arithmetic and logical DataExpressions.


In a multi-threaded program only the "current" thread is displayed inthe source window. The current thread is the thread which last has a debug eventwhich cause the debugger to stop program execution.

You can view other threads in the source window by using the View menu, Threadwindow command. Beware that other threads in the program were stopped in their trackswherever they might have been. This means that they can be executing in code forwhich no debug information exists. The source window will display assembly code inthis situation. All is not lost in this situation. You can view the call trace forthe thread and see where it is currently executing.

When you change the thread displayed by the source window, the Registers and Calltrace windows are automatically updated to reflect the state of the selected thread.

You can control what threads are allowed to execute via the Run menu, Thread statecommand. Generally this feature is never used.

Context menu

Never forget about the context menu (right click, or special keyboard key). Ithas many useful menu items making using the mouse in the debugger one of the bestmodes of operation. A double click executes the context menu item displayed in bold.

Keyboard shortcuts

Key Function
Enter Trace
Ctrl+Enter Execute to cursor
Spacebar Step
Backspace Step Out
Ctrl+LeftMouseClick Execute to cursor

Common Keyboard Shortcuts