Next: , Up: GDB Graphical Interface


32.6.5.1 GDB User Interface Layout

If the variable gdb-many-windows is nil (the default value) then gdb just pops up the GUD buffer unless the variable gdb-show-main is non-nil. In this case it starts with two windows: one displaying the GUD buffer and the other with the source file with the main routine of the inferior.

If gdb-many-windows is non-nil, regardless of the value of gdb-show-main, the layout below will appear unless gdb-use-inferior-io-buffer is nil. In this case the source buffer occupies the full width of the frame.

     +--------------------------------+--------------------------------+
     |                                |                                |
     |  GUD buffer (I/O of GDB)       |     Locals buffer              |
     |                                |                                |
     |--------------------------------+--------------------------------+
     |                                |                                |
     |  Source buffer                 |     I/O buffer (of inferior)   |
     |                                |                                |
     |--------------------------------+--------------------------------+
     |                                |                                |
     |  Stack buffer                  |     Breakpoints buffer         |
     |                                |                                |
     +--------------------------------+--------------------------------+

To toggle this layout, do M-x gdb-many-windows.

If you change the window layout, for example, while editing and re-compiling your program, then you can restore it with the command gdb-restore-windows.

You may also choose which additional buffers you want to display, either in the same frame or a different one. Select them from ‘GUD->GDB-windows’ or ‘GUD->GDB-Frames’ sub-menu respectively. If the menu-bar is unavailable, type M-x gdb-display-buffertype-buffer or M-x gdb-frame-buffertype-buffer respectively, where buffertype is the relevant buffer type e.g breakpoints. Most of these buffers are read-only and be killed by simply pressing q in them.

When you finish debugging then kill the GUD buffer with C-x k, which will also kill all the buffers associated with the session. However you need not do this if, after editing and re-compiling your source code within Emacs, you wish continue debugging. When you restart execution, GDB will automatically find your new executable. Keeping the GUD buffer has the advantage of keeping the shell history as well as GDB's breakpoints. You need to check, however, that the breakpoints in the recently edited code are still where you want them.