286 |
The GUD (Grand Unified Debugger) library provides an interface to |
The GUD (Grand Unified Debugger) library provides an interface to |
287 |
various symbolic debuggers from within Emacs. We recommend the debugger |
various symbolic debuggers from within Emacs. We recommend the debugger |
288 |
GDB, which is free software, but you can also run DBX, SDB or XDB if you |
GDB, which is free software, but you can also run DBX, SDB or XDB if you |
289 |
have them. GUD can also serve as an interface to the Perl's debugging |
have them. GUD can also serve as an interface to Perl's debugging |
290 |
mode, the Python debugger PDB, and to JDB, the Java Debugger. |
mode, the Python debugger PDB, and to JDB, the Java Debugger. |
291 |
@xref{Debugging,, The Lisp Debugger, elisp, the Emacs Lisp Reference Manual}, |
@xref{Debugging,, The Lisp Debugger, elisp, the Emacs Lisp Reference Manual}, |
292 |
for information on debugging Emacs Lisp programs. |
for information on debugging Emacs Lisp programs. |
311 |
@table @kbd |
@table @kbd |
312 |
@item M-x gdb @key{RET} @var{file} @key{RET} |
@item M-x gdb @key{RET} @var{file} @key{RET} |
313 |
@findex gdb |
@findex gdb |
314 |
Run GDB as a subprocess of Emacs. This command creates a buffer |
Run GDB as a subprocess of Emacs. If the variable |
315 |
for input and output to GDB, and switches to it. If a GDB buffer |
@code{gud-gdb-command-name} is ``gdb --annotate=3'' (the default |
316 |
already exists, it just switches to that buffer. |
value) then GDB starts as for @kbd{M-x gdba} below. If you want to |
317 |
|
GDB to start as in Emacs 21.3 and earlier then set |
318 |
|
@code{gud-gdb-command-name} to ``gdb --fullname''. In this case, the |
319 |
|
command creates a buffer for input and output to GDB, and switches to |
320 |
|
it. If a GDB buffer already exists, it just switches to that buffer. |
321 |
|
|
322 |
@item M-x gdba @key{RET} @var{file} @key{RET} |
@item M-x gdba @key{RET} @var{file} @key{RET} |
323 |
Run GDB as a subprocess of Emacs, providing a graphical interface |
Run GDB as a subprocess of Emacs, providing a graphical interface |
642 |
to know GDB commands. |
to know GDB commands. |
643 |
|
|
644 |
@menu |
@menu |
645 |
|
* Layout:: Control the number of displayed buffers. |
646 |
* Breakpoints Buffer:: A breakpoint control panel. |
* Breakpoints Buffer:: A breakpoint control panel. |
647 |
* Stack Buffer:: Select a frame from the call stack. |
* Stack Buffer:: Select a frame from the call stack. |
648 |
* Watch Expressions:: Monitor variable values in the speedbar. |
* Watch Expressions:: Monitor variable values in the speedbar. |
649 |
* Other Buffers:: Input/output, locals, registers and assembler buffers. |
* Other Buffers:: Input/output, locals, registers and assembler buffers. |
|
* Layout:: Control the number of displayed buffers. |
|
650 |
@end menu |
@end menu |
651 |
|
|
652 |
|
@node Layout |
653 |
|
@subsubsection Layout |
654 |
|
@cindex GDB User Interface layout |
655 |
|
|
656 |
|
@findex gdb-many-windows |
657 |
|
@vindex gdb-many-windows |
658 |
|
|
659 |
|
If the variable @code{gdb-many-windows} is @code{nil} (the default |
660 |
|
value) then gdb just pops up the GUD buffer unless the variable |
661 |
|
@code{gdb-show-main} is non-@code{nil}. In this case it starts with |
662 |
|
two windows: one displaying the GUD buffer and the other with the |
663 |
|
source file with the main routine of the inferior. |
664 |
|
|
665 |
|
If @code{gdb-many-windows} is non-@code{nil}, regardless of the value of |
666 |
|
@code{gdb-show-main}, the layout below will appear unless |
667 |
|
@code{gdb-use-inferior-io-buffer} is @code{nil}. In this case the |
668 |
|
source buffer occupies the full width of the frame. |
669 |
|
|
670 |
|
@multitable @columnfractions .5 .5 |
671 |
|
@item GUD buffer (I/O of GDB) |
672 |
|
@tab Locals buffer |
673 |
|
@item |
674 |
|
@tab |
675 |
|
@item Source buffer |
676 |
|
@tab Input/Output (of inferior) buffer |
677 |
|
@item |
678 |
|
@tab |
679 |
|
@item Stack buffer |
680 |
|
@tab Breakpoints buffer |
681 |
|
@end multitable |
682 |
|
|
683 |
|
To toggle this layout, do @kbd{M-x gdb-many-windows}. |
684 |
|
|
685 |
|
@findex gdb-restore-windows |
686 |
|
If you change the window layout, for example, while editing and |
687 |
|
re-compiling your program, then you can restore it with the command |
688 |
|
@code{gdb-restore-windows}. |
689 |
|
|
690 |
|
You may also choose which additional buffers you want to display, |
691 |
|
either in the same frame or a different one. Select GDB-windows or |
692 |
|
GDB-Frames from the menu-bar under the heading GUD. If the menu-bar |
693 |
|
is unavailable, type @code{M-x |
694 |
|
gdb-display-@var{buffertype}-buffer} or @code{M-x |
695 |
|
gdb-frame-@var{buffertype}-buffer} respectively, where @var{buffertype} |
696 |
|
is the relevant buffer type e.g breakpoints. |
697 |
|
|
698 |
@node Breakpoints Buffer |
@node Breakpoints Buffer |
699 |
@subsubsection Breakpoints Buffer |
@subsubsection Breakpoints Buffer |
700 |
|
|
755 |
@kindex RET @r{(GDB speedbar)} |
@kindex RET @r{(GDB speedbar)} |
756 |
@findex gdb-var-delete |
@findex gdb-var-delete |
757 |
With the cursor over the root expression of a complex data type, type |
With the cursor over the root expression of a complex data type, type |
758 |
@key{D} to delete it from the speedbar |
@kbd{D} to delete it from the speedbar |
759 |
(@code{gdb-var-delete}). |
(@code{gdb-var-delete}). |
760 |
|
|
761 |
@findex gdb-edit-value |
@findex gdb-edit-value |
780 |
|
|
781 |
@table @asis |
@table @asis |
782 |
@item Input/Output Buffer |
@item Input/Output Buffer |
783 |
The executable program that is being debugged takes its input and |
If the variable @code{gdb-use-inferior-io-buffer} is non-@code{nil}, |
784 |
|
the executable program that is being debugged takes its input and |
785 |
displays its output here. Some of the commands from shell mode are |
displays its output here. Some of the commands from shell mode are |
786 |
available here. @xref{Shell Mode}. |
available here. @xref{Shell Mode}. |
787 |
|
|
814 |
|
|
815 |
@end table |
@end table |
816 |
|
|
|
@node Layout |
|
|
@subsubsection Layout |
|
|
@cindex GDB User Interface layout |
|
|
|
|
|
@findex gdb-many-windows |
|
|
@vindex gdb-many-windows |
|
|
If @code{gdb-many-windows} is @code{nil} (the default value), then GDB starts |
|
|
with just two windows: the GUD and the source buffer. If it is @code{t}, then |
|
|
six windows with the following layout will appear: |
|
|
|
|
|
@multitable @columnfractions .5 .5 |
|
|
@item GUD buffer (I/O of GDB) |
|
|
@tab Locals buffer |
|
|
@item |
|
|
@tab |
|
|
@item Source buffer |
|
|
@tab Input/Output (of debuggee) buffer |
|
|
@item |
|
|
@tab |
|
|
@item Stack buffer |
|
|
@tab Breakpoints buffer |
|
|
@end multitable |
|
|
|
|
|
To toggle this layout, do @kbd{M-x gdb-many-windows}. |
|
|
|
|
|
@findex gdb-restore-windows |
|
|
If you change the window layout, for example, while editing and |
|
|
re-compiling your program, then you can restore it with |
|
|
@code{gdb-restore-windows}. |
|
|
|
|
|
You may also choose which additional buffers you want to display, |
|
|
either in the same frame or a different one. Select GDB-windows or |
|
|
GDB-Frames from the menu-bar under the heading GUD. 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 e.g breakpoints. |
|
|
|
|
817 |
@node Executing Lisp |
@node Executing Lisp |
818 |
@section Executing Lisp Expressions |
@section Executing Lisp Expressions |
819 |
|
|
989 |
variable to the initial value specified in the @code{defvar} expression. |
variable to the initial value specified in the @code{defvar} expression. |
990 |
@code{defcustom} expressions are treated similarly. |
@code{defcustom} expressions are treated similarly. |
991 |
This special feature is convenient for debugging Lisp programs. |
This special feature is convenient for debugging Lisp programs. |
992 |
|
Typing @kbd{C-M-x} on a @code{defface} expression reinitializes |
993 |
|
the face according to the @code{defface} specification. |
994 |
|
|
995 |
@kindex C-x C-e |
@kindex C-x C-e |
996 |
@findex eval-last-sexp |
@findex eval-last-sexp |