+@menu
+* GDB-UI Layout:: Control the number of displayed buffers.
+* Source Buffers:: Use the mouse in the fringe/margin to
+ control your program.
+* Breakpoints Buffer:: A breakpoint control panel.
+* Stack Buffer:: Select a frame from the call stack.
+* Other GDB-UI Buffers:: Input/output, locals, registers,
+ assembler, threads and memory buffers.
+* Watch Expressions:: Monitor variable values in the speedbar.
+@end menu
+
+@node GDB-UI Layout
+@subsubsection GDB User Interface Layout
+@cindex GDB User Interface layout
+
+@vindex gdb-many-windows
+ If the variable @code{gdb-many-windows} is @code{nil} (the default
+value) then @kbd{M-x gdb} normally displays only the GUD buffer.
+However, if the variable @code{gdb-show-main} is also non-@code{nil},
+it starts with two windows: one displaying the GUD buffer, and the
+other showing the source for the @code{main} function of the program
+you are debugging.
+
+ If @code{gdb-many-windows} is non-@code{nil}, then @kbd{M-x gdb}
+displays the following frame layout:
+
+@smallexample
+@group
++--------------------------------+--------------------------------+
+| GUD buffer (I/O of GDB) | Locals buffer |
+|--------------------------------+--------------------------------+
+| Primary Source buffer | I/O buffer for debugged pgm |
+|--------------------------------+--------------------------------+
+| Stack buffer | Breakpoints buffer |
++--------------------------------+--------------------------------+
+@end group
+@end smallexample
+
+ However, if @code{gdb-use-separate-io-buffer} is @code{nil}, the I/O
+buffer does not appear and the primary source buffer occupies the full
+width of the frame.
+
+@findex gdb-restore-windows
+ If you change the window layout, for example, while editing and
+re-compiling your program, then you can restore this standard window
+layout with the command @code{gdb-restore-windows}.
+
+@findex gdb-many-windows
+ To switch between this standard layout and a simple layout
+containing just the GUD buffer and a source file, type @kbd{M-x
+gdb-many-windows}.
+
+ You may also specify additional GDB-related buffers to display,
+either in the same frame or a different one. Select the buffers you
+want with the @samp{GUD->GDB-windows} and @samp{GUD->GDB-Frames}
+sub-menus. If the menu-bar is unavailable, type @code{M-x
+gdb-display-@var{buffertype}-buffer} or @code{M-x
+gdb-frame-@var{buffertype}-buffer} respectively, where
+@var{buffertype} is the relevant buffer type, such as
+@samp{breakpoints}. Most of these buffers are read-only, and typing
+@kbd{q} in them kills them.
+
+ When you finish debugging, kill the GUD buffer with @kbd{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 do need to check that the
+breakpoints in recently edited source files are still in the right
+places.
+
+@node Source Buffers
+@subsubsection Source Buffers
+@cindex GDB commands in Fringe
+
+@c @findex gdb-mouse-set-clear-breakpoint
+@c @findex gdb-mouse-toggle-breakpoint
+Many GDB commands can be entered using keybindings or the tool bar but
+sometimes it is quicker to use the fringe. These commands either
+manipulate breakpoints or control program execution. When there is no
+fringe, you can use the margin but this is only present when the
+source file already has a breakpoint.
+
+You can click @kbd{Mouse-1} in the fringe or display margin of a
+source buffer to set a breakpoint there and, on a graphical display, a
+red bullet will appear on that line. If a breakpoint already exists
+on that line, the same click will remove it. You can also enable or
+disable a breakpoint by clicking @kbd{C-Mouse-1} on the bullet.
+
+A solid arrow in the left fringe of a source buffer indicates the line
+of the innermost frame where the debugged program has stopped. A
+hollow arrow indicates the current execution line of higher level
+frames.
+
+If you drag the arrow in the fringe with @kbd{Mouse-1}
+(@code{gdb-mouse-until}), execution will continue to the line where
+you release the button, provided it is still in the same frame.
+Alternatively, you can click @kbd{Mouse-3} at some point in the fringe
+of this buffer and execution will advance to there. A similar command
+(@code{gdb-mouse-jump}) allows you to jump to a source line without
+executing the intermediate lines by clicking @kbd{C-Mouse-3}. This
+command allows you to go backwards which can be useful for running
+through code that has already executed, in order to examine its
+execution in more detail.
+
+@table @kbd
+@item Mouse-1
+Set or clear a breakpoint.
+
+@item C-Mouse-1
+Enable or disable a breakpoint.
+
+@item Mouse-3
+Continue execution to here.
+
+@item C-Mouse-3
+Jump to here.
+@end table
+
+If the variable @code{gdb-find-source-frame} is non-@code{nil} and
+execution stops in a frame for which there is no source code e.g after
+an interrupt, then Emacs finds and displays the first frame further up
+stack for which there is source. If it is @code{nil} then the source
+buffer continues to display the last frame which maybe more useful,
+for example, when re-setting a breakpoint.
+
+@node Breakpoints Buffer
+@subsubsection Breakpoints Buffer
+
+ The breakpoints buffer shows the existing breakpoints, watchpoints and
+catchpoints (@pxref{Breakpoints,,, gdb, The GNU debugger}). It has
+these special commands, which mostly apply to the @dfn{current
+breakpoint}, the breakpoint which point is on.
+
+@table @kbd
+@item @key{SPC}
+@kindex SPC @r{(GDB breakpoints buffer)}
+@findex gdb-toggle-breakpoint
+Enable/disable the current breakpoint (@code{gdb-toggle-breakpoint}).
+On a graphical display, this changes the color of a bullet in the
+margin of a source buffer at the relevant line. This is red when
+the breakpoint is enabled and grey when it is disabled. Text-only
+terminals correspondingly display a @samp{B} or @samp{b}.
+
+@item D
+@kindex D @r{(GDB breakpoints buffer)}
+@findex gdb-delete-breakpoint
+Delete the current breakpoint (@code{gdb-delete-breakpoint}).
+
+@item @key{RET}
+@kindex RET @r{(GDB breakpoints buffer)}
+@findex gdb-goto-breakpoint
+Visit the source line for the current breakpoint
+(@code{gdb-goto-breakpoint}).
+
+@item Mouse-2
+@kindex Mouse-2 @r{(GDB breakpoints buffer)}
+Visit the source line for the breakpoint you click on.
+@end table
+
+@node Stack Buffer
+@subsubsection Stack Buffer
+
+ The stack buffer displays a @dfn{call stack}, with one line for each
+of the nested subroutine calls (@dfn{stack frames}) now active in the
+program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}.
+
+@findex gdb-frames-select
+An arrow in the fringe points to the selected frame or, if the fringe is
+not present, the number of the selected frame is displayed in reverse
+contrast. To select a frame in GDB, move point in the stack buffer to
+that stack frame and type @key{RET} (@code{gdb-frames-select}), or click
+@kbd{Mouse-2} on a stack frame. If the locals buffer is visible,
+selecting a stack frame updates it to display the local variables of the
+new frame.
+
+@node Other GDB-UI Buffers
+@subsubsection Other Buffers
+
+@table @asis
+@item Input/Output Buffer
+@vindex gdb-use-separate-io-buffer
+If the variable @code{gdb-use-separate-io-buffer} is non-@code{nil},
+the program being debugged takes its input and displays its output
+here. Otherwise it uses the GUD buffer for that. To toggle whether
+GUD mode uses this buffer, do @kbd{M-x gdb-use-separate-io-buffer}.
+This takes effect when you next restart the program you are debugging.
+
+The history and replay commands from Shell mode are available here,
+as are the commands to send signals to the debugged program.
+@xref{Shell Mode}.
+
+@item Locals Buffer
+The locals buffer displays the values of local variables of the
+current frame for simple data types (@pxref{Frame Info, Frame Info,
+Information on a frame, gdb, The GNU debugger}). Press @key{RET} or
+click @kbd{Mouse-2} on the value if you want to edit it.
+
+Arrays and structures display their type only. With GDB 6.4 or later,
+move point to their name and press @key{RET}, or alternatively click
+@kbd{Mouse-2} there, to examine their values. With earlier versions
+of GDB, use @kbd{Mouse-2} or @key{RET} on the type description
+(@samp{[struct/union]} or @samp{[array]}). @xref{Watch Expressions}.
+
+@item Registers Buffer
+@findex toggle-gdb-all-registers
+The registers buffer displays the values held by the registers
+(@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or
+click @kbd{Mouse-2} on a register if you want to edit its value.
+With GDB 6.4 or later, recently changed register values display with
+@code{font-lock-warning-face}. With earlier versions of GDB, you can
+press @key{SPC} to toggle the display of floating point registers
+(@code{toggle-gdb-all-registers}).
+
+@item Assembler Buffer
+The assembler buffer displays the current frame as machine code. An
+arrow points to the current instruction, and you can set and remove
+breakpoints as in a source buffer. Breakpoint icons also appear in
+the fringe or margin.
+
+@item Threads Buffer
+@findex gdb-threads-select
+The threads buffer displays a summary of all threads currently in your
+program (@pxref{Threads, Threads, Debugging programs with multiple
+threads, gdb, The GNU debugger}). Move point to any thread in the
+list and press @key{RET} to select it (@code{gdb-threads-select}) and
+display the associated source in the primary source buffer.
+Alternatively, click @kbd{Mouse-2} on a thread to select it. If the
+locals buffer is visible, its contents update to display the variables
+that are local in the new thread.
+
+@item Memory Buffer
+The memory buffer lets you examine sections of program memory
+(@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}).
+Click @kbd{Mouse-1} on the appropriate part of the header line to
+change the starting address or number of data items that the buffer
+displays. Click @kbd{Mouse-3} on the header line to select the
+display format or unit size for these data items.
+@end table
+
+@node Watch Expressions
+@subsubsection Watch Expressions
+@cindex Watching expressions in GDB
+
+@findex gud-watch
+@kindex C-x C-a C-w @r{(GUD)}
+ If you want to see how a variable changes each time your program
+stops, move point into the variable name and click on the watch icon
+in the tool bar (@code{gud-watch}) or type @kbd{C-x C-a C-w}. If you
+specify a prefix argument, you can enter the variable name in the
+minibuffer.
+
+ Each watch expression is displayed in the speedbar. Complex data
+types, such as arrays, structures and unions are represented in a tree
+format. Leaves and simple data types show the name of the expression
+and its value and, when the speedbar frame is selected, display the
+type as a tooltip. Higher levels show the name, type and address
+value for pointers and just the name and type otherwise. Root expressions
+also display the frame address as a tooltip to help identify the frame
+in which they were defined.
+
+ To expand or contract a complex data type, click @kbd{Mouse-2} or
+press @key{SPC} on the tag to the left of the expression. Emacs asks
+for confirmation before expanding the expression if its number of
+immediate children exceeds the value of the variable
+@code{gdb-max-children}.
+
+@kindex D @r{(GDB speedbar)}
+@findex gdb-var-delete
+ To delete a complex watch expression, move point to the root
+expression in the speedbar and type @kbd{D} (@code{gdb-var-delete}).
+
+@kindex RET @r{(GDB speedbar)}
+@findex gdb-edit-value
+ To edit a variable with a simple data type, or a simple element of a
+complex data type, move point there in the speedbar and type @key{RET}
+(@code{gdb-edit-value}). Or you can click @kbd{Mouse-2} on a value to
+edit it. Either way, this reads the new value using the minibuffer.
+
+@vindex gdb-show-changed-values
+ If you set the variable @code{gdb-show-changed-values} to
+non-@code{nil} (the default value), Emacs uses
+@code{font-lock-warning-face} to highlight values that have recently
+changed and @code{shadow} face to make variables which have gone out of
+scope less noticeable. When a variable goes out of scope you can't
+edit its value.
+
+@vindex gdb-use-colon-colon-notation
+ If the variable @code{gdb-use-colon-colon-notation} is
+non-@code{nil}, Emacs uses the @samp{@var{function}::@var{variable}}
+format. This allows the user to display watch expressions which share
+the same variable name. The default value is @code{nil}.
+
+@vindex gdb-speedbar-auto-raise
+To automatically raise the speedbar every time the display of watch
+expressions updates, set @code{gdb-speedbar-auto-raise} to
+non-@code{nil}. This can be useful if you are debugging with a full
+screen Emacs frame.