diff options
| author | Chong Yidong | 2011-12-10 15:39:43 +0800 |
|---|---|---|
| committer | Chong Yidong | 2011-12-10 15:39:43 +0800 |
| commit | 0595bd7e90cca425fe1d9abe145f8ead4d963a57 (patch) | |
| tree | 0aa797e2ae157a865d3416c979b9f6610e0991ca | |
| parent | ffdcbd1c7b9d74cffb1ddd90753425de3cdd110e (diff) | |
| download | emacs-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/ChangeLog | 13 | ||||
| -rw-r--r-- | doc/emacs/building.texi | 696 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 3 |
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 @@ | |||
| 1 | 2011-12-08 Chong Yidong <cyd@gnu.org> | 1 | 2011-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? | ||
| 457 | The GUD (Grand Unified Debugger) library provides an Emacs interface | 456 | The GUD (Grand Unified Debugger) library provides an Emacs interface |
| 458 | to a wide variety of symbolic debuggers. Unlike the GDB graphical | 457 | to a wide variety of symbolic debuggers. It can run the GNU Debugger |
| 459 | interface, which only runs GDB (@pxref{GDB Graphical Interface}), GUD | 458 | (GDB), as well as DBX, SDB, XDB, Perl's debugging mode, the Python |
| 460 | can also run DBX, SDB, XDB, Perl's debugging mode, the Python debugger | 459 | debugger PDB, and the Java Debugger JDB. |
| 461 | PDB, 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 |
| 464 | Lisp programs. @xref{Debugging,, The Lisp Debugger, elisp, the Emacs | 462 | windows to display the state of the debugged program. @xref{GDB |
| 465 | Lisp Reference Manual}, for information on the Emacs Lisp debugger. | 463 | Graphical 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 | ||
| 467 | Manual}. | ||
| 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 |
| 481 | corresponding to a particular debugger program. | 483 | corresponding 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 |
| 486 | Run GDB as a subprocess of Emacs. This uses an IDE-like graphical | 488 | Run GDB as a subprocess, and interact with it via an IDE-like Emacs |
| 487 | interface; see @ref{GDB Graphical Interface}. Only GDB works with the | 489 | interface. @xref{GDB Graphical Interface}, for more information about |
| 488 | graphical interface. | 490 | this 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 |
| 492 | Run GDB as a subprocess of Emacs. This command creates a buffer for | 494 | Run GDB, using a GUD interaction buffer for input and output to the |
| 493 | input and output to GDB, and switches to it. If a GDB buffer already | 495 | GDB subprocess (@pxref{Debugger Operation}). If such a buffer already |
| 494 | exists, it just switches to that buffer. | 496 | exists, 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 | ||
| 498 | Run DBX as a subprocess of Emacs. Since Emacs does not implement a | ||
| 499 | graphical interface for DBX, communication with DBX works by typing | ||
| 500 | commands in the GUD interaction buffer. The same is true for all | ||
| 501 | the other supported debuggers. | ||
| 502 | 497 | ||
| 503 | @item M-x xdb @key{RET} @var{file} @key{RET} | 498 | The other commands in this list do the same, for other debugger |
| 504 | @findex xdb | 499 | programs. |
| 505 | @vindex gud-xdb-directories | ||
| 506 | Run XDB as a subprocess of Emacs. Use the variable | ||
| 507 | @code{gud-xdb-directories} to specify directories to search for source | ||
| 508 | files. | ||
| 509 | 500 | ||
| 510 | @item M-x sdb @key{RET} @var{file} @key{RET} | 501 | @item M-x perldb |
| 511 | @findex sdb | ||
| 512 | Run SDB as a subprocess of Emacs. | ||
| 513 | |||
| 514 | Some versions of SDB do not mention source file names in their | ||
| 515 | messages. 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. | ||
| 517 | If you have not visited a tags table or the tags table doesn't list | ||
| 518 | one of the functions, you get a message saying @samp{The sdb support | ||
| 519 | requires a valid tags table to work}. If this happens, generate a | ||
| 520 | valid 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 |
| 524 | Run the Perl interpreter in debug mode to debug @var{file}, a Perl program. | 503 | Run 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 |
| 528 | Run the Java debugger to debug @var{file}. | 507 | Run 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 |
| 532 | Run the Python debugger to debug @var{file}. | 511 | Run the Python debugger. |
| 512 | |||
| 513 | @item M-x dbx | ||
| 514 | @findex dbx | ||
| 515 | Run the DBX debugger. | ||
| 516 | |||
| 517 | @item M-x xdb | ||
| 518 | @findex xdb | ||
| 519 | @vindex gud-xdb-directories | ||
| 520 | Run the XDB debugger. | ||
| 521 | |||
| 522 | @item M-x sdb | ||
| 523 | @findex sdb | ||
| 524 | Run 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, |
| 536 | the debugger. In the simplest case, specify just the name of the | 528 | using the minibuffer. The minibuffer's initial contents contain the |
| 537 | executable file you want to debug. You may also use options that the | 529 | standard executable name and options for the debugger, and sometimes |
| 538 | debugger supports. However, shell wildcards and variables are not | 530 | also a guess for the name of the executable file you want to debug. |
| 539 | allowed. GUD assumes that the first argument not starting with a | 531 | Shell wildcards and variables are not allowed in this command line. |
| 540 | @samp{-} is the executable file name. | 532 | Emacs assumes that the first command argument which does not start |
| 533 | with a @samp{-} is the executable file name. | ||
| 541 | 534 | ||
| 542 | @cindex remote host, debugging on | 535 | @cindex remote host, debugging on |
| 543 | Tramp 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 | 537 | debugger and the program being debugged are on the same remote host. |
| 545 | remote host,, tramp, The Tramp Manual}), whereby both the debugger and | 538 | @xref{Running a debugger on a remote host,,, tramp, The Tramp Manual}, |
| 546 | the program being debugged are on the same remote host. This should | 539 | for details. This is separate from GDB's remote debugging feature, |
| 547 | not be confused with debugging programs remotely, where the program | 540 | where the program and the debugger run on different machines |
| 548 | and the debugger run on different machines, as can be done using the | 541 | (@pxref{Remote Debugging,, Debugging Remote Programs, gdb, The GNU |
| 549 | GDB remote debugging feature, for example (@pxref{Remote Debugging,, | 542 | debugger}). |
| 550 | Debugging 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 | 549 | send text commands to a debugger subprocess, and record its output. |
| 557 | buffer for its ordinary input and output. This is called the GUD | 550 | This is the basic interface for interacting with a debugger, used by |
| 558 | buffer. Input and output from the program you are debugging also use | 551 | @kbd{M-x gud-gdb} and other commands listed in |
| 559 | this buffer. We call this @dfn{text command mode}. The GDB Graphical | 552 | @iftex |
| 560 | Interface can use further buffers (@pxref{GDB Graphical Interface}). | 553 | the preceding section. |
| 561 | 554 | @end iftext | |
| 562 | The debugger displays the source files of the program by visiting | 555 | @ifnottex |
| 563 | them in Emacs buffers. An arrow in the left fringe indicates the | 556 | @ref{Starting GUD}. |
| 564 | current execution line.@footnote{On a text-only terminal, the arrow | 557 | @end ifnottex |
| 565 | appears as @samp{=>} and overlays the first two text columns.} Moving | 558 | The @kbd{M-x gdb} command extends this interface with additional |
| 566 | point in this buffer does not move the arrow. The arrow is not part | 559 | specialized buffers for controlling breakpoints, stack frames, and |
| 567 | of the file's text; it appears only on the screen. | 560 | other 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 |
| 570 | that display them. If you do modify a source file, keep in mind that | 563 | Emacs commands defined by Shell mode are available (@pxref{Shell |
| 571 | inserting or deleting lines will throw off the arrow's positioning; | 564 | Mode}). Completion is available for most debugger commands |
| 572 | GUD has no way of figuring out which line corresponded before your | 565 | (@pxref{Completion}), and you can use the usual Shell mode history |
| 573 | changes to the line number in a debugger message. Also, you'll | 566 | commands to repeat them. |
| 574 | typically have to recompile and restart the program for your changes | 567 | @iftex |
| 575 | to be reflected in the debugger's tables. | 568 | See 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 |
| 573 | for 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 | ||
| 576 | visiting them in Emacs buffers, with an arrow in the left fringe | ||
| 577 | indicating the current execution line. (On a text-only terminal, the | ||
| 578 | arrow appears as @samp{=>}, overlaid on the first two text columns.) | ||
| 579 | Moving point in such a buffer does not move the arrow. You are free | ||
| 580 | to edit these source files, but note that inserting or deleting lines | ||
| 581 | will throw off the arrow's positioning, as Emacs has no way to figure | ||
| 582 | out which edited source line corresponds to the line reported by the | ||
| 583 | debugger subprocess. To update this information, you typically have | ||
| 584 | to 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 |
| 582 | You activate this feature by turning on the minor mode | 591 | GUD. 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 | 592 | disabled by default. If enabled, you can move the mouse cursor over a |
| 584 | tooltip simply by pointing at it with the mouse. This operates in the | 593 | variable to show its value in a tooltip (@pxref{Tooltips}); this takes |
| 585 | GUD buffer and in source buffers with major modes in the list | 594 | effect in the GUD interaction buffer, and in all source buffers with |
| 586 | @code{gud-tooltip-modes}. If the variable @code{gud-tooltip-echo-area} | 595 | major modes listed in the variable @code{gud-tooltip-modes}. If the |
| 587 | is non-@code{nil} then the variable's value is displayed in the echo | 596 | variable @code{gud-tooltip-echo-area} is non-@code{nil}, values are |
| 588 | area. When debugging a C program using the GDB Graphical Interface, you | 597 | shown in the echo area instead of a tooltip. |
| 589 | can also display macro definitions associated with an identifier when | 598 | |
| 590 | the program is not executing. | 599 | When using GUD Tooltip mode with @kbd{M-x gud-gdb}, you should note |
| 591 | 600 | that displaying an expression's value in GDB can sometimes expand a | |
| 592 | GUD tooltips are disabled when you use GDB in text command mode | 601 | macro, potentially causing side effects in the debugged program. If |
| 593 | (@pxref{GDB Graphical Interface}), because displaying an expression's | 602 | you use the @kbd{M-x gdb} interface, this problem does not occur, as |
| 594 | value in GDB can sometimes expand a macro and result in a side effect | 603 | there is special code to avoid side-effects; furthermore, you can |
| 595 | that interferes with the program's operation. The GDB graphical | 604 | display macro definitions associated with an identifier when the |
| 596 | interface supports GUD tooltips and assures they will not cause side | 605 | program is not executing. |
| 597 | effects. | ||
| 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, |
| 603 | Emacs commands of Shell mode are available (@pxref{Shell Mode}). All | 611 | selecting stack frames, and stepping through the program. |
| 604 | the usual commands for your debugger are available, and you can use | ||
| 605 | the Shell mode history commands to repeat them. If you wish, you can | ||
| 606 | control your debugger process entirely through this buffer. | ||
| 607 | |||
| 608 | GUD mode also provides commands for setting and clearing | ||
| 609 | breakpoints, for selecting stack frames, and for stepping through the | ||
| 610 | program. These commands are available both in the GUD buffer and | ||
| 611 | globally, but with different key bindings. It also has its own tool | ||
| 612 | bar from which you can invoke the more common commands by clicking on | ||
| 613 | the appropriate icon. This is particularly useful for repetitive | ||
| 614 | commands like @code{gud-next} and @code{gud-step}, and allows you to | ||
| 615 | keep the GUD buffer hidden. | ||
| 616 | |||
| 617 | The breakpoint commands are normally used in source file buffers, | ||
| 618 | because that is the easiest way to specify where to set or clear the | ||
| 619 | breakpoint. 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: | |||
| 624 | Set a breakpoint on the source line that point is on. | 616 | Set 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 | ||
| 620 | buffer, sets a debugger breakpoint on the current source line. This | ||
| 621 | command is available only after starting GUD. If you call it in a | ||
| 622 | buffer that is not associated with any debugger subprocess, it signals | ||
| 623 | a 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 |
| 627 | buffer and globally, but with different key bindings. The keys | ||
| 629 | starting with @kbd{C-c} are available only in the GUD interaction | 628 | starting with @kbd{C-c} are available only in the GUD interaction |
| 630 | buffer. The key bindings that start with @kbd{C-x C-a} are available | 629 | buffer, while those starting with @kbd{C-x C-a} are available |
| 631 | in the GUD interaction buffer and also in source files. Some of these | 630 | globally. Some of these commands are also available via the tool bar; |
| 632 | commands are not available to all the supported debuggers. | 631 | some 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 |
| 639 | Display in another window the last line referred to in the GUD | 638 | Display, in another window, the last source line referred to in the |
| 640 | buffer (that is, the line indicated in the last location message). | 639 | GUD interaction buffer (@code{gud-refresh}). |
| 641 | This 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 |
| 647 | Execute a single line of code (@code{gud-step}). If the line contains | 645 | Execute the next single line of code (@code{gud-step}). If the line |
| 648 | a function call, execution stops after entering the called function. | 646 | contains a function call, execution stops after entering the called |
| 647 | function. | ||
| 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 |
| 654 | Execute a single line of code, stepping across entire function calls | 653 | Execute the next single line of code, stepping across function calls |
| 655 | at full speed (@code{gud-next}). | 654 | without 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: |
| 767 | if 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 | 767 | you are using DBX; @code{sdb-mode-hook}, if you are using SDB; |
| 769 | are 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 | 769 | for Perl debugging mode; @code{pdb-mode-hook}, for PDB; |
| 771 | use these hooks to define custom key bindings for the debugger | 770 | @code{jdb-mode-hook}, for JDB. @xref{Hooks}. |
| 772 | interaction 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 | 773 | Emacs Lisp Reference Manual}) provides a convenient way to define an |
| 775 | command string to the debugger, and set up a key binding for it in the | 774 | Emacs command that sends a particular command string to the debugger, |
| 776 | debugger interaction buffer: | 775 | and 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 |
| 833 | Emacs windows for display program state information. With it, you do | 832 | specialized buffers for controlling breakpoints, stack frames, and |
| 834 | not need to use textual GDB commands; you can control the debugging | 833 | other aspects of the debugger state. It also provides additional ways |
| 835 | session with the mouse. For example, you can click in the fringe of a | 834 | to control the debugging session with the mouse, such as clicking in |
| 836 | source buffer to set a breakpoint there, or on a stack frame in the | 835 | the fringe of a source buffer to set a breakpoint there. |
| 837 | stack buffer to select that frame. | ||
| 838 | |||
| 839 | This mode requires telling GDB that its ``screen size'' is | ||
| 840 | unlimited, so it sets the height and width accordingly. For correct | ||
| 841 | operation 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 |
| 845 | use @kbd{M-x gud-gdb}. You need to use text command mode to debug | 839 | these additional features, use @kbd{M-x gud-gdb} (@pxref{Starting |
| 846 | multiple programs within one Emacs session. | 840 | GUD}). You must use this if you want to debug multiple programs |
| 841 | within one Emacs session, as that is currently unsupported by @kbd{M-x | ||
| 842 | gdb}. | ||
| 843 | |||
| 844 | Internally, @kbd{M-x gdb} informs GDB that its ``screen size'' is | ||
| 845 | unlimited; for correct operation, you must not change GDB's screen | ||
| 846 | height 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), |
| 867 | value) then @kbd{M-x gdb} normally displays only the GUD buffer. | 866 | @kbd{M-x gdb} normally displays only the GUD interaction buffer. |
| 868 | However, if the variable @code{gdb-show-main} is also non-@code{nil}, | 867 | However, if the variable @code{gdb-show-main} is also non-@code{nil}, |
| 869 | it starts with two windows: one displaying the GUD buffer, and the | 868 | it starts with two windows: one displaying the GUD interaction buffer, |
| 870 | other showing the source for the @code{main} function of the program | 869 | and the other showing the source for the @code{main} function of the |
| 871 | you are debugging. | 870 | program 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} |
| 874 | displays the following frame layout: | 873 | displays 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 | |||
| 890 | width of the frame. | 889 | width 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 | ||
| 894 | re-compiling your program, then you can restore this standard window | ||
| 895 | layout 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 |
| 899 | containing just the GUD buffer and a source file, type @kbd{M-x | 894 | windows'' layout by typing @kbd{M-x gdb-restore-windows}. To toggle |
| 900 | gdb-many-windows}. | 895 | between the many windows layout and a simple layout with just the GUD |
| 896 | interaction 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, |
| 903 | either in the same frame or a different one. Select the buffers you | 899 | either in the same frame or a different one. Select the buffers you |
| 904 | want with the @samp{GUD->GDB-Windows} and @samp{GUD->GDB-Frames} | 900 | want by typing @code{M-x gdb-display-@var{buffertype}-buffer} or |
| 905 | sub-menus. If the menu-bar is unavailable, type @code{M-x | 901 | @code{M-x gdb-frame-@var{buffertype}-buffer}, where @var{buffertype} |
| 906 | gdb-display-@var{buffertype}-buffer} or @code{M-x | 902 | is the relevant buffer type, such as @samp{breakpoints}. You can do |
| 907 | gdb-frame-@var{buffertype}-buffer} respectively, where | 903 | the 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}, | 908 | session. However you need not do this if, after editing and |
| 913 | which will also kill all the buffers associated with the session. | 909 | re-compiling your source code within Emacs, you wish to continue |
| 914 | However you need not do this if, after editing and re-compiling your | 910 | debugging. When you restart execution, GDB automatically finds the |
| 915 | source code within Emacs, you wish continue debugging. When you | 911 | new executable. Keeping the GUD interaction buffer has the advantage |
| 916 | restart execution, GDB will automatically find your new executable. | 912 | of keeping the shell history as well as GDB's breakpoints. You do |
| 917 | Keeping the GUD buffer has the advantage of keeping the shell history | 913 | need to check that the breakpoints in recently edited source files are |
| 918 | as well as GDB's breakpoints. You do need to check that the | 914 | still in the right places. |
| 919 | breakpoints in recently edited source files are still in the right | ||
| 920 | places. | ||
| 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 | ||
| 928 | Many GDB commands can be entered using key bindings or the tool bar but | ||
| 929 | sometimes it is quicker to use the fringe. These commands either | ||
| 930 | manipulate breakpoints or control program execution. When there is no | ||
| 931 | fringe, you can use the margin but this is only present when the | ||
| 932 | source file already has a breakpoint. | ||
| 933 | |||
| 934 | You can click @kbd{Mouse-1} in the fringe or display margin of a | ||
| 935 | source buffer to set a breakpoint there and, on a graphical display, a | ||
| 936 | red bullet will appear on that line. If a breakpoint already exists | ||
| 937 | on that line, the same click will remove it. You can also enable or | ||
| 938 | disable a breakpoint by clicking @kbd{C-Mouse-1} on the bullet. | ||
| 939 | |||
| 940 | A solid arrow in the left fringe of a source buffer indicates the line | ||
| 941 | of the innermost frame where the debugged program has stopped. A | ||
| 942 | hollow arrow indicates the current execution line of higher level | ||
| 943 | frames. | ||
| 944 | |||
| 945 | If you drag the arrow in the fringe with @kbd{Mouse-1} | ||
| 946 | (@code{gdb-mouse-until}), execution will continue to the line where | ||
| 947 | you release the button, provided it is still in the same frame. | ||
| 948 | Alternatively, you can click @kbd{Mouse-3} at some point in the fringe | ||
| 949 | of 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 | ||
| 951 | executing the intermediate lines by clicking @kbd{C-Mouse-3}. This | ||
| 952 | command allows you to go backwards which can be useful for running | ||
| 953 | through code that has already executed, in order to examine its | ||
| 954 | execution in more detail. | ||
| 955 | 919 | ||
| 956 | @table @kbd | 920 | @table @asis |
| 957 | @item Mouse-1 | 921 | @item @kbd{Mouse-1} (in fringe) |
| 958 | Set or clear a breakpoint. | 922 | Set or clear a breakpoint on that line. |
| 959 | 923 | ||
| 960 | @item C-Mouse-1 | 924 | @item @kbd{C-Mouse-1} (in fringe) |
| 961 | Enable or disable a breakpoint. | 925 | Enable or disable a breakpoint on that line. |
| 962 | 926 | ||
| 963 | @item Mouse-3 | 927 | @item @kbd{Mouse-3} (in fringe) |
| 964 | Continue execution to here. | 928 | Continue execution to that line. |
| 965 | 929 | ||
| 966 | @item C-Mouse-3 | 930 | @item @kbd{C-Mouse-3} (in fringe) |
| 967 | Jump to here. | 931 | Jump to that line. |
| 968 | @end table | 932 | @end table |
| 969 | 933 | ||
| 970 | If 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 |
| 971 | execution stops in a frame for which there is no source code e.g after | 935 | a source buffer, to set a breakpoint on that line (@pxref{Fringes}). |
| 972 | an interrupt, then Emacs finds and displays the first frame further up | 936 | A red dot appears in the fringe, where you clicked. If a breakpoint |
| 973 | stack for which there is source. If it is @code{nil} then the source | 937 | already exists there, the click removes it. A @kbd{C-Mouse-1} click |
| 974 | buffer continues to display the last frame which maybe more useful, | 938 | enables or disables an existing breakpoint; a breakpoint that is |
| 975 | for example, when re-setting a breakpoint. | 939 | disabled, but not unset, is indicated by a gray dot. |
| 940 | |||
| 941 | On a text-only terminal, or when fringes are disabled, enabled | ||
| 942 | breakpoints are indicated with a @samp{B} character in the left margin | ||
| 943 | of 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 | ||
| 947 | line of the innermost frame where the debugged program has stopped. A | ||
| 948 | hollow arrow indicates the current execution line of a higher-level | ||
| 949 | frame. If you drag the arrow in the fringe with @kbd{Mouse-1}, that | ||
| 950 | causes execution to advance to the line where you release the button. | ||
| 951 | Alternatively, you can click @kbd{Mouse-3} in the fringe to advance to | ||
| 952 | that line. You can click @kbd{C-Mouse-3} in the fringe to jump to | ||
| 953 | that line without executing the intermediate lines. This command | ||
| 954 | allows you to go backwards, which can be useful for running through | ||
| 955 | code that has already executed, in order to examine its execution in | ||
| 956 | more 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 |
| 981 | catchpoints (@pxref{Breakpoints,,, gdb, The GNU debugger}). It has | 962 | catchpoints in the debugger session. @xref{Breakpoints,,, gdb, The |
| 982 | these special commands, which mostly apply to the @dfn{current | 963 | GNU debugger}. It provides the following commands, which mostly apply |
| 983 | breakpoint}, the breakpoint which point is on. | 964 | to 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 |
| 989 | Enable/disable current breakpoint (@code{gdb-toggle-breakpoint}). | 970 | Enable/disable current breakpoint (@code{gdb-toggle-breakpoint}). On |
| 990 | On a graphical display, this changes the color of a bullet in the | 971 | a graphical display, this changes the color of the dot in the fringe |
| 991 | margin of a source buffer at the relevant line. This is red when | 972 | of the source buffer at that line. The dot is red when the breakpoint |
| 992 | the breakpoint is enabled and gray when it is disabled. Text-only | 973 | is enabled, and gray when it is disabled. |
| 993 | terminals 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 |
| 998 | Delete the current breakpoint (@code{gdb-delete-breakpoint}). | 978 | Delete 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 |
| 1003 | Visit the source line for the current breakpoint | 983 | Visit 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)} |
| 1008 | Visit the source line for the breakpoint you click on. | 988 | Visit 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 |
| 1012 | When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer | 992 | When @code{gdb-many-windows} is non-@code{nil}, the GDB Breakpoints |
| 1013 | shares its window with the threads buffer. To switch from one to the | 993 | buffer shares its window with the GDB Threads buffer. To switch from |
| 1014 | other click with @kbd{Mouse-1} on the relevant button in the header | 994 | one to the other click with @kbd{Mouse-1} on the relevant button in |
| 1015 | line. If @code{gdb-show-threads-by-default} is non-@code{nil}, the | 995 | the header line. If @code{gdb-show-threads-by-default} is |
| 1016 | threads buffer, rather than the breakpoints buffer, is shown at start | 996 | non-@code{nil}, the GDB Threads buffer is the one shown by default. |
| 1017 | up. | ||
| 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 |
| 1023 | The threads buffer displays a summary of all threads currently in your | 1002 | The GDB Threads buffer displays a summary of the threads in the |
| 1024 | program (@pxref{Threads, Threads, Debugging programs with multiple | 1003 | debugged program. @xref{Threads, Threads, Debugging programs with |
| 1025 | threads, gdb, The GNU debugger}). Move point to any thread in the list | 1004 | multiple threads, gdb, The GNU debugger}. To select a thread, move |
| 1026 | and press @key{RET} to select it (@code{gdb-select-thread}) and | 1005 | point there and type @key{RET} (@code{gdb-select-thread}), or click on |
| 1027 | display the associated source in the primary source buffer. | 1006 | it with @kbd{Mouse-2}. This also displays the associated source |
| 1028 | Alternatively, click @kbd{Mouse-2} on a thread to select it. Contents | 1007 | buffer, and updates the contents of the other GDB buffers. |
| 1029 | of 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 |
| 1032 | fields included in threads buffer. | 1010 | fields 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 |
| 1037 | Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)} in | 1015 | Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)}. |
| 1038 | threads 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 |
| 1042 | Show arguments of thread top frames in threads buffer. | 1019 | Show 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 |
| 1046 | Show file information or library names in threads buffer. | 1023 | Show 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 |
| 1050 | Show addresses for thread frames in threads buffer. | 1027 | Show 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 |
| 1054 | simultaneously (in addition to buffers which show information for | 1031 | following commands from the GDB Threads buffer. |
| 1055 | currently selected thread) using the following keys from the threads | ||
| 1056 | buffer. | ||
| 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 |
| 1062 | Display disassembly buffer for the thread at current line. | 1037 | Display 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 |
| 1068 | Display stack buffer for the thread at current line. | 1043 | Display 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 |
| 1074 | Display locals buffer for the thread at current line. | 1049 | Display 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 |
| 1080 | Display registers buffer for the thread at current line. | 1055 | Display 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 | ||
| 1084 | Pressing their upper-case counterparts, @kbd{D}, @kbd{F} ,@kbd{L} and | 1059 | @noindent |
| 1085 | @kbd{R} displays the corresponding buffer in a new frame. | 1060 | Their upper-case counterparts, @kbd{D}, @kbd{F} ,@kbd{L} and @kbd{R}, |
| 1061 | display 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 |
| 1088 | thread, it becomes bound to that thread and keeps showing actual | 1064 | thread, it becomes bound to that thread and keeps showing actual |
| 1089 | information while you debug your program. Every GDB buffer contains a | 1065 | information while you debug your program. The mode indicator for each |
| 1090 | number of thread it shows information for in its mode name. Thread | 1066 | GDB buffer shows the number of thread it is showing information about. |
| 1091 | number is also included in the buffer name of bound buffers to prevent | 1067 | The thread number is also included in the buffer name of bound |
| 1092 | buffer names clashing. | 1068 | buffers. |
| 1093 | 1069 | ||
| 1094 | Further commands are available in the threads buffer which depend on the | 1070 | Further commands are available in the GDB Threads buffer which |
| 1095 | mode of GDB that is used for controlling execution of your program. | 1071 | depend on the mode of GDB that is used for controlling execution of |
| 1096 | (@pxref{Multithreaded Debugging, Stopping and Starting Multi-threaded Programs}). | 1072 | your 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 |
| 1102 | of the nested subroutine calls (@dfn{stack frames}) now active in the | 1078 | each of the nested subroutine calls (@dfn{stack frames}) in the |
| 1103 | program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}. | 1079 | debugger session. @xref{Backtrace,, Backtraces, gdb, The GNU |
| 1080 | debugger}. | ||
| 1104 | 1081 | ||
| 1105 | @findex gdb-frames-select | 1082 | @findex gdb-frames-select |
| 1106 | An 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 |
| 1107 | not present, the number of the selected frame is displayed in reverse | 1084 | arrow in the fringe. On text-only terminals, or when fringes are |
| 1108 | contrast. To select a frame in GDB, move point in the stack buffer to | 1085 | disabled, the selected stack frame is displayed in reverse contrast. |
| 1109 | that stack frame and type @key{RET} (@code{gdb-frames-select}), or click | 1086 | To 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 |
| 1111 | selecting a stack frame updates it to display the local variables of the | 1088 | also updates the Locals buffer |
| 1112 | new 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 | ||
| 1120 | If the variable @code{gdb-use-separate-io-buffer} is non-@code{nil}, | ||
| 1121 | the program being debugged takes its input and displays its output | ||
| 1122 | here. Otherwise it uses the GUD buffer for that. To toggle whether | ||
| 1123 | GUD mode uses this buffer, do @kbd{M-x gdb-use-separate-io-buffer}. | ||
| 1124 | This takes effect when you next restart the program you are debugging. | ||
| 1125 | |||
| 1126 | The history and replay commands from Shell mode are available here, | ||
| 1127 | as are the commands to send signals to the debugged program. | ||
| 1128 | @xref{Shell Mode}. | ||
| 1129 | |||
| 1130 | @item Locals Buffer | 1100 | @item Locals Buffer |
| 1131 | The locals buffer displays the values of local variables of the | 1101 | This buffer displays the values of local variables of the current |
| 1132 | current frame for simple data types (@pxref{Frame Info, Frame Info, | 1102 | frame for simple data types (@pxref{Frame Info, Frame Info, |
| 1133 | Information on a frame, gdb, The GNU debugger}). Press @key{RET} or | 1103 | Information on a frame, gdb, The GNU debugger}). Press @key{RET} or |
| 1134 | click @kbd{Mouse-2} on the value if you want to edit it. | 1104 | click @kbd{Mouse-2} on the value if you want to edit it. |
| 1135 | 1105 | ||
| 1136 | Arrays and structures display their type only. With GDB 6.4 or later, | 1106 | Arrays and structures display their type only. With GDB 6.4 or later, |
| 1137 | move point to their name and press @key{RET}, or alternatively click | 1107 | you 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 |
| 1139 | of GDB, use @kbd{Mouse-2} or @key{RET} on the type description | 1109 | GDB, 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 |
| 1144 | The registers buffer displays the values held by the registers | 1114 | This 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 |
| 1146 | click @kbd{Mouse-2} on a register if you want to edit its value. | 1116 | click @kbd{Mouse-2} on a register if you want to edit its value. With |
| 1147 | With GDB 6.4 or later, recently changed register values display with | 1117 | GDB 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}. |
| 1149 | press @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 |
| 1153 | The assembler buffer displays the current frame as machine code. An | 1121 | The 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 | ||
| 1168 | When @code{gdb-many-windows} is non-@code{nil}, the locals buffer | 1136 | When @code{gdb-many-windows} is non-@code{nil}, the locals buffer |
| 1169 | shares its window with the registers buffer, just like breakpoints | 1137 | shares its window with the registers buffer, just like breakpoints and |
| 1170 | and threads buffers. To switch from one to the other click with | 1138 | threads 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 | |||
| 1182 | specify a prefix argument, you can enter the variable name in the | 1150 | specify a prefix argument, you can enter the variable name in the |
| 1183 | minibuffer. | 1151 | minibuffer. |
| 1184 | 1152 | ||
| 1185 | Each watch expression is displayed in the speedbar. Complex data | 1153 | Each watch expression is displayed in the speedbar |
| 1186 | types, such as arrays, structures and unions are represented in a tree | 1154 | (@pxref{Speedbar}). Complex data types, such as arrays, structures |
| 1187 | format. Leaves and simple data types show the name of the expression | 1155 | and unions are represented in a tree format. Leaves and simple data |
| 1188 | and its value and, when the speedbar frame is selected, display the | 1156 | types show the name of the expression and its value and, when the |
| 1189 | type as a tooltip. Higher levels show the name, type and address | 1157 | speedbar frame is selected, display the type as a tooltip. Higher |
| 1190 | value for pointers and just the name and type otherwise. Root expressions | 1158 | levels show the name, type and address value for pointers and just the |
| 1191 | also display the frame address as a tooltip to help identify the frame | 1159 | name and type otherwise. Root expressions also display the frame |
| 1192 | in which they were defined. | 1160 | address as a tooltip to help identify the frame in which they were |
| 1161 | defined. | ||
| 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 |
| 1195 | press @key{SPC} on the tag to the left of the expression. Emacs asks | 1164 | press @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 | |||
| 1237 | screen Emacs frame. | 1206 | screen 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 | |||
| 1245 | In all-stop mode, whenever your program stops, @emph{all} threads of | ||
| 1246 | execution stop. Likewise, whenever you restart the program, all | ||
| 1247 | threads start executing. @xref{All-Stop Mode, , All-Stop Mode, gdb, | ||
| 1248 | The GNU debugger}. You can enable this behavior in Emacs by setting | ||
| 1249 | @code{gdb-non-stop-setting} to @code{nil} before starting a debugging | ||
| 1250 | session. | ||
| 1251 | |||
| 1252 | @subsubheading Non-stop Debugging | ||
| 1253 | @cindex Non-stop debugging in GDB | 1211 | @cindex Non-stop debugging in GDB |
| 1254 | 1212 | ||
| 1255 | For some multi-threaded targets, GDB supports a further mode of | 1213 | In GDB's @dfn{all-stop mode}, whenever your program stops, all |
| 1256 | operation in which you can examine stopped program threads in the | 1214 | execution threads stop. Likewise, whenever you restart the program, |
| 1257 | debugger while other threads continue to execute freely. | 1215 | all threads start executing. @xref{All-Stop Mode, , All-Stop Mode, |
| 1258 | @xref{Non-Stop Mode, , Non-Stop Mode, gdb, The GNU debugger}. | 1216 | gdb, The GNU debugger}. For some multi-threaded targets, GDB supports |
| 1259 | This is referred to as @dfn{non-stop} mode. | 1217 | a further mode of operation, called @dfn{non-stop mode}, in which you |
| 1260 | 1218 | can examine stopped program threads in the debugger while other | |
| 1261 | Versions of GDB prior to 7.0 do not support non-stop mode and it does | 1219 | threads continue to execute freely. @xref{Non-Stop Mode, , Non-Stop |
| 1262 | not work on all targets. In such cases, Emacs uses all-stop mode | 1220 | Mode, gdb, The GNU debugger}. Versions of GDB prior to 7.0 do not |
| 1263 | regardless of the value of @code{gdb-non-stop-setting}. | 1221 | support 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 |
| 1266 | If the variable @code{gdb-non-stop-setting} is non-@code{nil} (the | 1224 | The variable @code{gdb-non-stop-setting} determines whether Emacs |
| 1267 | default value), Emacs tries to start GDB in non-stop mode. Note that | 1225 | runs GDB in all-stop mode or non-stop mode. The default is @code{t}, |
| 1268 | GDB debugging session needs to be restarted for change of this setting | 1226 | which means it tries to use non-stop mode if that is available. If |
| 1269 | to take effect. | 1227 | you change the value to @code{nil}, or if non-stop mode is |
| 1228 | unavailable, Emacs runs GDB in all-stop mode. The variable takes | ||
| 1229 | effect when Emacs begins a debugging session; if you change its value, | ||
| 1230 | you should restart any active debugging session. | ||
| 1270 | 1231 | ||
| 1271 | @vindex gdb-switch-when-another-stopped | 1232 | @vindex gdb-switch-when-another-stopped |
| 1272 | When 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 |
| 1273 | that thread. It may be undesirable to allow switching of current | 1234 | thread. If you don't want Emacs to do this switch if another stopped |
| 1274 | thread when some other stopped thread is already selected. Set | 1235 | thread 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 |
| 1278 | Emacs can decide whether or not to switch to the stopped thread | 1239 | Emacs can decide whether or not to switch to the stopped thread |
| 1279 | depending on the reason which caused the stop. Customize | 1240 | depending 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 |
| 1281 | switch thread. | 1242 | a thread switch. |
| 1282 | 1243 | ||
| 1283 | @vindex gdb-stopped-hooks | 1244 | @vindex gdb-stopped-hooks |
| 1284 | The variable @code{gdb-stopped-hooks} allows you to execute your | 1245 | The variable @code{gdb-stopped-hooks} allows you to execute your |
| 1285 | functions whenever some thread stops. | 1246 | functions 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 | ||
| 1294 | When @code{gdb-gud-control-all-threads} is @code{t} (the default | 1255 | When @code{gdb-gud-control-all-threads} is @code{t} (the default |
| 1295 | value), interruption and continuation commands apply to all threads, | 1256 | value), interruption and continuation commands apply to all threads, |
| 1296 | so you can halt or continue all your threads with one command using | 1257 | so 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 |
| 1318 | selecting them. Hitting @kbd{i} in threads buffer interrupts thread | 1277 | selecting them. Hitting @kbd{i} in threads buffer interrupts thread |
| 1319 | under point, @kbd{c} continues it, @kbd{s} steps through. More such | 1278 | under point, @kbd{c} continues it, @kbd{s} steps through. More such |
| 1320 | commands may be added in the future. | 1279 | commands may be added in the future. |
| 1321 | 1280 | ||
| 1322 | Combined with creating bound buffers for any thread, this allows you | 1281 | Note that when you interrupt a thread, it stops with the |
| 1323 | to 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 | ||
| 1326 | received} 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 |
| 1328 | that thread. | 1284 | that 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 | ||