aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-12-10 15:39:43 +0800
committerChong Yidong2011-12-10 15:39:43 +0800
commit0595bd7e90cca425fe1d9abe145f8ead4d963a57 (patch)
tree0aa797e2ae157a865d3416c979b9f6610e0991ca
parentffdcbd1c7b9d74cffb1ddd90753425de3cdd110e (diff)
downloademacs-0595bd7e90cca425fe1d9abe145f8ead4d963a57.tar.gz
emacs-0595bd7e90cca425fe1d9abe145f8ead4d963a57.zip
More updates to Building chapter of Emacs manual.
* doc/emacs/building.texi (Compilation): Say what the -k flag to make does. Move subprocess discussion to Compilation Shell. (Compilation Mode): Add xref for grep, occur, and mouse references. Define "locus". (Grep Searching): Use @command. (Debuggers, Commands of GUD, GDB Graphical Interface): Clarify intro. (Starting GUD): Clarify how arguments are specified. (Debugger Operation): Index entry for "GUD interaction buffer", and move basic description here from Commands of GUD node. (GDB User Interface Layout): Copyedits. (Source Buffers): Remove gdb-find-source-frame, which is not in gdb-mi.el. (Other GDB Buffers): Remove gdb-use-separate-io-buffer and toggle-gdb-all-registers, which are not in gdb-mi.el. Don't re-document GUD interaction buffers.
-rw-r--r--doc/emacs/ChangeLog13
-rw-r--r--doc/emacs/building.texi696
-rw-r--r--doc/emacs/emacs.texi3
3 files changed, 339 insertions, 373 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 2627586f1f4..d0a22bbd867 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,10 +1,21 @@
12011-12-08 Chong Yidong <cyd@gnu.org> 12011-12-10 Chong Yidong <cyd@gnu.org>
2 2
3 * building.texi (Compilation): Say what the -k flag to make does. 3 * building.texi (Compilation): Say what the -k flag to make does.
4 Move subprocess discussion to Compilation Shell. 4 Move subprocess discussion to Compilation Shell.
5 (Compilation Mode): Add xref for grep, occur, and mouse 5 (Compilation Mode): Add xref for grep, occur, and mouse
6 references. Define "locus". 6 references. Define "locus".
7 (Grep Searching): Use @command. 7 (Grep Searching): Use @command.
8 (Debuggers, Commands of GUD, GDB Graphical Interface): Clarify
9 intro.
10 (Starting GUD): Clarify how arguments are specified.
11 (Debugger Operation): Index entry for "GUD interaction buffer",
12 and move basic description here from Commands of GUD node.
13 (GDB User Interface Layout): Copyedits.
14 (Source Buffers): Remove gdb-find-source-frame, which is not in
15 gdb-mi.el.
16 (Other GDB Buffers): Remove gdb-use-separate-io-buffer and
17 toggle-gdb-all-registers, which are not in gdb-mi.el. Don't
18 re-document GUD interaction buffers.
8 19
9 * programs.texi (Symbol Completion): M-TAB can now use Semantic. 20 * programs.texi (Symbol Completion): M-TAB can now use Semantic.
10 (Semantic): Add cindex entries for Semantic. 21 (Semantic): Add cindex entries for Semantic.
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 34ac5887a1d..5e2cb8119de 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -453,16 +453,18 @@ see the Flymake Info manual, which is distributed with Emacs.
453@cindex JDB 453@cindex JDB
454@cindex PDB 454@cindex PDB
455 455
456@c Do you believe in GUD?
457The GUD (Grand Unified Debugger) library provides an Emacs interface 456The GUD (Grand Unified Debugger) library provides an Emacs interface
458to a wide variety of symbolic debuggers. Unlike the GDB graphical 457to a wide variety of symbolic debuggers. It can run the GNU Debugger
459interface, which only runs GDB (@pxref{GDB Graphical Interface}), GUD 458(GDB), as well as DBX, SDB, XDB, Perl's debugging mode, the Python
460can also run DBX, SDB, XDB, Perl's debugging mode, the Python debugger 459debugger PDB, and the Java Debugger JDB.
461PDB, or the Java Debugger JDB.
462 460
463 In addition, Emacs contains a built-in system for debugging Emacs 461 Emacs provides a special interface to GDB, which uses extra Emacs
464Lisp programs. @xref{Debugging,, The Lisp Debugger, elisp, the Emacs 462windows to display the state of the debugged program. @xref{GDB
465Lisp Reference Manual}, for information on the Emacs Lisp debugger. 463Graphical Interface}.
464
465 Emacs also has a built-in debugger for Emacs Lisp programs.
466@xref{Debugging,, The Lisp Debugger, elisp, the Emacs Lisp Reference
467Manual}.
466 468
467@menu 469@menu
468* Starting GUD:: How to start a debugger subprocess. 470* Starting GUD:: How to start a debugger subprocess.
@@ -477,146 +479,136 @@ Lisp Reference Manual}, for information on the Emacs Lisp debugger.
477@node Starting GUD 479@node Starting GUD
478@subsection Starting GUD 480@subsection Starting GUD
479 481
480 There are several commands for starting a debugger under GUD, each 482 There are several commands for starting a debugger subprocess, each
481corresponding to a particular debugger program. 483corresponding to a particular debugger program.
482 484
483@table @kbd 485@table @kbd
484@item M-x gdb @key{RET} @var{file} @key{RET} 486@item M-x gdb
485@findex gdb 487@findex gdb
486Run GDB as a subprocess of Emacs. This uses an IDE-like graphical 488Run GDB as a subprocess, and interact with it via an IDE-like Emacs
487interface; see @ref{GDB Graphical Interface}. Only GDB works with the 489interface. @xref{GDB Graphical Interface}, for more information about
488graphical interface. 490this command.
489 491
490@item M-x gud-gdb @key{RET} @var{file} @key{RET} 492@item M-x gud-gdb
491@findex gud-gdb 493@findex gud-gdb
492Run GDB as a subprocess of Emacs. This command creates a buffer for 494Run GDB, using a GUD interaction buffer for input and output to the
493input and output to GDB, and switches to it. If a GDB buffer already 495GDB subprocess (@pxref{Debugger Operation}). If such a buffer already
494exists, it just switches to that buffer. 496exists, switch to it; otherwise, create the buffer and switch to it.
495
496@item M-x dbx @key{RET} @var{file} @key{RET}
497@findex dbx
498Run DBX as a subprocess of Emacs. Since Emacs does not implement a
499graphical interface for DBX, communication with DBX works by typing
500commands in the GUD interaction buffer. The same is true for all
501the other supported debuggers.
502 497
503@item M-x xdb @key{RET} @var{file} @key{RET} 498The other commands in this list do the same, for other debugger
504@findex xdb 499programs.
505@vindex gud-xdb-directories
506Run XDB as a subprocess of Emacs. Use the variable
507@code{gud-xdb-directories} to specify directories to search for source
508files.
509 500
510@item M-x sdb @key{RET} @var{file} @key{RET} 501@item M-x perldb
511@findex sdb
512Run SDB as a subprocess of Emacs.
513
514Some versions of SDB do not mention source file names in their
515messages. When you use them, you need to have a valid tags table
516(@pxref{Tags}) in order for GUD to find functions in the source code.
517If you have not visited a tags table or the tags table doesn't list
518one of the functions, you get a message saying @samp{The sdb support
519requires a valid tags table to work}. If this happens, generate a
520valid tags table in the working directory and try again.
521
522@item M-x perldb @key{RET} @var{file} @key{RET}
523@findex perldb 502@findex perldb
524Run the Perl interpreter in debug mode to debug @var{file}, a Perl program. 503Run the Perl interpreter in debug mode.
525 504
526@item M-x jdb @key{RET} @var{file} @key{RET} 505@item M-x jdb
527@findex jdb 506@findex jdb
528Run the Java debugger to debug @var{file}. 507Run the Java debugger.
529 508
530@item M-x pdb @key{RET} @var{file} @key{RET} 509@item M-x pdb
531@findex pdb 510@findex pdb
532Run the Python debugger to debug @var{file}. 511Run the Python debugger.
512
513@item M-x dbx
514@findex dbx
515Run the DBX debugger.
516
517@item M-x xdb
518@findex xdb
519@vindex gud-xdb-directories
520Run the XDB debugger.
521
522@item M-x sdb
523@findex sdb
524Run the SDB debugger.
533@end table 525@end table
534 526
535 Each of these commands takes one argument: a command line to invoke 527 Each of these commands reads a command line to invoke the debugger,
536the debugger. In the simplest case, specify just the name of the 528using the minibuffer. The minibuffer's initial contents contain the
537executable file you want to debug. You may also use options that the 529standard executable name and options for the debugger, and sometimes
538debugger supports. However, shell wildcards and variables are not 530also a guess for the name of the executable file you want to debug.
539allowed. GUD assumes that the first argument not starting with a 531Shell wildcards and variables are not allowed in this command line.
540@samp{-} is the executable file name. 532Emacs assumes that the first command argument which does not start
533with a @samp{-} is the executable file name.
541 534
542@cindex remote host, debugging on 535@cindex remote host, debugging on
543Tramp provides a facility to debug programs on remote hosts 536 Tramp provides a facility for remote debugging, whereby both the
544(@pxref{Running a debugger on a remote host, Running a debugger on a 537debugger and the program being debugged are on the same remote host.
545remote host,, tramp, The Tramp Manual}), whereby both the debugger and 538@xref{Running a debugger on a remote host,,, tramp, The Tramp Manual},
546the program being debugged are on the same remote host. This should 539for details. This is separate from GDB's remote debugging feature,
547not be confused with debugging programs remotely, where the program 540where the program and the debugger run on different machines
548and the debugger run on different machines, as can be done using the 541(@pxref{Remote Debugging,, Debugging Remote Programs, gdb, The GNU
549GDB remote debugging feature, for example (@pxref{Remote Debugging,, 542debugger}).
550Debugging Remote Programs, gdb, The GNU debugger}).
551 543
552@node Debugger Operation 544@node Debugger Operation
553@subsection Debugger Operation 545@subsection Debugger Operation
546@cindex GUD interaction buffer
554 547
555@cindex fringes, and current execution line in GUD 548 The @dfn{GUD interaction buffer} is an Emacs buffer which is used to
556 Generally when you run a debugger with GUD, the debugger uses an Emacs 549send text commands to a debugger subprocess, and record its output.
557buffer for its ordinary input and output. This is called the GUD 550This is the basic interface for interacting with a debugger, used by
558buffer. Input and output from the program you are debugging also use 551@kbd{M-x gud-gdb} and other commands listed in
559this buffer. We call this @dfn{text command mode}. The GDB Graphical 552@iftex
560Interface can use further buffers (@pxref{GDB Graphical Interface}). 553the preceding section.
561 554@end iftext
562 The debugger displays the source files of the program by visiting 555@ifnottex
563them in Emacs buffers. An arrow in the left fringe indicates the 556@ref{Starting GUD}.
564current execution line.@footnote{On a text-only terminal, the arrow 557@end ifnottex
565appears as @samp{=>} and overlays the first two text columns.} Moving 558The @kbd{M-x gdb} command extends this interface with additional
566point in this buffer does not move the arrow. The arrow is not part 559specialized buffers for controlling breakpoints, stack frames, and
567of the file's text; it appears only on the screen. 560other aspects of the debugger state (@pxref{GDB Graphical Interface}).
568 561
569 You can start editing these source files at any time in the buffers 562 The GUD interaction buffer uses a variant of Shell mode, so the
570that display them. If you do modify a source file, keep in mind that 563Emacs commands defined by Shell mode are available (@pxref{Shell
571inserting or deleting lines will throw off the arrow's positioning; 564Mode}). Completion is available for most debugger commands
572GUD has no way of figuring out which line corresponded before your 565(@pxref{Completion}), and you can use the usual Shell mode history
573changes to the line number in a debugger message. Also, you'll 566commands to repeat them.
574typically have to recompile and restart the program for your changes 567@iftex
575to be reflected in the debugger's tables. 568See the next section
576 569@end iftext
577@cindex tooltips with GUD 570@ifnottex
578@vindex tooltip-gud-modes 571@xref{Commands of GUD},
579@vindex gud-tooltip-mode 572@end ifnottex
573for special commands that can be used in the GUD interaction buffer.
574
575 As you debug a program, Emacs displays the relevant source files by
576visiting them in Emacs buffers, with an arrow in the left fringe
577indicating the current execution line. (On a text-only terminal, the
578arrow appears as @samp{=>}, overlaid on the first two text columns.)
579Moving point in such a buffer does not move the arrow. You are free
580to edit these source files, but note that inserting or deleting lines
581will throw off the arrow's positioning, as Emacs has no way to figure
582out which edited source line corresponds to the line reported by the
583debugger subprocess. To update this information, you typically have
584to recompile and restart the program.
585
586@cindex GUD Tooltip mode
587@cindex mode, GUD Tooltip
588@findex gud-tooltip-mode
580@vindex gud-tooltip-echo-area 589@vindex gud-tooltip-echo-area
581 The Tooltip facility (@pxref{Tooltips}) provides support for GUD@. 590 GUD Tooltip mode is a global minor mode that adds tooltip support to
582You activate this feature by turning on the minor mode 591GUD. To toggle this mode, type @kbd{M-x gud-tooltip-mode}. It is
583@code{gud-tooltip-mode}. Then you can display a variable's value in a 592disabled by default. If enabled, you can move the mouse cursor over a
584tooltip simply by pointing at it with the mouse. This operates in the 593variable to show its value in a tooltip (@pxref{Tooltips}); this takes
585GUD buffer and in source buffers with major modes in the list 594effect in the GUD interaction buffer, and in all source buffers with
586@code{gud-tooltip-modes}. If the variable @code{gud-tooltip-echo-area} 595major modes listed in the variable @code{gud-tooltip-modes}. If the
587is non-@code{nil} then the variable's value is displayed in the echo 596variable @code{gud-tooltip-echo-area} is non-@code{nil}, values are
588area. When debugging a C program using the GDB Graphical Interface, you 597shown in the echo area instead of a tooltip.
589can also display macro definitions associated with an identifier when 598
590the program is not executing. 599 When using GUD Tooltip mode with @kbd{M-x gud-gdb}, you should note
591 600that displaying an expression's value in GDB can sometimes expand a
592 GUD tooltips are disabled when you use GDB in text command mode 601macro, potentially causing side effects in the debugged program. If
593(@pxref{GDB Graphical Interface}), because displaying an expression's 602you use the @kbd{M-x gdb} interface, this problem does not occur, as
594value in GDB can sometimes expand a macro and result in a side effect 603there is special code to avoid side-effects; furthermore, you can
595that interferes with the program's operation. The GDB graphical 604display macro definitions associated with an identifier when the
596interface supports GUD tooltips and assures they will not cause side 605program is not executing.
597effects.
598 606
599@node Commands of GUD 607@node Commands of GUD
600@subsection Commands of GUD 608@subsection Commands of GUD
601 609
602 The GUD interaction buffer uses a variant of Shell mode, so the 610 GUD provides commands for setting and clearing breakpoints,
603Emacs commands of Shell mode are available (@pxref{Shell Mode}). All 611selecting stack frames, and stepping through the program.
604the usual commands for your debugger are available, and you can use
605the Shell mode history commands to repeat them. If you wish, you can
606control your debugger process entirely through this buffer.
607
608 GUD mode also provides commands for setting and clearing
609breakpoints, for selecting stack frames, and for stepping through the
610program. These commands are available both in the GUD buffer and
611globally, but with different key bindings. It also has its own tool
612bar from which you can invoke the more common commands by clicking on
613the appropriate icon. This is particularly useful for repetitive
614commands like @code{gud-next} and @code{gud-step}, and allows you to
615keep the GUD buffer hidden.
616
617 The breakpoint commands are normally used in source file buffers,
618because that is the easiest way to specify where to set or clear the
619breakpoint. Here's the global command to set a breakpoint:
620 612
621@table @kbd 613@table @kbd
622@item C-x @key{SPC} 614@item C-x @key{SPC}
@@ -624,35 +616,42 @@ breakpoint. Here's the global command to set a breakpoint:
624Set a breakpoint on the source line that point is on. 616Set a breakpoint on the source line that point is on.
625@end table 617@end table
626 618
619 @kbd{C-x @key{SPC}} (@code{gud-break}), when called in a source
620buffer, sets a debugger breakpoint on the current source line. This
621command is available only after starting GUD. If you call it in a
622buffer that is not associated with any debugger subprocess, it signals
623a error.
624
627@kindex C-x C-a @r{(GUD)} 625@kindex C-x C-a @r{(GUD)}
628 Here are the other special commands provided by GUD@. The keys 626 The following commands are available both in the GUD interaction
627buffer and globally, but with different key bindings. The keys
629starting with @kbd{C-c} are available only in the GUD interaction 628starting with @kbd{C-c} are available only in the GUD interaction
630buffer. The key bindings that start with @kbd{C-x C-a} are available 629buffer, while those starting with @kbd{C-x C-a} are available
631in the GUD interaction buffer and also in source files. Some of these 630globally. Some of these commands are also available via the tool bar;
632commands are not available to all the supported debuggers. 631some are not supported by certain debuggers.
633 632
634@table @kbd 633@table @kbd
635@item C-c C-l 634@item C-c C-l
636@kindex C-c C-l @r{(GUD)} 635@kindex C-c C-l @r{(GUD)}
637@itemx C-x C-a C-l 636@itemx C-x C-a C-l
638@findex gud-refresh 637@findex gud-refresh
639Display in another window the last line referred to in the GUD 638Display, in another window, the last source line referred to in the
640buffer (that is, the line indicated in the last location message). 639GUD interaction buffer (@code{gud-refresh}).
641This runs the command @code{gud-refresh}.
642 640
643@item C-c C-s 641@item C-c C-s
644@kindex C-c C-s @r{(GUD)} 642@kindex C-c C-s @r{(GUD)}
645@itemx C-x C-a C-s 643@itemx C-x C-a C-s
646@findex gud-step 644@findex gud-step
647Execute a single line of code (@code{gud-step}). If the line contains 645Execute the next single line of code (@code{gud-step}). If the line
648a function call, execution stops after entering the called function. 646contains a function call, execution stops after entering the called
647function.
649 648
650@item C-c C-n 649@item C-c C-n
651@kindex C-c C-n @r{(GUD)} 650@kindex C-c C-n @r{(GUD)}
652@itemx C-x C-a C-n 651@itemx C-x C-a C-n
653@findex gud-next 652@findex gud-next
654Execute a single line of code, stepping across entire function calls 653Execute the next single line of code, stepping across function calls
655at full speed (@code{gud-next}). 654without stopping inside the functions (@code{gud-next}).
656 655
657@item C-c C-i 656@item C-c C-i
658@kindex C-c C-i @r{(GUD)} 657@kindex C-c C-i @r{(GUD)}
@@ -763,17 +762,17 @@ Instead, type @kbd{C-q @key{TAB}} to enter a tab.
763@vindex perldb-mode-hook 762@vindex perldb-mode-hook
764@vindex pdb-mode-hook 763@vindex pdb-mode-hook
765@vindex jdb-mode-hook 764@vindex jdb-mode-hook
766 On startup, GUD runs one of the following hooks: @code{gdb-mode-hook}, 765 On startup, GUD runs one of the following hooks:
767if you are using GDB; @code{dbx-mode-hook}, if you are using DBX; 766@code{gdb-mode-hook}, if you are using GDB; @code{dbx-mode-hook}, if
768@code{sdb-mode-hook}, if you are using SDB; @code{xdb-mode-hook}, if you 767you are using DBX; @code{sdb-mode-hook}, if you are using SDB;
769are using XDB; @code{perldb-mode-hook}, for Perl debugging mode; 768@code{xdb-mode-hook}, if you are using XDB; @code{perldb-mode-hook},
770@code{pdb-mode-hook}, for PDB; @code{jdb-mode-hook}, for JDB. You can 769for Perl debugging mode; @code{pdb-mode-hook}, for PDB;
771use these hooks to define custom key bindings for the debugger 770@code{jdb-mode-hook}, for JDB. @xref{Hooks}.
772interaction buffer. @xref{Hooks}. 771
773 772 The @code{gud-def} Lisp macro (@pxref{Defining Macros,,, elisp, the
774 Here is a convenient way to define a command that sends a particular 773Emacs Lisp Reference Manual}) provides a convenient way to define an
775command string to the debugger, and set up a key binding for it in the 774Emacs command that sends a particular command string to the debugger,
776debugger interaction buffer: 775and set up a key binding for in the GUD interaction buffer:
777 776
778@findex gud-def 777@findex gud-def
779@example 778@example
@@ -829,21 +828,22 @@ Fully qualified class name derived from the expression surrounding point
829@node GDB Graphical Interface 828@node GDB Graphical Interface
830@subsection GDB Graphical Interface 829@subsection GDB Graphical Interface
831 830
832 The command @code{gdb} starts GDB in a graphical interface, using 831 The command @kbd{M-x gdb} starts GDB in an IDE-like interface, with
833Emacs windows for display program state information. With it, you do 832specialized buffers for controlling breakpoints, stack frames, and
834not need to use textual GDB commands; you can control the debugging 833other aspects of the debugger state. It also provides additional ways
835session with the mouse. For example, you can click in the fringe of a 834to control the debugging session with the mouse, such as clicking in
836source buffer to set a breakpoint there, or on a stack frame in the 835the fringe of a source buffer to set a breakpoint there.
837stack buffer to select that frame.
838
839 This mode requires telling GDB that its ``screen size'' is
840unlimited, so it sets the height and width accordingly. For correct
841operation you must not change these values during the GDB session.
842 836
843@vindex gud-gdb-command-name 837@vindex gud-gdb-command-name
844 To run GDB in text command mode, like the other debuggers in Emacs, 838 To run GDB using just the GUD interaction buffer interface, without
845use @kbd{M-x gud-gdb}. You need to use text command mode to debug 839these additional features, use @kbd{M-x gud-gdb} (@pxref{Starting
846multiple programs within one Emacs session. 840GUD}). You must use this if you want to debug multiple programs
841within one Emacs session, as that is currently unsupported by @kbd{M-x
842gdb}.
843
844 Internally, @kbd{M-x gdb} informs GDB that its ``screen size'' is
845unlimited; for correct operation, you must not change GDB's screen
846height and width values during the debugging session.
847 847
848@menu 848@menu
849* GDB User Interface Layout:: Control the number of displayed buffers. 849* GDB User Interface Layout:: Control the number of displayed buffers.
@@ -852,8 +852,7 @@ multiple programs within one Emacs session.
852* Breakpoints Buffer:: A breakpoint control panel. 852* Breakpoints Buffer:: A breakpoint control panel.
853* Threads Buffer:: Displays your threads. 853* Threads Buffer:: Displays your threads.
854* Stack Buffer:: Select a frame from the call stack. 854* Stack Buffer:: Select a frame from the call stack.
855* Other GDB Buffers:: Input/output, locals, registers, 855* Other GDB Buffers:: Other buffers for controlling the GDB state.
856 assembler, threads and memory buffers.
857* Watch Expressions:: Monitor variable values in the speedbar. 856* Watch Expressions:: Monitor variable values in the speedbar.
858* Multithreaded Debugging:: Debugging programs with several threads. 857* Multithreaded Debugging:: Debugging programs with several threads.
859@end menu 858@end menu
@@ -863,12 +862,12 @@ multiple programs within one Emacs session.
863@cindex GDB User Interface layout 862@cindex GDB User Interface layout
864 863
865@vindex gdb-many-windows 864@vindex gdb-many-windows
866 If the variable @code{gdb-many-windows} is @code{nil} (the default 865 If the variable @code{gdb-many-windows} is @code{nil} (the default),
867value) then @kbd{M-x gdb} normally displays only the GUD buffer. 866@kbd{M-x gdb} normally displays only the GUD interaction buffer.
868However, if the variable @code{gdb-show-main} is also non-@code{nil}, 867However, if the variable @code{gdb-show-main} is also non-@code{nil},
869it starts with two windows: one displaying the GUD buffer, and the 868it starts with two windows: one displaying the GUD interaction buffer,
870other showing the source for the @code{main} function of the program 869and the other showing the source for the @code{main} function of the
871you are debugging. 870program you are debugging.
872 871
873 If @code{gdb-many-windows} is non-@code{nil}, then @kbd{M-x gdb} 872 If @code{gdb-many-windows} is non-@code{nil}, then @kbd{M-x gdb}
874displays the following frame layout: 873displays the following frame layout:
@@ -876,7 +875,7 @@ displays the following frame layout:
876@smallexample 875@smallexample
877@group 876@group
878+--------------------------------+--------------------------------+ 877+--------------------------------+--------------------------------+
879| GUD buffer (I/O of GDB) | Locals/Registers buffer | 878| GUD interaction buffer | Locals/Registers buffer |
880|--------------------------------+--------------------------------+ 879|--------------------------------+--------------------------------+
881| Primary Source buffer | I/O buffer for debugged pgm | 880| Primary Source buffer | I/O buffer for debugged pgm |
882|--------------------------------+--------------------------------+ 881|--------------------------------+--------------------------------+
@@ -890,264 +889,233 @@ buffer does not appear and the primary source buffer occupies the full
890width of the frame. 889width of the frame.
891 890
892@findex gdb-restore-windows 891@findex gdb-restore-windows
893 If you change the window layout, for example, while editing and
894re-compiling your program, then you can restore this standard window
895layout with the command @code{gdb-restore-windows}.
896
897@findex gdb-many-windows 892@findex gdb-many-windows
898 To switch between this standard layout and a simple layout 893 If you ever change the window layout, you can restore the ``many
899containing just the GUD buffer and a source file, type @kbd{M-x 894windows'' layout by typing @kbd{M-x gdb-restore-windows}. To toggle
900gdb-many-windows}. 895between the many windows layout and a simple layout with just the GUD
896interaction buffer and a source file, type @kbd{M-x gdb-many-windows}.
901 897
902 You may also specify additional GDB-related buffers to display, 898 You may also specify additional GDB-related buffers to display,
903either in the same frame or a different one. Select the buffers you 899either in the same frame or a different one. Select the buffers you
904want with the @samp{GUD->GDB-Windows} and @samp{GUD->GDB-Frames} 900want by typing @code{M-x gdb-display-@var{buffertype}-buffer} or
905sub-menus. If the menu-bar is unavailable, type @code{M-x 901@code{M-x gdb-frame-@var{buffertype}-buffer}, where @var{buffertype}
906gdb-display-@var{buffertype}-buffer} or @code{M-x 902is the relevant buffer type, such as @samp{breakpoints}. You can do
907gdb-frame-@var{buffertype}-buffer} respectively, where 903the same with the menu bar, with the @samp{GDB-Windows} and
908@var{buffertype} is the relevant buffer type, such as 904@samp{GDB-Frames} sub-menus of the @samp{GUD} menu.
909@samp{breakpoints}. Most of these buffers are read-only, and typing 905
910@kbd{q} in them kills them. 906 When you finish debugging, kill the GUD interaction buffer with
911 907@kbd{C-x k}, which will also kill all the buffers associated with the
912 When you finish debugging, kill the GUD buffer with @kbd{C-x k}, 908session. However you need not do this if, after editing and
913which will also kill all the buffers associated with the session. 909re-compiling your source code within Emacs, you wish to continue
914However you need not do this if, after editing and re-compiling your 910debugging. When you restart execution, GDB automatically finds the
915source code within Emacs, you wish continue debugging. When you 911new executable. Keeping the GUD interaction buffer has the advantage
916restart execution, GDB will automatically find your new executable. 912of keeping the shell history as well as GDB's breakpoints. You do
917Keeping the GUD buffer has the advantage of keeping the shell history 913need to check that the breakpoints in recently edited source files are
918as well as GDB's breakpoints. You do need to check that the 914still in the right places.
919breakpoints in recently edited source files are still in the right
920places.
921 915
922@node Source Buffers 916@node Source Buffers
923@subsubsection Source Buffers 917@subsubsection Source Buffers
924@cindex GDB commands in Fringe 918@cindex fringes, for debugging
925
926@c @findex gdb-mouse-set-clear-breakpoint
927@c @findex gdb-mouse-toggle-breakpoint
928Many GDB commands can be entered using key bindings or the tool bar but
929sometimes it is quicker to use the fringe. These commands either
930manipulate breakpoints or control program execution. When there is no
931fringe, you can use the margin but this is only present when the
932source file already has a breakpoint.
933
934You can click @kbd{Mouse-1} in the fringe or display margin of a
935source buffer to set a breakpoint there and, on a graphical display, a
936red bullet will appear on that line. If a breakpoint already exists
937on that line, the same click will remove it. You can also enable or
938disable a breakpoint by clicking @kbd{C-Mouse-1} on the bullet.
939
940A solid arrow in the left fringe of a source buffer indicates the line
941of the innermost frame where the debugged program has stopped. A
942hollow arrow indicates the current execution line of higher level
943frames.
944
945If you drag the arrow in the fringe with @kbd{Mouse-1}
946(@code{gdb-mouse-until}), execution will continue to the line where
947you release the button, provided it is still in the same frame.
948Alternatively, you can click @kbd{Mouse-3} at some point in the fringe
949of this buffer and execution will advance to there. A similar command
950(@code{gdb-mouse-jump}) allows you to jump to a source line without
951executing the intermediate lines by clicking @kbd{C-Mouse-3}. This
952command allows you to go backwards which can be useful for running
953through code that has already executed, in order to examine its
954execution in more detail.
955 919
956@table @kbd 920@table @asis
957@item Mouse-1 921@item @kbd{Mouse-1} (in fringe)
958Set or clear a breakpoint. 922Set or clear a breakpoint on that line.
959 923
960@item C-Mouse-1 924@item @kbd{C-Mouse-1} (in fringe)
961Enable or disable a breakpoint. 925Enable or disable a breakpoint on that line.
962 926
963@item Mouse-3 927@item @kbd{Mouse-3} (in fringe)
964Continue execution to here. 928Continue execution to that line.
965 929
966@item C-Mouse-3 930@item @kbd{C-Mouse-3} (in fringe)
967Jump to here. 931Jump to that line.
968@end table 932@end table
969 933
970If the variable @code{gdb-find-source-frame} is non-@code{nil} and 934 On a graphical display, you can click @kbd{Mouse-1} in the fringe of
971execution stops in a frame for which there is no source code e.g after 935a source buffer, to set a breakpoint on that line (@pxref{Fringes}).
972an interrupt, then Emacs finds and displays the first frame further up 936A red dot appears in the fringe, where you clicked. If a breakpoint
973stack for which there is source. If it is @code{nil} then the source 937already exists there, the click removes it. A @kbd{C-Mouse-1} click
974buffer continues to display the last frame which maybe more useful, 938enables or disables an existing breakpoint; a breakpoint that is
975for example, when re-setting a breakpoint. 939disabled, but not unset, is indicated by a gray dot.
940
941 On a text-only terminal, or when fringes are disabled, enabled
942breakpoints are indicated with a @samp{B} character in the left margin
943of the window. Disabled breakpoints are indicated with @samp{b}.
944(The margin is only displayed if a breakpoint is present.)
945
946 A solid arrow in the left fringe of a source buffer indicates the
947line of the innermost frame where the debugged program has stopped. A
948hollow arrow indicates the current execution line of a higher-level
949frame. If you drag the arrow in the fringe with @kbd{Mouse-1}, that
950causes execution to advance to the line where you release the button.
951Alternatively, you can click @kbd{Mouse-3} in the fringe to advance to
952that line. You can click @kbd{C-Mouse-3} in the fringe to jump to
953that line without executing the intermediate lines. This command
954allows you to go backwards, which can be useful for running through
955code that has already executed, in order to examine its execution in
956more detail.
976 957
977@node Breakpoints Buffer 958@node Breakpoints Buffer
978@subsubsection Breakpoints Buffer 959@subsubsection Breakpoints Buffer
979 960
980 The breakpoints buffer shows the existing breakpoints, watchpoints and 961 The GDB Breakpoints buffer shows the breakpoints, watchpoints and
981catchpoints (@pxref{Breakpoints,,, gdb, The GNU debugger}). It has 962catchpoints in the debugger session. @xref{Breakpoints,,, gdb, The
982these special commands, which mostly apply to the @dfn{current 963GNU debugger}. It provides the following commands, which mostly apply
983breakpoint}, the breakpoint which point is on. 964to the @dfn{current breakpoint} (the breakpoint which point is on):
984 965
985@table @kbd 966@table @kbd
986@item @key{SPC} 967@item @key{SPC}
987@kindex SPC @r{(GDB breakpoints buffer)} 968@kindex SPC @r{(GDB Breakpoints buffer)}
988@findex gdb-toggle-breakpoint 969@findex gdb-toggle-breakpoint
989Enable/disable current breakpoint (@code{gdb-toggle-breakpoint}). 970Enable/disable current breakpoint (@code{gdb-toggle-breakpoint}). On
990On a graphical display, this changes the color of a bullet in the 971a graphical display, this changes the color of the dot in the fringe
991margin of a source buffer at the relevant line. This is red when 972of the source buffer at that line. The dot is red when the breakpoint
992the breakpoint is enabled and gray when it is disabled. Text-only 973is enabled, and gray when it is disabled.
993terminals correspondingly display a @samp{B} or @samp{b}.
994 974
995@item D 975@item D
996@kindex D @r{(GDB breakpoints buffer)} 976@kindex D @r{(GDB Breakpoints buffer)}
997@findex gdb-delete-breakpoint 977@findex gdb-delete-breakpoint
998Delete the current breakpoint (@code{gdb-delete-breakpoint}). 978Delete the current breakpoint (@code{gdb-delete-breakpoint}).
999 979
1000@item @key{RET} 980@item @key{RET}
1001@kindex RET @r{(GDB breakpoints buffer)} 981@kindex RET @r{(GDB Breakpoints buffer)}
1002@findex gdb-goto-breakpoint 982@findex gdb-goto-breakpoint
1003Visit the source line for the current breakpoint 983Visit the source line for the current breakpoint
1004(@code{gdb-goto-breakpoint}). 984(@code{gdb-goto-breakpoint}).
1005 985
1006@item Mouse-2 986@item Mouse-2
1007@kindex Mouse-2 @r{(GDB breakpoints buffer)} 987@kindex Mouse-2 @r{(GDB Breakpoints buffer)}
1008Visit the source line for the breakpoint you click on. 988Visit the source line for the breakpoint you click on.
1009@end table 989@end table
1010 990
1011@vindex gdb-show-threads-by-default 991@vindex gdb-show-threads-by-default
1012When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer 992 When @code{gdb-many-windows} is non-@code{nil}, the GDB Breakpoints
1013shares its window with the threads buffer. To switch from one to the 993buffer shares its window with the GDB Threads buffer. To switch from
1014other click with @kbd{Mouse-1} on the relevant button in the header 994one to the other click with @kbd{Mouse-1} on the relevant button in
1015line. If @code{gdb-show-threads-by-default} is non-@code{nil}, the 995the header line. If @code{gdb-show-threads-by-default} is
1016threads buffer, rather than the breakpoints buffer, is shown at start 996non-@code{nil}, the GDB Threads buffer is the one shown by default.
1017up.
1018 997
1019@node Threads Buffer 998@node Threads Buffer
1020@subsubsection Threads Buffer 999@subsubsection Threads Buffer
1021 1000
1022@findex gdb-select-thread 1001@findex gdb-select-thread
1023The threads buffer displays a summary of all threads currently in your 1002 The GDB Threads buffer displays a summary of the threads in the
1024program (@pxref{Threads, Threads, Debugging programs with multiple 1003debugged program. @xref{Threads, Threads, Debugging programs with
1025threads, gdb, The GNU debugger}). Move point to any thread in the list 1004multiple threads, gdb, The GNU debugger}. To select a thread, move
1026and press @key{RET} to select it (@code{gdb-select-thread}) and 1005point there and type @key{RET} (@code{gdb-select-thread}), or click on
1027display the associated source in the primary source buffer. 1006it with @kbd{Mouse-2}. This also displays the associated source
1028Alternatively, click @kbd{Mouse-2} on a thread to select it. Contents 1007buffer, and updates the contents of the other GDB buffers.
1029of all GDB buffers are updated whenever you select a thread.
1030 1008
1031 You can customize variables under @code{gdb-buffers} group to select 1009 You can customize variables under @code{gdb-buffers} group to select
1032fields included in threads buffer. 1010fields included in GDB Threads buffer.
1033 1011
1034@table @code 1012@table @code
1035@item gdb-thread-buffer-verbose-names 1013@item gdb-thread-buffer-verbose-names
1036@vindex gdb-thread-buffer-verbose-names 1014@vindex gdb-thread-buffer-verbose-names
1037Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)} in 1015Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)}.
1038threads buffer.
1039 1016
1040@item gdb-thread-buffer-arguments 1017@item gdb-thread-buffer-arguments
1041@vindex gdb-thread-buffer-arguments 1018@vindex gdb-thread-buffer-arguments
1042Show arguments of thread top frames in threads buffer. 1019Show arguments of thread top frames.
1043 1020
1044@item gdb-thread-buffer-locations 1021@item gdb-thread-buffer-locations
1045@vindex gdb-thread-buffer-locations 1022@vindex gdb-thread-buffer-locations
1046Show file information or library names in threads buffer. 1023Show file information or library names.
1047 1024
1048@item gdb-thread-buffer-addresses 1025@item gdb-thread-buffer-addresses
1049@vindex gdb-thread-buffer-addresses 1026@vindex gdb-thread-buffer-addresses
1050Show addresses for thread frames in threads buffer. 1027Show addresses for thread frames in threads buffer.
1051@end table 1028@end table
1052 1029
1053 It's possible to observe information for several threads 1030 To view information for several threads simultaneously, use the
1054simultaneously (in addition to buffers which show information for 1031following commands from the GDB Threads buffer.
1055currently selected thread) using the following keys from the threads
1056buffer.
1057 1032
1058@table @kbd 1033@table @kbd
1059@item d 1034@item d
1060@kindex d @r{(GDB threads buffer)} 1035@kindex d @r{(GDB threads buffer)}
1061@findex gdb-display-disassembly-for-thread 1036@findex gdb-display-disassembly-for-thread
1062Display disassembly buffer for the thread at current line. 1037Display disassembly buffer for the thread at current line
1063(@code{gdb-display-disassembly-for-thread}) 1038(@code{gdb-display-disassembly-for-thread}).
1064 1039
1065@item f 1040@item f
1066@kindex f @r{(GDB threads buffer)} 1041@kindex f @r{(GDB threads buffer)}
1067@findex gdb-display-stack-for-thread 1042@findex gdb-display-stack-for-thread
1068Display stack buffer for the thread at current line. 1043Display the GDB Stack buffer for the thread at current line
1069(@code{gdb-display-stack-for-thread}). 1044(@code{gdb-display-stack-for-thread}).
1070 1045
1071@item l 1046@item l
1072@kindex l @r{(GDB threads buffer)} 1047@kindex l @r{(GDB threads buffer)}
1073@findex gdb-display-locals-for-thread 1048@findex gdb-display-locals-for-thread
1074Display locals buffer for the thread at current line. 1049Display the GDB Locals buffer for the thread at current line
1075(@code{gdb-display-locals-for-thread}). 1050(@code{gdb-display-locals-for-thread}).
1076 1051
1077@item r 1052@item r
1078@kindex r @r{(GDB threads buffer)} 1053@kindex r @r{(GDB threads buffer)}
1079@findex gdb-display-registers-for-thread 1054@findex gdb-display-registers-for-thread
1080Display registers buffer for the thread at current line. 1055Display the GDB Registers buffer for the thread at current line
1081(@code{gdb-display-registers-for-thread}). 1056(@code{gdb-display-registers-for-thread}).
1082@end table 1057@end table
1083 1058
1084Pressing their upper-case counterparts, @kbd{D}, @kbd{F} ,@kbd{L} and 1059@noindent
1085@kbd{R} displays the corresponding buffer in a new frame. 1060Their upper-case counterparts, @kbd{D}, @kbd{F} ,@kbd{L} and @kbd{R},
1061display the corresponding buffer in a new frame.
1086 1062
1087 When you create a buffer showing information about some specific 1063 When you create a buffer showing information about some specific
1088thread, it becomes bound to that thread and keeps showing actual 1064thread, it becomes bound to that thread and keeps showing actual
1089information while you debug your program. Every GDB buffer contains a 1065information while you debug your program. The mode indicator for each
1090number of thread it shows information for in its mode name. Thread 1066GDB buffer shows the number of thread it is showing information about.
1091number is also included in the buffer name of bound buffers to prevent 1067The thread number is also included in the buffer name of bound
1092buffer names clashing. 1068buffers.
1093 1069
1094Further commands are available in the threads buffer which depend on the 1070 Further commands are available in the GDB Threads buffer which
1095mode of GDB that is used for controlling execution of your program. 1071depend on the mode of GDB that is used for controlling execution of
1096(@pxref{Multithreaded Debugging, Stopping and Starting Multi-threaded Programs}). 1072your program. @xref{Multithreaded Debugging}.
1097 1073
1098@node Stack Buffer 1074@node Stack Buffer
1099@subsubsection Stack Buffer 1075@subsubsection Stack Buffer
1100 1076
1101 The stack buffer displays a @dfn{call stack}, with one line for each 1077 The GDB Stack buffer displays a @dfn{call stack}, with one line for
1102of the nested subroutine calls (@dfn{stack frames}) now active in the 1078each of the nested subroutine calls (@dfn{stack frames}) in the
1103program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}. 1079debugger session. @xref{Backtrace,, Backtraces, gdb, The GNU
1080debugger}.
1104 1081
1105@findex gdb-frames-select 1082@findex gdb-frames-select
1106An arrow in the fringe points to the selected frame or, if the fringe is 1083 On graphical displays, the selected stack frame is indicated by an
1107not present, the number of the selected frame is displayed in reverse 1084arrow in the fringe. On text-only terminals, or when fringes are
1108contrast. To select a frame in GDB, move point in the stack buffer to 1085disabled, the selected stack frame is displayed in reverse contrast.
1109that stack frame and type @key{RET} (@code{gdb-frames-select}), or click 1086To select a stack frame, move point in its line and type @key{RET}
1110@kbd{Mouse-2} on a stack frame. If the locals buffer is visible, 1087(@code{gdb-frames-select}), or click @kbd{Mouse-2} on it. Doing so
1111selecting a stack frame updates it to display the local variables of the 1088also updates the Locals buffer
1112new frame. 1089@ifnottex
1090(@pxref{Other GDB Buffers}).
1091@end ifnottex
1092@iftex
1093(described in the next section).
1094@end iftex
1113 1095
1114@node Other GDB Buffers 1096@node Other GDB Buffers
1115@subsubsection Other Buffers 1097@subsubsection Other GDB Buffers
1116 1098
1117@table @asis 1099@table @asis
1118@item Input/Output Buffer
1119@vindex gdb-use-separate-io-buffer
1120If the variable @code{gdb-use-separate-io-buffer} is non-@code{nil},
1121the program being debugged takes its input and displays its output
1122here. Otherwise it uses the GUD buffer for that. To toggle whether
1123GUD mode uses this buffer, do @kbd{M-x gdb-use-separate-io-buffer}.
1124This takes effect when you next restart the program you are debugging.
1125
1126The history and replay commands from Shell mode are available here,
1127as are the commands to send signals to the debugged program.
1128@xref{Shell Mode}.
1129
1130@item Locals Buffer 1100@item Locals Buffer
1131The locals buffer displays the values of local variables of the 1101This buffer displays the values of local variables of the current
1132current frame for simple data types (@pxref{Frame Info, Frame Info, 1102frame for simple data types (@pxref{Frame Info, Frame Info,
1133Information on a frame, gdb, The GNU debugger}). Press @key{RET} or 1103Information on a frame, gdb, The GNU debugger}). Press @key{RET} or
1134click @kbd{Mouse-2} on the value if you want to edit it. 1104click @kbd{Mouse-2} on the value if you want to edit it.
1135 1105
1136Arrays and structures display their type only. With GDB 6.4 or later, 1106Arrays and structures display their type only. With GDB 6.4 or later,
1137move point to their name and press @key{RET}, or alternatively click 1107you can examine the value of the local variable at point by typing
1138@kbd{Mouse-2} there, to examine their values. With earlier versions 1108@key{RET}, or with a @kbd{Mouse-2} click. With earlier versions of
1139of GDB, use @kbd{Mouse-2} or @key{RET} on the type description 1109GDB, use @key{RET} or @kbd{Mouse-2} on the type description
1140(@samp{[struct/union]} or @samp{[array]}). @xref{Watch Expressions}. 1110(@samp{[struct/union]} or @samp{[array]}). @xref{Watch Expressions}.
1141 1111
1142@item Registers Buffer 1112@item Registers Buffer
1143@findex toggle-gdb-all-registers 1113@findex toggle-gdb-all-registers
1144The registers buffer displays the values held by the registers 1114This buffer displays the values held by the registers
1145(@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or 1115(@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or
1146click @kbd{Mouse-2} on a register if you want to edit its value. 1116click @kbd{Mouse-2} on a register if you want to edit its value. With
1147With GDB 6.4 or later, recently changed register values display with 1117GDB 6.4 or later, recently changed register values display with
1148@code{font-lock-warning-face}. With earlier versions of GDB, you can 1118@code{font-lock-warning-face}.
1149press @key{SPC} to toggle the display of floating point registers
1150(@code{toggle-gdb-all-registers}).
1151 1119
1152@item Assembler Buffer 1120@item Assembler Buffer
1153The assembler buffer displays the current frame as machine code. An 1121The assembler buffer displays the current frame as machine code. An
@@ -1166,8 +1134,8 @@ size for these data items.
1166@end table 1134@end table
1167 1135
1168When @code{gdb-many-windows} is non-@code{nil}, the locals buffer 1136When @code{gdb-many-windows} is non-@code{nil}, the locals buffer
1169shares its window with the registers buffer, just like breakpoints 1137shares its window with the registers buffer, just like breakpoints and
1170and threads buffers. To switch from one to the other click with 1138threads buffers. To switch from one to the other, click with
1171@kbd{Mouse-1} on the relevant button in the header line. 1139@kbd{Mouse-1} on the relevant button in the header line.
1172 1140
1173@node Watch Expressions 1141@node Watch Expressions
@@ -1182,14 +1150,15 @@ in the tool bar (@code{gud-watch}) or type @kbd{C-x C-a C-w}. If you
1182specify a prefix argument, you can enter the variable name in the 1150specify a prefix argument, you can enter the variable name in the
1183minibuffer. 1151minibuffer.
1184 1152
1185 Each watch expression is displayed in the speedbar. Complex data 1153 Each watch expression is displayed in the speedbar
1186types, such as arrays, structures and unions are represented in a tree 1154(@pxref{Speedbar}). Complex data types, such as arrays, structures
1187format. Leaves and simple data types show the name of the expression 1155and unions are represented in a tree format. Leaves and simple data
1188and its value and, when the speedbar frame is selected, display the 1156types show the name of the expression and its value and, when the
1189type as a tooltip. Higher levels show the name, type and address 1157speedbar frame is selected, display the type as a tooltip. Higher
1190value for pointers and just the name and type otherwise. Root expressions 1158levels show the name, type and address value for pointers and just the
1191also display the frame address as a tooltip to help identify the frame 1159name and type otherwise. Root expressions also display the frame
1192in which they were defined. 1160address as a tooltip to help identify the frame in which they were
1161defined.
1193 1162
1194 To expand or contract a complex data type, click @kbd{Mouse-2} or 1163 To expand or contract a complex data type, click @kbd{Mouse-2} or
1195press @key{SPC} on the tag to the left of the expression. Emacs asks 1164press @key{SPC} on the tag to the left of the expression. Emacs asks
@@ -1237,51 +1206,43 @@ non-@code{nil}. This can be useful if you are debugging with a full
1237screen Emacs frame. 1206screen Emacs frame.
1238 1207
1239@node Multithreaded Debugging 1208@node Multithreaded Debugging
1240@subsubsection Stopping and Starting Multi-threaded Programs 1209@subsubsection Multithreaded Debugging
1241@cindex Multithreaded debugging in GDB 1210@cindex Multithreaded debugging in GDB
1242
1243@subsubheading All-stop Debugging
1244
1245In all-stop mode, whenever your program stops, @emph{all} threads of
1246execution stop. Likewise, whenever you restart the program, all
1247threads start executing. @xref{All-Stop Mode, , All-Stop Mode, gdb,
1248The GNU debugger}. You can enable this behavior in Emacs by setting
1249@code{gdb-non-stop-setting} to @code{nil} before starting a debugging
1250session.
1251
1252@subsubheading Non-stop Debugging
1253@cindex Non-stop debugging in GDB 1211@cindex Non-stop debugging in GDB
1254 1212
1255For some multi-threaded targets, GDB supports a further mode of 1213 In GDB's @dfn{all-stop mode}, whenever your program stops, all
1256operation in which you can examine stopped program threads in the 1214execution threads stop. Likewise, whenever you restart the program,
1257debugger while other threads continue to execute freely. 1215all threads start executing. @xref{All-Stop Mode, , All-Stop Mode,
1258@xref{Non-Stop Mode, , Non-Stop Mode, gdb, The GNU debugger}. 1216gdb, The GNU debugger}. For some multi-threaded targets, GDB supports
1259This is referred to as @dfn{non-stop} mode. 1217a further mode of operation, called @dfn{non-stop mode}, in which you
1260 1218can examine stopped program threads in the debugger while other
1261Versions of GDB prior to 7.0 do not support non-stop mode and it does 1219threads continue to execute freely. @xref{Non-Stop Mode, , Non-Stop
1262not work on all targets. In such cases, Emacs uses all-stop mode 1220Mode, gdb, The GNU debugger}. Versions of GDB prior to 7.0 do not
1263regardless of the value of @code{gdb-non-stop-setting}. 1221support non-stop mode, and it does not work on all targets.
1264 1222
1265@vindex gdb-non-stop-setting 1223@vindex gdb-non-stop-setting
1266If the variable @code{gdb-non-stop-setting} is non-@code{nil} (the 1224 The variable @code{gdb-non-stop-setting} determines whether Emacs
1267default value), Emacs tries to start GDB in non-stop mode. Note that 1225runs GDB in all-stop mode or non-stop mode. The default is @code{t},
1268GDB debugging session needs to be restarted for change of this setting 1226which means it tries to use non-stop mode if that is available. If
1269to take effect. 1227you change the value to @code{nil}, or if non-stop mode is
1228unavailable, Emacs runs GDB in all-stop mode. The variable takes
1229effect when Emacs begins a debugging session; if you change its value,
1230you should restart any active debugging session.
1270 1231
1271@vindex gdb-switch-when-another-stopped 1232@vindex gdb-switch-when-another-stopped
1272When a thread stops in non-stop mode, Emacs automatically switches to 1233 When a thread stops in non-stop mode, Emacs usually switches to that
1273that thread. It may be undesirable to allow switching of current 1234thread. If you don't want Emacs to do this switch if another stopped
1274thread when some other stopped thread is already selected. Set 1235thread is already selected, change the variable
1275@code{gdb-switch-when-another-stopped} to @code{nil} to prevent this. 1236@code{gdb-switch-when-another-stopped} to @code{nil}.
1276 1237
1277@vindex gdb-switch-reasons 1238@vindex gdb-switch-reasons
1278Emacs can decide whether or not to switch to the stopped thread 1239 Emacs can decide whether or not to switch to the stopped thread
1279depending on the reason which caused the stop. Customize 1240depending on the reason which caused the stop. Customize the variable
1280@code{gdb-switch-reasons} to select stop reasons which make Emacs 1241@code{gdb-switch-reasons} to select the stop reasons which will cause
1281switch thread. 1242a thread switch.
1282 1243
1283@vindex gdb-stopped-hooks 1244@vindex gdb-stopped-hooks
1284The variable @code{gdb-stopped-hooks} allows you to execute your 1245 The variable @code{gdb-stopped-hooks} allows you to execute your
1285functions whenever some thread stops. 1246functions whenever some thread stops.
1286 1247
1287 In non-stop mode, you can switch between different modes for GUD 1248 In non-stop mode, you can switch between different modes for GUD
@@ -1291,7 +1252,7 @@ execution control commands.
1291@table @dfn 1252@table @dfn
1292@item Non-stop/A 1253@item Non-stop/A
1293 1254
1294When @code{gdb-gud-control-all-threads} is @code{t} (the default 1255 When @code{gdb-gud-control-all-threads} is @code{t} (the default
1295value), interruption and continuation commands apply to all threads, 1256value), interruption and continuation commands apply to all threads,
1296so you can halt or continue all your threads with one command using 1257so you can halt or continue all your threads with one command using
1297@code{gud-stop-subjob} and @code{gud-cont}, respectively. The 1258@code{gud-stop-subjob} and @code{gud-cont}, respectively. The
@@ -1312,18 +1273,13 @@ from the tool bar or from @samp{GUD->GDB-MI} menu.
1312 1273
1313 Stepping commands always apply to the current thread. 1274 Stepping commands always apply to the current thread.
1314 1275
1315@subsubheading Fine Thread Control
1316
1317 In non-stop mode, you can interrupt/continue your threads without 1276 In non-stop mode, you can interrupt/continue your threads without
1318selecting them. Hitting @kbd{i} in threads buffer interrupts thread 1277selecting them. Hitting @kbd{i} in threads buffer interrupts thread
1319under point, @kbd{c} continues it, @kbd{s} steps through. More such 1278under point, @kbd{c} continues it, @kbd{s} steps through. More such
1320commands may be added in the future. 1279commands may be added in the future.
1321 1280
1322Combined with creating bound buffers for any thread, this allows you 1281 Note that when you interrupt a thread, it stops with the
1323to change and track state of many threads in the same time. 1282@samp{signal received} reason. If that reason is included in your
1324
1325 Note that when you interrupt a thread, it stops with @samp{signal
1326received} reason. If that reason is included in your
1327@code{gdb-switch-reasons} (it is by default), Emacs will switch to 1283@code{gdb-switch-reasons} (it is by default), Emacs will switch to
1328that thread. 1284that thread.
1329 1285
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 5336384c3b9..8ecf0982e46 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -722,8 +722,7 @@ GDB Graphical Interface
722* Breakpoints Buffer:: A breakpoint control panel. 722* Breakpoints Buffer:: A breakpoint control panel.
723* Threads Buffer:: Displays your threads. 723* Threads Buffer:: Displays your threads.
724* Stack Buffer:: Select a frame from the call stack. 724* Stack Buffer:: Select a frame from the call stack.
725* Other GDB Buffers:: Input/output, locals, registers, 725* Other GDB Buffers:: Other buffers for controlling the GDB state.
726 assembler, threads and memory buffers.
727* Watch Expressions:: Monitor variable values in the speedbar. 726* Watch Expressions:: Monitor variable values in the speedbar.
728* Multithreaded Debugging:: Debugging programs with several threads. 727* Multithreaded Debugging:: Debugging programs with several threads.
729 728