Next: , Up: Understanding CGDB   [Contents][Index]

2.1 Understanding the source window.

The source window is the window that provides you a view of the source code that the debugged program is made up of. It will display to the user a single source file at a time. While the user is debugging, via next and step, CGDB will update the source file and line number to keep you informed as to where GDB is debugging.

CGDB has several features that make debugging easier than using plain old GDB. One feature you will notice right away while debugging a C, C++ or ADA program, is that the source files are syntax highlighted. This allows the user to easily navigate through the source file to look for certain places in the source code. If you would like to see another source language highlighted, contact us. To understanding how to navigate through the source window look at the commands in CGDB Mode.

In addition to showing the source code, CGDB also displays to the user the currently executing line. The line number will be highlighted green, to represent that the particular line, is the current line being debugged by GDB. Also, CGDB will display an arrow extending from the line number, to the source line. You can configure what type of display CGDB uses with the :set executinglinedisplay configuration option. By default, the longarrow display is used.

As you navigate through the source window, the current line the cursor is on will be highlighted with a block. This simply helps you keep track of where you are in the file. You can configure what type of display CGDB uses with the :set selectedlinedisplay configuration option. By deafult, the block display is used.

Also, you can set or delete breakpoints in CGDB from the source window. Simply navigate to the line that you are interested in setting a breakpoint, and hit the space bar. This will set a breakpoint on the line if one did not already exist. The line number should turn red to indicate that a breakpoint has been set. Hitting the space bar again will delete the breakpoint. If you disable the breakpoint, the line number will turn yellow, to represent the disabled breakpoint.

CGDB also supports regular expression searching within the source window. If you type / or ? you can search in the source window for a string of interest. The C library regular expression functions are used to perform this search, which honors things like ‘*’ or ‘+’.

The full list of commands that are available in the source window is in CGDB Mode.

Next: , Up: Understanding CGDB   [Contents][Index]