Source pane

Below the menu bar is the debugger tool bar, and below that is the source pane. The source pane shows the source code which can be in C, C++, FORTRAN, Pascal, Ada, or assembly language. When you're debugging, the source pane normally displays the code where the program has stopped, indicated by the red STOPPED arrow. There are several ways to change the source pane to view other locations. For instance, you can click a procedure name in the source pane to display source code for that procedure in the source pane. You can also use the status bar (discussed below) to load a particular procedure or file into the source pane.

When you right click anywhere in the source pane, a pop-up menu appears which shows some information about the clicked object, and which shows a list of operations you can perform. We will discuss the right-click pop-up menus in a separate section later in this chapter.

In the debugger window, all key strokes go to the command pane (discussed below), unless the focus is in the File or Procedure drop-down list boxes (discussed below). Some key strokes affect the source pane; the following is a list of the frequently used ones:
To do this Press
Scroll the source pane up by one page.
PageUp
Scroll the source pane down by one page.
PageDown
Scroll the source pane up by one line.
Shift+UpArrow
Scroll the source pane down by one line.
Shift+DownArrow
Search forward in the source pane.
Ctrl+f
Search backward in the source pane.
Ctrl+b
Erase the current searched pattern if the debugger is in incremental search mode.
Ctrl+u
Run the debugged program.
F5
Step out of the current procedure.
F9
Run to the next statement (skip over function call).
F10
Run to the next statement (step into function call).
F11
Go up one level on the stack call.
Ctrl+ + (plus sign)
Go down one level on the stack call.
Ctrl+ - (minus sign)

You can configure the functions for both the keystrokes and mouse clicks.

Breakdots

A breakdot ( ) is a small green dot. Breakdots appear directly to the left of certain source lines. These dots indicate lines of source code that correspond to executable instructions; you can set breakpoints on these lines. Lines without breakdots are source lines which do not correspond to executable instructions (for example, source lines that did not generate any instructions).

To set a breakpoint on a source line, click the breakdot. See Chapter 20, "Breakpoints window" for additional methods to set breakpoints.

You can define the color of these dots. The default color is green.

Breakpoint markers

A breakpoint ( ) is denoted by a small red stop sign. To set a breakpoint, click a breakdot; the breakpoint marker will replace the breakdot. To remove a breakpoint, click it; the breakpoint marker will revert to a breakdot.

Current line pointer

The current line pointer ( ) is a small blue arrow directly to the left of the breakdots. The pointer is strictly a debugger tool, unrelated to the current program counter (PC) of the program. Many debugger commands, such as the breakpoint command, use the pointer as the default and these commands execute at that location in the program. For example, the breakpoint command b with no specified line number sets the breakpoint at the current line pointer location. When a running program halts, the pointer is set to the line where the program's execution halts.

The current line pointer is always associated with source code; that is, it always appears in the source pane whenever there is source code. If the source line at the current line pointer disappears from the source pane due to scrolling, the debugger will relocate the pointer to either the top or bottom source line in the source pane.

Line numbers

Previous versions of the debugger (1.8.9 and earlier) only have one column of line numbers on the left, and they are file-relative. This version of the debugger continues to support file-relative line numbers. In addition, it now also supports procedure-relative line numbers. You can configure the debugger to display one, both, or none of them.

When both file-relative and procedure-relative line numbers are displayed, you can choose which to display left-most with one of the following methods:

See "Procedure-relative vs file-relative line numbers".

Note: configuration options are not case sensitive, thus procRelativeLines and procrelativelines are the same option, but for clarity we use procRelativeLines here. (System variables are also not case sensitive.)

PC pointer / Highlighted line

The PC (program counter) pointer ( ) is a larger red arrow with the word STOPPED. When the program stops at some point in the code, the PC pointer is directly over the breakdot for that line. The PC pointer indicates the position to execute next if you perform a go ( ) or single step ( or ) command.

C++ Templates and Ada Generics

When debugging C++ templates or Ada generics, the source pane contains some lines of source code with and without breakdots. Ada generic instantiations introduce another physical source file, that of the source of the generic, into the symbol table at the point of the instantiation. C++ template instantiation may also introduce other physical source files into the symbol table. That is, the symbol table for the current source file is fragmented by the instantiation. If you encounter this problem, use the e command to view different procedures or tasks within a single piece of source. (See the command e.)

Related topic:


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.