Contents|Index|Previous|Next

Source window

The Source window (Figure 8) displays a single file of source code data during your program’s debugging process.

Figure 8: Source window

A scroll bar is along the right side with a status bar just under the display area. The left margin includes an indicator for the current program, its breakpoints and potential breakpoints, and (optionally) its line numbers.

There are four menus: File, Options, Window and Help. For descriptions of the File menu options, the Window menu options, and the Help menu options, see Common menus for the GDB GUI. For descriptions of the Options menu for the Source window (Figure 9), see the Source window Options menu.

Source Window buttons

Nine command buttons at the bottom of the window control the debugging process and display of source code during debugging.

- Start
  Starts the program's execution and stop at main.
- Step
  Executes a machine instruction, then stops and returns control to GDB.
- Cont
  For continuing a program’s debugging until completion or until a breakpoint is encountered.
- Up
  Displays the source code of the caller to the current function.
- Bottom
  Displays the source code at the current PC (bottom of stack).
- Stop
  For stopping the execution of a running program.
- Next
  Executes one source line, unless it is a function call, in which case it proceeds debugging until the function returns.
- Finish
  Continues running the program until just after a function in the selected stack frame returns.
- Down
  Displays the source code of the function in the next stack frame down.

Source window Options menu

Figure 9: Source window Options menu

The Source window Options menu (Figure 9) has the following two viewing options.

- Select source file
  Puts up a dialog asking for a source file, then displays the source file selected.
- Line numbers
  Toggles the display of line numbers in the source window.