diff options
| -rw-r--r-- | man/building.texi | 533 |
1 files changed, 281 insertions, 252 deletions
diff --git a/man/building.texi b/man/building.texi index bc7ab649407..e3e3b5ac5a2 100644 --- a/man/building.texi +++ b/man/building.texi | |||
| @@ -90,23 +90,12 @@ above point, which remains at the end. If point is not at the end of | |||
| 90 | the buffer, it remains fixed while more compilation output is added at | 90 | the buffer, it remains fixed while more compilation output is added at |
| 91 | the end of the buffer. | 91 | the end of the buffer. |
| 92 | 92 | ||
| 93 | @cindex compilation buffer, keeping current position at the end | 93 | @cindex compilation buffer, keeping point at end |
| 94 | @vindex compilation-scroll-output | 94 | @vindex compilation-scroll-output |
| 95 | If you set the variable @code{compilation-scroll-output} to a | 95 | If you set the variable @code{compilation-scroll-output} to a |
| 96 | non-@code{nil} value, then the compilation buffer always scrolls to | 96 | non-@code{nil} value, then the compilation buffer always scrolls to |
| 97 | follow output as it comes in. | 97 | follow output as it comes in. |
| 98 | 98 | ||
| 99 | @findex kill-compilation | ||
| 100 | When the compiler process terminates, for whatever reason, the mode | ||
| 101 | line of the @samp{*compilation*} buffer changes to say @samp{exit} | ||
| 102 | (followed by the exit code, @samp{[0]} for a normal exit), or | ||
| 103 | @samp{signal} (if a signal terminated the process), instead of | ||
| 104 | @samp{run}. Starting a new compilation also kills any running | ||
| 105 | compilation, as only one can exist at any time. However, @kbd{M-x | ||
| 106 | compile} asks for confirmation before actually killing a compilation | ||
| 107 | that is running. You can also kill the compilation process with | ||
| 108 | @kbd{M-x kill-compilation}. | ||
| 109 | |||
| 110 | @findex recompile | 99 | @findex recompile |
| 111 | To rerun the last compilation with the same command, type @kbd{M-x | 100 | To rerun the last compilation with the same command, type @kbd{M-x |
| 112 | recompile}. This automatically reuses the compilation command from | 101 | recompile}. This automatically reuses the compilation command from |
| @@ -115,6 +104,25 @@ the last invocation of @kbd{M-x compile}. It also reuses the | |||
| 115 | directory, which is the directory in which the previous compilation | 104 | directory, which is the directory in which the previous compilation |
| 116 | was started. | 105 | was started. |
| 117 | 106 | ||
| 107 | When the compiler process terminates, for whatever reason, the mode | ||
| 108 | line of the @samp{*compilation*} buffer changes to say @samp{exit} | ||
| 109 | (followed by the exit code, @samp{[0]} for a normal exit), or | ||
| 110 | @samp{signal} (if a signal terminated the process), instead of | ||
| 111 | @samp{run}. | ||
| 112 | |||
| 113 | @findex kill-compilation | ||
| 114 | Starting a new compilation also kills any compilation | ||
| 115 | running in @samp{*compilation*}, as the buffer can only handle one | ||
| 116 | compilation at any time. However, @kbd{M-x compile} asks for | ||
| 117 | confirmation before actually killing a compilation that is running. | ||
| 118 | You can also kill the compilation process with @kbd{M-x | ||
| 119 | kill-compilation}. | ||
| 120 | |||
| 121 | If you want to run two compilations at once, you should start the | ||
| 122 | first one, then rename the @samp{*compilation*} buffer (perhaps using | ||
| 123 | @code{rename-uniquely}; @pxref{Misc Buffer}), and start the other | ||
| 124 | compilation. That will create a new @samp{*compilation*} buffer. | ||
| 125 | |||
| 118 | Emacs does not expect a compiler process to launch asynchronous | 126 | Emacs does not expect a compiler process to launch asynchronous |
| 119 | subprocesses; if it does, and they keep running after the main | 127 | subprocesses; if it does, and they keep running after the main |
| 120 | compiler process has terminated, Emacs may kill them or their output | 128 | compiler process has terminated, Emacs may kill them or their output |
| @@ -146,21 +154,23 @@ variable settings override the usual ones. | |||
| 146 | @node Compilation Mode | 154 | @node Compilation Mode |
| 147 | @section Compilation Mode | 155 | @section Compilation Mode |
| 148 | 156 | ||
| 149 | @findex compile-goto-error | ||
| 150 | @cindex Compilation mode | 157 | @cindex Compilation mode |
| 151 | @cindex mode, Compilation | 158 | @cindex mode, Compilation |
| 152 | The @samp{*compilation*} buffer uses a special major mode, Compilation | 159 | The @samp{*compilation*} buffer uses a special major mode, |
| 153 | mode, whose main feature is to provide a convenient way to look at the | 160 | Compilation mode, whose main feature is to provide a convenient way to |
| 154 | source line where the error happened. | 161 | visit the source line corresponding to an error message. These |
| 162 | commands are also available in other special buffers that list | ||
| 163 | locations in files, including those made by @kbd{M-x grep} and | ||
| 164 | @kbd{M-x occur}. | ||
| 155 | 165 | ||
| 156 | @table @kbd | 166 | @table @kbd |
| 157 | @item M-g M-n | 167 | @item M-g M-n |
| 158 | @itemx M-g n | 168 | @itemx M-g n |
| 159 | @itemx C-x ` | 169 | @itemx C-x ` |
| 160 | Visit the locus of the next compiler error message or @code{grep} match. | 170 | Visit the locus of the next error message or match. |
| 161 | @item M-g M-p | 171 | @item M-g M-p |
| 162 | @itemx M-g p | 172 | @itemx M-g p |
| 163 | Visit the locus of the previous compiler error message or @code{grep} match. | 173 | Visit the locus of the previous error message or match. |
| 164 | @item @key{RET} | 174 | @item @key{RET} |
| 165 | Visit the locus of the error message that point is on. | 175 | Visit the locus of the error message that point is on. |
| 166 | This command is used in the compilation buffer. | 176 | This command is used in the compilation buffer. |
| @@ -183,16 +193,17 @@ Toggle Next Error Follow minor mode, which makes cursor motion in the | |||
| 183 | compilation buffer produce automatic source display. | 193 | compilation buffer produce automatic source display. |
| 184 | @end table | 194 | @end table |
| 185 | 195 | ||
| 186 | @kindex M-g M-n | 196 | @findex compile-goto-error |
| 187 | @kindex M-g n | ||
| 188 | @kindex C-x ` | ||
| 189 | @findex next-error | ||
| 190 | You can visit the source for any particular error message by moving | 197 | You can visit the source for any particular error message by moving |
| 191 | point in the @samp{*compilation*} buffer to that error message and | 198 | point in the @samp{*compilation*} buffer to that error message and |
| 192 | typing @key{RET} (@code{compile-goto-error}). Alternatively, you can | 199 | typing @key{RET} (@code{compile-goto-error}). Alternatively, you can |
| 193 | click @kbd{Mouse-2} on the error message; you need not switch to the | 200 | click @kbd{Mouse-2} on the error message; you need not switch to the |
| 194 | @samp{*compilation*} buffer first. | 201 | @samp{*compilation*} buffer first. |
| 195 | 202 | ||
| 203 | @kindex M-g M-n | ||
| 204 | @kindex M-g n | ||
| 205 | @kindex C-x ` | ||
| 206 | @findex next-error | ||
| 196 | @vindex next-error-highlight | 207 | @vindex next-error-highlight |
| 197 | To parse the compiler error messages sequentially, type @kbd{C-x `} | 208 | To parse the compiler error messages sequentially, type @kbd{C-x `} |
| 198 | (@code{next-error}). The character following the @kbd{C-x} is the | 209 | (@code{next-error}). The character following the @kbd{C-x} is the |
| @@ -203,27 +214,30 @@ location of the error in another window. It also momentarily | |||
| 203 | highlights the relevant source line. You can change the behavior of | 214 | highlights the relevant source line. You can change the behavior of |
| 204 | this highlighting with the variable @code{next-error-highlight}. | 215 | this highlighting with the variable @code{next-error-highlight}. |
| 205 | 216 | ||
| 206 | The first time @kbd{C-x `} is used after the start of a compilation, | 217 | The first time @w{@kbd{C-x `}} is used after the start of a compilation, |
| 207 | it moves to the first error's location. Subsequent uses of @kbd{C-x `} | 218 | it moves to the first error's location. Subsequent uses of @kbd{C-x |
| 208 | advance down to subsequent errors. If you visit a specific error | 219 | `} advance down to subsequent errors. If you visit a specific error |
| 209 | message with @key{RET} or @kbd{Mouse-2}, subsequent @kbd{C-x `} | 220 | message with @key{RET} or @kbd{Mouse-2}, subsequent @w{@kbd{C-x `}} |
| 210 | commands advance from there. When @kbd{C-x `} gets to the end of the | 221 | commands advance from there. When @w{@kbd{C-x `}} gets to the end of the |
| 211 | buffer and finds no more error messages to visit, it fails and signals | 222 | buffer and finds no more error messages to visit, it fails and signals |
| 212 | an Emacs error. | 223 | an Emacs error. @w{@kbd{C-u C-x `}} starts scanning from the beginning of |
| 224 | the compilation buffer, and goes to the first error's location. | ||
| 213 | 225 | ||
| 214 | @vindex compilation-skip-threshold | 226 | @vindex compilation-skip-threshold |
| 215 | By default, @kbd{C-x `} skips less important messages. The variable | 227 | By default, @w{@kbd{C-x `}} skips less important messages. The variable |
| 216 | @code{compilation-skip-threshold} controls this. If its value is 2, | 228 | @code{compilation-skip-threshold} controls this. If its value is 2, |
| 217 | @kbd{C-x `} skips anything less than error, 1 skips anything less | 229 | @w{@kbd{C-x `}} skips anything less than error, 1 skips anything less |
| 218 | than warning, and 0 doesn't skip any messages. | 230 | than warning, and 0 doesn't skip any messages. The default is 1. |
| 219 | 231 | ||
| 220 | When the left fringe is displayed, an arrow points to the | 232 | When the window has a left fringe, an arrow in the fringe points to |
| 221 | current message in the compilation buffer. The variable | 233 | the current message in the compilation buffer. The variable |
| 222 | @code{compilation-context-lines} controls the number of lines of | 234 | @code{compilation-context-lines} controls the number of lines of |
| 223 | leading context in the window before the current message. If it is | 235 | leading context to display before the current message. Going to an |
| 224 | @code{nil} and the left fringe is displayed, the window doesn't | 236 | error message location scrolls the @samp{*compilation*} buffer to put |
| 225 | scroll. If there is no left fringe, no arrow is displayed and a value | 237 | the message that far down from the top. The value @code{nil} is |
| 226 | of @code{nil} means display the message at the top of the window. | 238 | special: if there's a left fringe, the window doesn't scroll at all |
| 239 | if the message is already visible. If there is no left fringe, | ||
| 240 | @code{nil} means display the message at the top of the window. | ||
| 227 | 241 | ||
| 228 | If you're not in the compilation buffer when you run | 242 | If you're not in the compilation buffer when you run |
| 229 | @code{next-error}, Emacs will look for a buffer that contains error | 243 | @code{next-error}, Emacs will look for a buffer that contains error |
| @@ -233,9 +247,6 @@ then at the current buffer. Finally, Emacs looks at all the remaining | |||
| 233 | buffers. @code{next-error} signals an error if it can't find any such | 247 | buffers. @code{next-error} signals an error if it can't find any such |
| 234 | buffer. | 248 | buffer. |
| 235 | 249 | ||
| 236 | @kbd{C-u C-x `} starts scanning from the beginning of the compilation | ||
| 237 | buffer. This is one way to process the same set of errors again. | ||
| 238 | |||
| 239 | @vindex compilation-error-regexp-alist | 250 | @vindex compilation-error-regexp-alist |
| 240 | @vindex grep-regexp-alist | 251 | @vindex grep-regexp-alist |
| 241 | To parse messages from the compiler, Compilation mode uses the | 252 | To parse messages from the compiler, Compilation mode uses the |
| @@ -280,28 +291,28 @@ files by FTP (@pxref{File Names}). | |||
| 280 | @node Compilation Shell | 291 | @node Compilation Shell |
| 281 | @section Subshells for Compilation | 292 | @section Subshells for Compilation |
| 282 | 293 | ||
| 283 | Emacs uses a shell to run the compilation command, but specifies | 294 | Emacs uses a shell to run the compilation command, but specifies the |
| 284 | the option for a noninteractive shell. This means, in particular, that | 295 | option for a noninteractive shell. This means, in particular, that |
| 285 | the shell should start with no prompt. If you find your usual shell | 296 | the shell should start with no prompt. If you find your usual shell |
| 286 | prompt making an unsightly appearance in the @samp{*compilation*} | 297 | prompt making an unsightly appearance in the @samp{*compilation*} |
| 287 | buffer, it means you have made a mistake in your shell's init file by | 298 | buffer, it means you have made a mistake in your shell's init file by |
| 288 | setting the prompt unconditionally. (This init file's name may be | 299 | setting the prompt unconditionally. (This init file's name may be |
| 289 | @file{.bashrc}, @file{.profile}, @file{.cshrc}, @file{.shrc}, or various | 300 | @file{.bashrc}, @file{.profile}, @file{.cshrc}, @file{.shrc}, or |
| 290 | other things, depending on the shell you use.) The shell init file | 301 | various other things, depending on the shell you use.) The shell init |
| 291 | should set the prompt only if there already is a prompt. In csh, here | 302 | file should set the prompt only if there already is a prompt. Here's |
| 292 | is how to do it: | 303 | how to do it in bash: |
| 293 | 304 | ||
| 294 | @example | 305 | @example |
| 295 | if ($?prompt) set prompt = @dots{} | 306 | if [ "$@{PS1+set@}" = set ] |
| 307 | then PS1=@dots{} | ||
| 308 | fi | ||
| 296 | @end example | 309 | @end example |
| 297 | 310 | ||
| 298 | @noindent | 311 | @noindent |
| 299 | And here's how to do it in bash: | 312 | And here's how to do it in csh: |
| 300 | 313 | ||
| 301 | @example | 314 | @example |
| 302 | if [ "$@{PS1+set@}" = set ] | 315 | if ($?prompt) set prompt = @dots{} |
| 303 | then PS1=@dots{} | ||
| 304 | fi | ||
| 305 | @end example | 316 | @end example |
| 306 | 317 | ||
| 307 | There may well be other things that your shell's init file | 318 | There may well be other things that your shell's init file |
| @@ -335,18 +346,18 @@ Kill the running @code{grep} subprocess. | |||
| 335 | @end table | 346 | @end table |
| 336 | 347 | ||
| 337 | @findex grep | 348 | @findex grep |
| 338 | To run @code{grep}, type @kbd{M-x grep}, then enter a command line that | 349 | To run @code{grep}, type @kbd{M-x grep}, then enter a command line |
| 339 | specifies how to run @code{grep}. Use the same arguments you would give | 350 | that specifies how to run @code{grep}. Use the same arguments you |
| 340 | @code{grep} when running it normally: a @code{grep}-style regexp | 351 | would give @code{grep} when running it normally: a @code{grep}-style |
| 341 | (usually in single-quotes to quote the shell's special characters) | 352 | regexp (usually in single-quotes to quote the shell's special |
| 342 | followed by file names, which may use wildcards. If you specify a | 353 | characters) followed by file names, which may use wildcards. If you |
| 343 | prefix argument for @kbd{M-x grep}, it figures out the tag | 354 | specify a prefix argument for @kbd{M-x grep}, it detects the tag |
| 344 | (@pxref{Tags}) around point, and puts that into the default | 355 | (@pxref{Tags}) around point, and puts that into the default |
| 345 | @code{grep} command. | 356 | @code{grep} command. |
| 346 | 357 | ||
| 347 | The output from @code{grep} goes in the @samp{*grep*} buffer. You | 358 | The output from @code{grep} goes in the @samp{*grep*} buffer. You |
| 348 | can find the corresponding lines in the original files using @kbd{C-x | 359 | can find the corresponding lines in the original files using @w{@kbd{C-x |
| 349 | `}, @key{RET}, and so forth, just like compilation errors. | 360 | `}}, @key{RET}, and so forth, just like compilation errors. |
| 350 | 361 | ||
| 351 | Some grep programs accept a @samp{--color} option to output special | 362 | Some grep programs accept a @samp{--color} option to output special |
| 352 | markers around matches for the purpose of highlighting. You can make | 363 | markers around matches for the purpose of highlighting. You can make |
| @@ -403,12 +414,11 @@ Flymake, flymake, The Flymake Manual}. | |||
| 403 | @c Do you believe in GUD? | 414 | @c Do you believe in GUD? |
| 404 | The GUD (Grand Unified Debugger) library provides an interface to | 415 | The GUD (Grand Unified Debugger) library provides an interface to |
| 405 | various symbolic debuggers from within Emacs. We recommend the | 416 | various symbolic debuggers from within Emacs. We recommend the |
| 406 | debugger GDB, which is free software, but you can also run DBX, SDB or | 417 | debugger GDB, which is free software, but GUD can also run DBX, SDB or |
| 407 | XDB if you have them. GUD can also serve as an interface to Perl's | 418 | XDB. GUD can also serve as an interface to Perl's debugging mode, the |
| 408 | debugging mode, the Python debugger PDB, the bash debugger, and to | 419 | Python debugger PDB, the Bash debugger, and to JDB, the Java Debugger. |
| 409 | JDB, the Java Debugger. @xref{Debugging,, The Lisp Debugger, elisp, | 420 | @xref{Debugging,, The Lisp Debugger, elisp, the Emacs Lisp Reference |
| 410 | the Emacs Lisp Reference Manual}, for information on debugging Emacs | 421 | Manual}, for information on debugging Emacs Lisp programs. |
| 411 | Lisp programs. | ||
| 412 | 422 | ||
| 413 | @menu | 423 | @menu |
| 414 | * Starting GUD:: How to start a debugger subprocess. | 424 | * Starting GUD:: How to start a debugger subprocess. |
| @@ -429,24 +439,27 @@ to a particular debugger program. | |||
| 429 | @table @kbd | 439 | @table @kbd |
| 430 | @item M-x gdb @key{RET} @var{file} @key{RET} | 440 | @item M-x gdb @key{RET} @var{file} @key{RET} |
| 431 | @findex gdb | 441 | @findex gdb |
| 432 | Run GDB as a subprocess of Emacs. By default, this operates in | 442 | Run GDB as a subprocess of Emacs. By default, this uses an IDE-like |
| 433 | graphical mode; @xref{GDB Graphical Interface}. Graphical mode | 443 | graphical interface; see @ref{GDB Graphical Interface}. Only GDB |
| 434 | does not support any other debuggers. | 444 | works with the graphical interface. |
| 435 | 445 | ||
| 436 | @item M-x dbx @key{RET} @var{file} @key{RET} | 446 | @item M-x dbx @key{RET} @var{file} @key{RET} |
| 437 | @findex dbx | 447 | @findex dbx |
| 438 | Similar, but run DBX instead of GDB. | 448 | Run DBX as a subprocess of Emacs. Since Emacs does not implement a |
| 449 | graphical interface for DBX, communication with DBX works by typing | ||
| 450 | commands in the GUD interaction buffer. The same is true for all | ||
| 451 | the other supported debuggers. | ||
| 439 | 452 | ||
| 440 | @item M-x xdb @key{RET} @var{file} @key{RET} | 453 | @item M-x xdb @key{RET} @var{file} @key{RET} |
| 441 | @findex xdb | 454 | @findex xdb |
| 442 | @vindex gud-xdb-directories | 455 | @vindex gud-xdb-directories |
| 443 | Similar, but run XDB instead of GDB. Use the variable | 456 | Similar, but run XDB. Use the variable |
| 444 | @code{gud-xdb-directories} to specify directories to search for source | 457 | @code{gud-xdb-directories} to specify directories to search for source |
| 445 | files. | 458 | files. |
| 446 | 459 | ||
| 447 | @item M-x sdb @key{RET} @var{file} @key{RET} | 460 | @item M-x sdb @key{RET} @var{file} @key{RET} |
| 448 | @findex sdb | 461 | @findex sdb |
| 449 | Similar, but run SDB instead of GDB. | 462 | Similar, but run SDB. |
| 450 | 463 | ||
| 451 | Some versions of SDB do not mention source file names in their | 464 | Some versions of SDB do not mention source file names in their |
| 452 | messages. When you use them, you need to have a valid tags table | 465 | messages. When you use them, you need to have a valid tags table |
| @@ -484,27 +497,25 @@ allowed. GUD assumes that the first argument not starting with a | |||
| 484 | @subsection Debugger Operation | 497 | @subsection Debugger Operation |
| 485 | 498 | ||
| 486 | @cindex fringes, and current execution line in GUD | 499 | @cindex fringes, and current execution line in GUD |
| 487 | When you run a debugger with GUD, the debugger uses an Emacs buffer | 500 | When you run a debugger with GUD using the textual interface, the |
| 488 | for its ordinary input and output. This is called the GUD buffer. The | 501 | debugger uses an Emacs buffer for its ordinary input and output. This |
| 489 | debugger displays the source files of the program by visiting them in | 502 | is called the GUD buffer. Input and output from the program you are |
| 490 | Emacs buffers. An arrow (@samp{=>}) in one of these buffers indicates | 503 | debugging also use this buffer. |
| 491 | the current execution line.@footnote{Under a window system, the arrow | 504 | |
| 492 | appears in the left fringe of the Emacs window.} Moving point in this | 505 | The debugger displays the source files of the program by visiting |
| 493 | buffer does not move the arrow. | 506 | them in Emacs buffers. An arrow in the left fringe indicates the |
| 507 | current execution line.@footnote{On a text-only terminal, the arrow | ||
| 508 | appears as @samp{=>} and overlays the first two text columns.} Moving | ||
| 509 | point in this buffer does not move the arrow. The arrow is not part | ||
| 510 | of the file's text; it appears only on the screen. | ||
| 494 | 511 | ||
| 495 | You can start editing these source files at any time in the buffers | 512 | You can start editing these source files at any time in the buffers |
| 496 | that display them. The arrow is not part of the file's | 513 | that display them. If you do modify a source file, keep in mind that |
| 497 | text; it appears only on the screen. If you do modify a source file, | 514 | inserting or deleting lines will throw off the arrow's positioning; |
| 498 | keep in mind that inserting or deleting lines will throw off the arrow's | 515 | GUD has no way of figuring out which line corresponded before your |
| 499 | positioning; GUD has no way of figuring out which line corresponded | 516 | changes to the line number in a debugger message. Also, you'll |
| 500 | before your changes to the line number in a debugger message. Also, | 517 | typically have to recompile and restart the program for your changes |
| 501 | you'll typically have to recompile and restart the program for your | 518 | to be reflected in the debugger's tables. |
| 502 | changes to be reflected in the debugger's tables. | ||
| 503 | |||
| 504 | If you wish, you can control your debugger process entirely through the | ||
| 505 | debugger buffer, which uses a variant of Shell mode. All the usual | ||
| 506 | commands for your debugger are available, and you can use the Shell mode | ||
| 507 | history commands to repeat them. @xref{Shell Mode}. | ||
| 508 | 519 | ||
| 509 | @cindex tooltips with GUD | 520 | @cindex tooltips with GUD |
| 510 | @vindex tooltip-gud-modes | 521 | @vindex tooltip-gud-modes |
| @@ -521,23 +532,30 @@ the list @code{gud-tooltip-modes}. If the variable | |||
| 521 | @code{gud-tooltip-echo-area} is non-@code{nil} then the variable's | 532 | @code{gud-tooltip-echo-area} is non-@code{nil} then the variable's |
| 522 | value is displayed in the echo area. | 533 | value is displayed in the echo area. |
| 523 | 534 | ||
| 524 | With GDB in text command mode (@pxref{GDB Graphical Interface}), | 535 | GUD tooltips are disabled when you use GDB in text command mode |
| 525 | it is possible that use of GUD tooltips can cause a function to be | 536 | (@pxref{GDB Graphical Interface}), because displaying an expression's |
| 526 | called with harmful side-effects. In this case, Emacs disables | 537 | value in GDB can sometimes expand a macro and result in a side effect |
| 527 | them. | 538 | that interferes with the program's operation. The GDB graphical |
| 539 | interface supports GUD tooltips and assures they will not cause side | ||
| 540 | effects. | ||
| 528 | 541 | ||
| 529 | @node Commands of GUD | 542 | @node Commands of GUD |
| 530 | @subsection Commands of GUD | 543 | @subsection Commands of GUD |
| 531 | 544 | ||
| 532 | The GUD interaction buffer uses a variant of Shell mode, so the | 545 | The GUD interaction buffer uses a variant of Shell mode, so the |
| 533 | commands of Shell mode are available (@pxref{Shell Mode}). GUD mode | 546 | Emacs commands of Shell mode are available (@pxref{Shell Mode}). All |
| 534 | also provides commands for setting and clearing breakpoints, for | 547 | the usual commands for your debugger are available, and you can use |
| 535 | selecting stack frames, and for stepping through the program. These | 548 | the Shell mode history commands to repeat them. If you wish, you can |
| 536 | commands are available both in the GUD buffer and globally, but with | 549 | control your debugger process entirely through this buffer. |
| 537 | different key bindings. It also has its own tool bar from which you | 550 | |
| 538 | can invoke the more common commands by clicking on the appropriate | 551 | GUD mode also provides commands for setting and clearing |
| 539 | icon. This is particularly useful for repetitive commands like | 552 | breakpoints, for selecting stack frames, and for stepping through the |
| 540 | gud-next and gud-step and allows the user to hide the GUD buffer. | 553 | program. These commands are available both in the GUD buffer and |
| 554 | globally, but with different key bindings. It also has its own tool | ||
| 555 | bar from which you can invoke the more common commands by clicking on | ||
| 556 | the appropriate icon. This is particularly useful for repetitive | ||
| 557 | commands like @code{gud-next} and @code{gud-step}, and allows you to | ||
| 558 | keep the GUD buffer hidden. | ||
| 541 | 559 | ||
| 542 | The breakpoint commands are normally used in source file buffers, | 560 | The breakpoint commands are normally used in source file buffers, |
| 543 | because that is the easiest way to specify where to set or clear the | 561 | because that is the easiest way to specify where to set or clear the |
| @@ -550,7 +568,7 @@ Set a breakpoint on the source line that point is on. | |||
| 550 | @end table | 568 | @end table |
| 551 | 569 | ||
| 552 | @kindex C-x C-a @r{(GUD)} | 570 | @kindex C-x C-a @r{(GUD)} |
| 553 | Here are the other special commands provided by GUD. The keys | 571 | Here are the other special commands provided by GUD@. The keys |
| 554 | starting with @kbd{C-c} are available only in the GUD interaction | 572 | starting with @kbd{C-c} are available only in the GUD interaction |
| 555 | buffer. The key bindings that start with @kbd{C-x C-a} are available in | 573 | buffer. The key bindings that start with @kbd{C-x C-a} are available in |
| 556 | the GUD interaction buffer and also in source files. | 574 | the GUD interaction buffer and also in source files. |
| @@ -606,9 +624,9 @@ buffer, it applies to the line where the program last stopped. | |||
| 606 | @kindex C-c C-t @r{(GUD)} | 624 | @kindex C-c C-t @r{(GUD)} |
| 607 | @itemx C-x C-a C-t | 625 | @itemx C-x C-a C-t |
| 608 | @findex gud-tbreak | 626 | @findex gud-tbreak |
| 609 | Set a temporary breakpoint on the current source line, if any. | 627 | Set a temporary breakpoint on the current source line, if any |
| 610 | If you use this command in the GUD interaction buffer, | 628 | (@code{gud-tbreak}). If you use this command in the GUD interaction |
| 611 | it applies to the line where the program last stopped. | 629 | buffer, it applies to the line where the program last stopped. |
| 612 | @end table | 630 | @end table |
| 613 | 631 | ||
| 614 | The above commands are common to all supported debuggers. If you are | 632 | The above commands are common to all supported debuggers. If you are |
| @@ -620,14 +638,14 @@ using GDB or (some versions of) DBX, these additional commands are available: | |||
| 620 | @itemx C-x C-a < | 638 | @itemx C-x C-a < |
| 621 | @findex gud-up | 639 | @findex gud-up |
| 622 | Select the next enclosing stack frame (@code{gud-up}). This is | 640 | Select the next enclosing stack frame (@code{gud-up}). This is |
| 623 | equivalent to the @samp{up} command. | 641 | equivalent to the GDB command @samp{up}. |
| 624 | 642 | ||
| 625 | @item C-c > | 643 | @item C-c > |
| 626 | @kindex C-c > @r{(GUD)} | 644 | @kindex C-c > @r{(GUD)} |
| 627 | @itemx C-x C-a > | 645 | @itemx C-x C-a > |
| 628 | @findex gud-down | 646 | @findex gud-down |
| 629 | Select the next inner stack frame (@code{gud-down}). This is | 647 | Select the next inner stack frame (@code{gud-down}). This is |
| 630 | equivalent to the @samp{down} command. | 648 | equivalent to the GDB command @samp{down}. |
| 631 | @end table | 649 | @end table |
| 632 | 650 | ||
| 633 | If you are using GDB, these additional key bindings are available: | 651 | If you are using GDB, these additional key bindings are available: |
| @@ -643,29 +661,28 @@ Start execution of the program (@code{gud-run}). | |||
| 643 | @kindex C-c C-u @r{(GUD)} | 661 | @kindex C-c C-u @r{(GUD)} |
| 644 | @itemx C-x C-a C-u | 662 | @itemx C-x C-a C-u |
| 645 | @findex gud-until | 663 | @findex gud-until |
| 646 | Continue execution to the current line. The program will run until | 664 | Continue execution to the current line (@code{gud-until}). The |
| 647 | it hits a breakpoint, terminates, gets a signal that the debugger is | 665 | program will run until it hits a breakpoint, terminates, gets a signal |
| 648 | checking for, or reaches the line on which the cursor currently sits | 666 | that the debugger is checking for, or reaches the line on which the |
| 649 | (@code{gud-until}). | 667 | cursor currently sits. |
| 650 | 668 | ||
| 651 | @item @key{TAB} | 669 | @item @key{TAB} |
| 652 | @kindex TAB @r{(GUD)} | 670 | @kindex TAB @r{(GUD)} |
| 653 | @findex gud-gdb-complete-command | 671 | @findex gud-gdb-complete-command |
| 654 | With GDB, complete a symbol name (@code{gud-gdb-complete-command}). | 672 | With GDB, complete a symbol name (@code{gud-gdb-complete-command}). |
| 655 | This key is available only in the GUD interaction buffer, and requires | 673 | This key is available only in the GUD interaction buffer. |
| 656 | GDB versions 4.13 and later. | ||
| 657 | 674 | ||
| 658 | @item C-c C-f | 675 | @item C-c C-f |
| 659 | @kindex C-c C-f @r{(GUD)} | 676 | @kindex C-c C-f @r{(GUD)} |
| 660 | @itemx C-x C-a C-f | 677 | @itemx C-x C-a C-f |
| 661 | @findex gud-finish | 678 | @findex gud-finish |
| 662 | Run the program until the selected stack frame returns (or until it | 679 | Run the program until the selected stack frame returns or |
| 663 | stops for some other reason). | 680 | stops for some other reason (@code{gud-finish}). |
| 664 | 681 | ||
| 665 | @item C-x C-a C-j | 682 | @item C-x C-a C-j |
| 666 | @kindex C-x C-a C-j @r{(GUD)} | 683 | @kindex C-x C-a C-j @r{(GUD)} |
| 667 | @findex gud-jump | 684 | @findex gud-jump |
| 668 | Only useful in a source buffer, (@code{gud-jump}) transfers the | 685 | Only useful in a source buffer, @code{gud-jump} transfers the |
| 669 | program's execution point to the current line. In other words, the | 686 | program's execution point to the current line. In other words, the |
| 670 | next line that the program executes will be the one where you gave the | 687 | next line that the program executes will be the one where you gave the |
| 671 | command. If the new execution line is in a different function from | 688 | command. If the new execution line is in a different function from |
| @@ -691,11 +708,13 @@ Instead, type @kbd{C-q @key{TAB}} to enter a tab. | |||
| 691 | @vindex perldb-mode-hook | 708 | @vindex perldb-mode-hook |
| 692 | @vindex pdb-mode-hook | 709 | @vindex pdb-mode-hook |
| 693 | @vindex jdb-mode-hook | 710 | @vindex jdb-mode-hook |
| 711 | @vindex bashdb-mode-hook | ||
| 694 | On startup, GUD runs one of the following hooks: @code{gdb-mode-hook}, | 712 | On startup, GUD runs one of the following hooks: @code{gdb-mode-hook}, |
| 695 | if you are using GDB; @code{dbx-mode-hook}, if you are using DBX; | 713 | if you are using GDB; @code{dbx-mode-hook}, if you are using DBX; |
| 696 | @code{sdb-mode-hook}, if you are using SDB; @code{xdb-mode-hook}, if you | 714 | @code{sdb-mode-hook}, if you are using SDB; @code{xdb-mode-hook}, if you |
| 697 | are using XDB; @code{perldb-mode-hook}, for Perl debugging mode; | 715 | are using XDB; @code{perldb-mode-hook}, for Perl debugging mode; |
| 698 | @code{pdb-mode-hook}, for PDB; @code{jdb-mode-hook}, for JDB. You can | 716 | @code{pdb-mode-hook}, for PDB; @code{jdb-mode-hook}, for JDB; |
| 717 | @code{bashdb-mode-hook}, for the Bash debugger. You can | ||
| 699 | use these hooks to define custom key bindings for the debugger | 718 | use these hooks to define custom key bindings for the debugger |
| 700 | interaction buffer. @xref{Hooks}. | 719 | interaction buffer. @xref{Hooks}. |
| 701 | 720 | ||
| @@ -750,37 +769,37 @@ ignores any numeric argument. | |||
| 750 | @node GDB Graphical Interface | 769 | @node GDB Graphical Interface |
| 751 | @subsection GDB Graphical Interface | 770 | @subsection GDB Graphical Interface |
| 752 | 771 | ||
| 753 | @findex gdb-mouse-set-clear-breakpoint | ||
| 754 | @findex gdb-mouse-toggle-breakpoint | ||
| 755 | By default, the command @code{gdb} starts GDB using a graphical | 772 | By default, the command @code{gdb} starts GDB using a graphical |
| 756 | interface where you view and control the program's data using Emacs | 773 | interface, using Emacs windows for display program state information. |
| 757 | windows. You can still interact with GDB through the GUD buffer, but | 774 | In effect, this makes Emacs into an IDE (interactive development |
| 758 | the point of this mode is that you can do it through menus and clicks, | 775 | environment). With it, you do not need to use textual GDB commands; |
| 759 | without needing to know GDB commands. For example, you can click | 776 | you can control the debugging session with the mouse. |
| 760 | @kbd{Mouse-1} in the fringe or display margin of a source buffer to | 777 | |
| 761 | set a breakpoint there and, on a graphical display, a red bullet will | 778 | @c @findex gdb-mouse-set-clear-breakpoint |
| 762 | appear. If a breakpoint already exists on that line, this action will | 779 | @c @findex gdb-mouse-toggle-breakpoint |
| 763 | remove it. You can also enable or disable a breakpoint by clicking | 780 | For example, you can click @kbd{Mouse-1} in the fringe or display |
| 764 | @kbd{Mouse-3} on the bullet. If you drag the debugger arrow in the | 781 | margin of a source buffer to set a breakpoint there and, on a |
| 765 | fringe with @kbd{Mouse-1}, execution will continue to the line where | 782 | graphical display, a red bullet will appear on that line. If a |
| 766 | you release the button, provided it is still in the same frame | 783 | breakpoint already exists on that line, the same click will remove it. |
| 767 | (@code{gdb-mouse-until}). Alternatively, you can click @kbd{Mouse-2} | 784 | You can also enable or disable a breakpoint by clicking @kbd{Mouse-3} |
| 768 | at some point in the fringe of this buffer and execution will advance | 785 | on the bullet. If you drag the debugger arrow in the fringe with |
| 769 | to there. | 786 | @kbd{Mouse-1} (@code{gdb-mouse-until}), execution will continue to the |
| 770 | 787 | line where you release the button, provided it is still in the same | |
| 771 | This mode requires that GDB think that the screen size is unlimited, | 788 | frame. Alternatively, you can click @kbd{Mouse-2} at some point in |
| 772 | and sets the height and width accordingly. For correct operation it | 789 | the fringe of this buffer and execution will advance to there. |
| 773 | is important that you don't change these values during the session. | 790 | |
| 791 | This mode requires telling GDB that its ``screen size'' is | ||
| 792 | unlimited, so it sets the height and width accordingly. For correct | ||
| 793 | operation you must not change these values during the GDB session. | ||
| 774 | 794 | ||
| 775 | @vindex gud-gdb-command-name | 795 | @vindex gud-gdb-command-name |
| 776 | @findex gdba | 796 | @findex gdba |
| 777 | You can also run GDB in text command mode, which creates a buffer | 797 | You can also run GDB in text command mode, like other debuggers. To |
| 778 | for input and output to GDB. To do this, set | 798 | do this, set @code{gud-gdb-command-name} to @code{"gdb --fullname"} or |
| 779 | @code{gud-gdb-command-name} to @code{"gdb --fullname"} or edit the | 799 | edit the startup command in the minibuffer to say that. You need to |
| 780 | startup command in the minibuffer to say that. You need to do use | 800 | do use text command mode to run multiple debugging sessions within one |
| 781 | text command mode to run multiple debugging sessions within one Emacs | 801 | Emacs session. If you have customized @code{gud-gdb-command-name} in |
| 782 | session. If you have customized @code{gud-gdb-command-name} in that | 802 | that way, you can use @kbd{M-x gdba} to invoke GDB in graphical mode. |
| 783 | way, then you can use @kbd{M-x gdba} to invoke GDB in graphical mode. | ||
| 784 | 803 | ||
| 785 | @menu | 804 | @menu |
| 786 | * GDB User Interface Layout:: Control the number of displayed buffers. | 805 | * GDB User Interface Layout:: Control the number of displayed buffers. |
| @@ -795,19 +814,16 @@ way, then you can use @kbd{M-x gdba} to invoke GDB in graphical mode. | |||
| 795 | @subsubsection GDB User Interface Layout | 814 | @subsubsection GDB User Interface Layout |
| 796 | @cindex GDB User Interface layout | 815 | @cindex GDB User Interface layout |
| 797 | 816 | ||
| 798 | @findex gdb-many-windows | ||
| 799 | @vindex gdb-many-windows | 817 | @vindex gdb-many-windows |
| 818 | If the variable @code{gdb-many-windows} is @code{nil} (the default | ||
| 819 | value) then @kbd{M-x gdb} normally displays only the GUD buffer. | ||
| 820 | However, if the variable @code{gdb-show-main} is also non-@code{nil}, | ||
| 821 | it starts with two windows: one displaying the GUD buffer, and the | ||
| 822 | other showing the source for the @code{main} function of the program | ||
| 823 | you are debugging. | ||
| 800 | 824 | ||
| 801 | If the variable @code{gdb-many-windows} is @code{nil} (the default | 825 | If @code{gdb-many-windows} is non-@code{nil}, then @kbd{M-x gdb} |
| 802 | value) then gdb just pops up the GUD buffer unless the variable | 826 | displays the following frame layout: |
| 803 | @code{gdb-show-main} is non-@code{nil}. In this case it starts with | ||
| 804 | two windows: one displaying the GUD buffer and the other with the | ||
| 805 | source file with the main routine of the inferior. | ||
| 806 | |||
| 807 | If @code{gdb-many-windows} is non-@code{nil}, regardless of the value of | ||
| 808 | @code{gdb-show-main}, the layout below will appear unless | ||
| 809 | @code{gdb-use-inferior-io-buffer} is @code{nil}. In this case the | ||
| 810 | source buffer occupies the full width of the frame. | ||
| 811 | 827 | ||
| 812 | @example | 828 | @example |
| 813 | +--------------------------------+--------------------------------+ | 829 | +--------------------------------+--------------------------------+ |
| @@ -825,121 +841,131 @@ source buffer occupies the full width of the frame. | |||
| 825 | +--------------------------------+--------------------------------+ | 841 | +--------------------------------+--------------------------------+ |
| 826 | @end example | 842 | @end example |
| 827 | 843 | ||
| 828 | To toggle this layout, do @kbd{M-x gdb-many-windows}. | 844 | However, if @code{gdb-use-inferior-io-buffer} is @code{nil}, the I/O |
| 845 | buffer does not appear and the source buffer occupies the full width | ||
| 846 | of the frame. | ||
| 829 | 847 | ||
| 830 | @findex gdb-restore-windows | 848 | @findex gdb-restore-windows |
| 831 | If you change the window layout, for example, while editing and | 849 | If you change the window layout, for example, while editing and |
| 832 | re-compiling your program, then you can restore it with the command | 850 | re-compiling your program, then you can restore this standard window |
| 833 | @code{gdb-restore-windows}. | 851 | layout with the command @code{gdb-restore-windows}. |
| 834 | 852 | ||
| 835 | You may also choose which additional buffers you want to display, | 853 | @findex gdb-many-windows |
| 836 | either in the same frame or a different one. Select them from | 854 | To switch between this standard layout and a simple layout |
| 837 | @samp{GUD->GDB-windows} or @samp{GUD->GDB-Frames} sub-menu | 855 | containing just the GUD buffer and a source file, type @kbd{M-x |
| 838 | respectively. If the menu-bar is unavailable, type @code{M-x | 856 | gdb-many-windows}. |
| 857 | |||
| 858 | You may also specify additional GUD-related buffers to display, | ||
| 859 | either in the same frame or a different one. Select the buffers you | ||
| 860 | want with the @samp{GUD->GDB-windows} and @samp{GUD->GDB-Frames} | ||
| 861 | sub-menus. If the menu-bar is unavailable, type @code{M-x | ||
| 839 | gdb-display-@var{buffertype}-buffer} or @code{M-x | 862 | gdb-display-@var{buffertype}-buffer} or @code{M-x |
| 840 | gdb-frame-@var{buffertype}-buffer} respectively, where | 863 | gdb-frame-@var{buffertype}-buffer} respectively, where |
| 841 | @var{buffertype} is the relevant buffer type e.g breakpoints. | 864 | @var{buffertype} is the relevant buffer type, such as |
| 842 | Most of these buffers are read-only and be killed by simply | 865 | @samp{breakpoints}. Most of these buffers are read-only, and typing |
| 843 | pressing @kbd{q} in them. | 866 | @kbd{q} in them kills them. |
| 844 | 867 | ||
| 845 | When you finish debugging then kill the GUD buffer with @kbd{C-x k}, | 868 | When you finish debugging, kill the GUD buffer with @kbd{C-x k}, |
| 846 | which will also kill all the buffers associated with the session. | 869 | which will also kill all the buffers associated with the session. |
| 847 | However you need not do this if, after editing and re-compiling your | 870 | However you need not do this if, after editing and re-compiling your |
| 848 | source code within Emacs, you wish continue debugging. When you | 871 | source code within Emacs, you wish continue debugging. When you |
| 849 | restart execution, GDB will automatically find your new executable. | 872 | restart execution, GDB will automatically find your new executable. |
| 850 | Keeping the GUD buffer has the advantage of keeping the shell history | 873 | Keeping the GUD buffer has the advantage of keeping the shell history |
| 851 | as well as GDB's breakpoints. You need to check, however, that the | 874 | as well as GDB's breakpoints. You do need to check that the |
| 852 | breakpoints in the recently edited code are still where you want them. | 875 | breakpoints in recently edited source files are still in the right |
| 876 | places. | ||
| 853 | 877 | ||
| 854 | @node Breakpoints Buffer | 878 | @node Breakpoints Buffer |
| 855 | @subsubsection Breakpoints Buffer | 879 | @subsubsection Breakpoints Buffer |
| 856 | 880 | ||
| 857 | The breakpoints buffer shows the existing breakpoints and watchpoints | 881 | The breakpoints buffer shows the existing breakpoints and |
| 858 | (@pxref{Breakpoints,,, gdb, The GNU debugger}). It has three special | 882 | watchpoints (@pxref{Breakpoints,,, gdb, The GNU debugger}). It has |
| 859 | commands: | 883 | these special commands, which mostly apply to the @dfn{current |
| 884 | breakpoint}, the breakpoint which point is on. | ||
| 860 | 885 | ||
| 861 | @table @kbd | 886 | @table @kbd |
| 862 | @item @key{SPC} | 887 | @item @key{SPC} |
| 863 | @kindex SPC @r{(GDB breakpoints buffer)} | 888 | @kindex SPC @r{(GDB breakpoints buffer)} |
| 864 | @findex gdb-toggle-breakpoint | 889 | @findex gdb-toggle-breakpoint |
| 865 | Enable/disable the breakpoint at the current line | 890 | Enable/disable the current breakpoint (@code{gdb-toggle-breakpoint}). |
| 866 | (@code{gdb-toggle-breakpoint}). On a graphical display, this changes | 891 | On a graphical display, this changes the color of a bullet in the |
| 867 | the color of a bullet in the margin of the source buffer at the | 892 | margin of the source buffer at the relevant line. This is red when |
| 868 | relevant line. This is red when the breakpoint is enabled and grey | 893 | the breakpoint is enabled and grey when it is disabled. Text-only |
| 869 | when it is disabled. Text-only terminals correspondingly display | 894 | terminals correspondingly display a @samp{B} or @samp{b}. |
| 870 | a @samp{B} or @samp{b}. | ||
| 871 | 895 | ||
| 872 | @item D | 896 | @item D |
| 873 | @kindex D @r{(GDB breakpoints buffer)} | 897 | @kindex D @r{(GDB breakpoints buffer)} |
| 874 | @findex gdb-delete-breakpoint | 898 | @findex gdb-delete-breakpoint |
| 875 | Delete the breakpoint at the current line (@code{gdb-delete-breakpoint}). | 899 | Delete the current breakpoint (@code{gdb-delete-breakpoint}). |
| 876 | 900 | ||
| 877 | @item @key{RET} | 901 | @item @key{RET} |
| 878 | @kindex RET @r{(GDB breakpoints buffer)} | 902 | @kindex RET @r{(GDB breakpoints buffer)} |
| 879 | @findex gdb-goto-breakpoint | 903 | @findex gdb-goto-breakpoint |
| 880 | Display the file in the source buffer at the breakpoint specified at | 904 | Visit the source line for the current breakpoint |
| 881 | the current line (@code{gdb-goto-breakpoint}). Alternatively, click | 905 | (@code{gdb-goto-breakpoint}). |
| 882 | @kbd{Mouse-2} on the breakpoint that you wish to visit. | 906 | |
| 907 | @item Mouse-2 | ||
| 908 | @kindex Mouse-2 @r{(GDB breakpoints buffer)} | ||
| 909 | Visit the source line for the breakpoint you click on. | ||
| 883 | @end table | 910 | @end table |
| 884 | 911 | ||
| 885 | @node Stack Buffer | 912 | @node Stack Buffer |
| 886 | @subsubsection Stack Buffer | 913 | @subsubsection Stack Buffer |
| 887 | 914 | ||
| 888 | The stack buffer displays a @dfn{call stack}, with one line for each | 915 | The stack buffer displays a @dfn{call stack}, with one line for each |
| 889 | of the nested subroutine calls (@dfn{stack frames}) now active in the | 916 | of the nested subroutine calls (@dfn{stack frames}) now active in the |
| 890 | program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}. | 917 | program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}. |
| 891 | 918 | ||
| 892 | @findex gdb-frames-select | 919 | @findex gdb-frames-select |
| 893 | The selected frame number is displayed in reverse contrast. Move | 920 | The selected frame number is displayed in reverse contrast. To |
| 894 | point to any frame in the stack and type @key{RET} to select it | 921 | select a frame in GDB, move point in the stack buffer to that stack |
| 895 | (@code{gdb-frames-select}) and display the associated source in the | 922 | frame and type @key{RET} (@code{gdb-frames-select}), or click |
| 896 | source buffer. Alternatively, click @kbd{Mouse-2} on a frame to | 923 | @kbd{Mouse-2} on a stack frame. If the locals buffer is visible, |
| 897 | select it. If the locals buffer is displayed then its contents update | 924 | selecting a stack frame updates it to display the local variables of |
| 898 | to display the variables that are local to the new frame. | 925 | the new frame. |
| 899 | 926 | ||
| 900 | @node Watch Expressions | 927 | @node Watch Expressions |
| 901 | @subsubsection Watch Expressions | 928 | @subsubsection Watch Expressions |
| 902 | @cindex Watching expressions in GDB | 929 | @cindex Watching expressions in GDB |
| 903 | 930 | ||
| 904 | @findex gud-watch | 931 | @findex gud-watch |
| 905 | If you want to see how a variable changes each time your program stops | 932 | If you want to see how a variable changes each time your program |
| 906 | then place the cursor over the variable name and click on the watch | 933 | stops, move point into the variable name and click on the watch icon |
| 907 | icon in the tool bar (@code{gud-watch}). | 934 | in the tool bar (@code{gud-watch}). |
| 908 | 935 | ||
| 909 | Each watch expression is displayed in the speedbar. Complex data | 936 | Each watch expression is displayed in the speedbar. Complex data |
| 910 | types, such as arrays, structures and unions are represented in a tree | 937 | types, such as arrays, structures and unions are represented in a tree |
| 911 | format. Leaves and simple data types show the name of the expression | 938 | format. Leaves and simple data types show the name of the expression |
| 912 | and its value, and display the type as a tooltip. Higher levels show | 939 | and its value, and display the type as a tooltip. Higher levels show |
| 913 | the name, type and address value for pointers and just the name and | 940 | the name, type and address value for pointers and just the name and |
| 914 | type otherwise. | 941 | type otherwise. |
| 915 | 942 | ||
| 916 | To expand or contract a complex data type, click @kbd{Mouse-2} | 943 | To expand or contract a complex data type, click @kbd{Mouse-2} |
| 917 | on the tag to the left of the expression. | 944 | on the tag to the left of the expression. |
| 918 | 945 | ||
| 919 | @findex gdb-var-delete | 946 | @findex gdb-var-delete |
| 920 | With the cursor over the root expression of a complex data type, type | 947 | To delete a complex watch expression, move point to the root |
| 921 | @kbd{D} to delete it from the speedbar | 948 | expression in the speedbar and type @kbd{D} (@code{gdb-var-delete}). |
| 922 | (@code{gdb-var-delete}). | ||
| 923 | 949 | ||
| 924 | @kindex RET @r{(GDB speedbar)} | 950 | @kindex RET @r{(GDB speedbar)} |
| 925 | @findex gdb-edit-value | 951 | @findex gdb-edit-value |
| 926 | With the cursor over a simple data type or an element of a complex | 952 | To edit a variable with a simple data type, or a simple element of a |
| 927 | data type which holds a value, type @key{RET} or click @kbd{Mouse-2} to edit | 953 | complex data type, move point there in the speedbar and type @key{RET} |
| 928 | its value. A prompt for a new value appears in the mini-buffer | 954 | (@code{gdb-edit-value}). Or you can click @kbd{Mouse-2} on a value to |
| 929 | (@code{gdb-edit-value}). | 955 | edit it. Either way, this reads the new value using the minibuffer. |
| 930 | 956 | ||
| 931 | @vindex gdb-show-changed-values | 957 | @vindex gdb-show-changed-values |
| 932 | If you set the variable @code{gdb-show-changed-values} to | 958 | If you set the variable @code{gdb-show-changed-values} to |
| 933 | non-@code{nil} (the default value), Emacs will use | 959 | non-@code{nil} (the default value), Emacs uses |
| 934 | font-lock-warning-face to display values that have recently changed in | 960 | @code{font-lock-warning-face} to highlight values that have recently |
| 935 | the speedbar. | 961 | changed. |
| 936 | 962 | ||
| 937 | @vindex gdb-use-colon-colon-notation | 963 | @vindex gdb-use-colon-colon-notation |
| 938 | If you set the variable @code{gdb-use-colon-colon-notation} to a | 964 | If the variable @code{gdb-use-colon-colon-notation} is |
| 939 | non-@code{nil} value then, in C, Emacs will use the | 965 | non-@code{nil}, Emacs uses the @samp{@var{function}::@var{variable}} |
| 940 | @var{function}::@var{variable} format to display variables in the | 966 | format to display variables in the speedbar. Since this does not work |
| 941 | speedbar. Since this does not work for variables defined in compound | 967 | for variables defined in compound statements, the default value is |
| 942 | statements, the default value is @code{nil}. | 968 | @code{nil}. |
| 943 | 969 | ||
| 944 | @node Other GDB User Interface Buffers | 970 | @node Other GDB User Interface Buffers |
| 945 | @subsubsection Other Buffers | 971 | @subsubsection Other Buffers |
| @@ -949,8 +975,9 @@ statements, the default value is @code{nil}. | |||
| 949 | @vindex gdb-use-inferior-io-buffer | 975 | @vindex gdb-use-inferior-io-buffer |
| 950 | If the variable @code{gdb-use-inferior-io-buffer} is non-@code{nil}, | 976 | If the variable @code{gdb-use-inferior-io-buffer} is non-@code{nil}, |
| 951 | the executable program that is being debugged takes its input and | 977 | the executable program that is being debugged takes its input and |
| 952 | displays its output here, otherwise it uses the GUD buffer. To toggle | 978 | displays its output here. Otherwise it uses the GUD buffer for that. |
| 953 | the use of this buffer, do @kbd{M-x gdb-use-inferior-io-buffer}. | 979 | To toggle the use of this buffer, do @kbd{M-x |
| 980 | gdb-use-inferior-io-buffer}. | ||
| 954 | 981 | ||
| 955 | Some of the commands from shell mode are available here. @xref{Shell | 982 | Some of the commands from shell mode are available here. @xref{Shell |
| 956 | Mode}. | 983 | Mode}. |
| @@ -972,15 +999,15 @@ The registers buffer displays the values held by the registers | |||
| 972 | (@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or | 999 | (@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or |
| 973 | click @kbd{Mouse-2} on a register if you want to change its value. | 1000 | click @kbd{Mouse-2} on a register if you want to change its value. |
| 974 | With GDB 6.4 or later, recently changed register values display with | 1001 | With GDB 6.4 or later, recently changed register values display with |
| 975 | font-lock-warning-face. With earlier versions of GDB, you can press | 1002 | @code{font-lock-warning-face}. With earlier versions of GDB, you can |
| 976 | @key{SPC} to toggle the display of floating point registers | 1003 | press @key{SPC} to toggle the display of floating point registers |
| 977 | (@code{toggle-gdb-all-registers}). | 1004 | (@code{toggle-gdb-all-registers}). |
| 978 | 1005 | ||
| 979 | @item Assembler Buffer | 1006 | @item Assembler Buffer |
| 980 | The assembler buffer displays the current frame as machine code. An | 1007 | The assembler buffer displays the current frame as machine code. An |
| 981 | overlay arrow points to the current instruction and you can set and | 1008 | arrow points to the current instruction, and you can set and remove |
| 982 | remove breakpoints as with the source buffer. Breakpoint icons also | 1009 | breakpoints as in a source buffer. Breakpoint icons also appear in |
| 983 | appear in the fringe or margin. | 1010 | the fringe or margin. |
| 984 | 1011 | ||
| 985 | @item Threads Buffer | 1012 | @item Threads Buffer |
| 986 | @findex gdb-threads-select | 1013 | @findex gdb-threads-select |
| @@ -990,15 +1017,15 @@ threads, gdb, The GNU debugger}). Move point to any thread in the | |||
| 990 | list and press @key{RET} to select it (@code{gdb-threads-select}) and | 1017 | list and press @key{RET} to select it (@code{gdb-threads-select}) and |
| 991 | display the associated source in the source buffer. Alternatively, | 1018 | display the associated source in the source buffer. Alternatively, |
| 992 | click @kbd{Mouse-2} on a thread to select it. If the locals buffer is | 1019 | click @kbd{Mouse-2} on a thread to select it. If the locals buffer is |
| 993 | displayed then its contents update to display the variables that are | 1020 | visible, its contents update to display the variables that are local |
| 994 | local to the new thread. | 1021 | in the new thread. |
| 995 | 1022 | ||
| 996 | @item Memory Buffer | 1023 | @item Memory Buffer |
| 997 | The memory buffer allows the user to examine sections of program | 1024 | The memory buffer lets you examine sections of program memory |
| 998 | memory (@pxref{Memory, Memory, Examining memory, gdb, The GNU | 1025 | (@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}). |
| 999 | debugger}). Click @kbd{Mouse-1} on the appropriate part of the header | 1026 | Click @kbd{Mouse-1} on the appropriate part of the header line to |
| 1000 | line to change the starting address or number of data items that the | 1027 | change the starting address or number of data items that the buffer |
| 1001 | buffer displays. Click @kbd{Mouse-3} on the header line to select the | 1028 | displays. Click @kbd{Mouse-3} on the header line to select the |
| 1002 | display format or unit size for these data items. | 1029 | display format or unit size for these data items. |
| 1003 | 1030 | ||
| 1004 | @end table | 1031 | @end table |
| @@ -1045,6 +1072,14 @@ available globally. @xref{Programs}. | |||
| 1045 | conventionally end in @file{.el}. This ending tells Emacs to edit them in | 1072 | conventionally end in @file{.el}. This ending tells Emacs to edit them in |
| 1046 | Emacs-Lisp mode (@pxref{Executing Lisp}). | 1073 | Emacs-Lisp mode (@pxref{Executing Lisp}). |
| 1047 | 1074 | ||
| 1075 | @cindex byte code | ||
| 1076 | Emacs Lisp code can be compiled into byte-code, which loads faster, | ||
| 1077 | takes up less space, and executes faster. @xref{Byte Compilation,, | ||
| 1078 | Byte Compilation, elisp, the Emacs Lisp Reference Manual}. By | ||
| 1079 | convention, the compiled code for a library goes in a separate file | ||
| 1080 | whose name ends in @samp{.elc}. Thus, the compiled code for | ||
| 1081 | @file{foo.el} goes in @file{foo.elc}. | ||
| 1082 | |||
| 1048 | @findex load-file | 1083 | @findex load-file |
| 1049 | To execute a file of Emacs Lisp code, use @kbd{M-x load-file}. This | 1084 | To execute a file of Emacs Lisp code, use @kbd{M-x load-file}. This |
| 1050 | command reads a file name using the minibuffer and then executes the | 1085 | command reads a file name using the minibuffer and then executes the |
| @@ -1055,9 +1090,9 @@ not text in an Emacs buffer. | |||
| 1055 | @findex load | 1090 | @findex load |
| 1056 | @findex load-library | 1091 | @findex load-library |
| 1057 | Once a file of Lisp code is installed in the Emacs Lisp library | 1092 | Once a file of Lisp code is installed in the Emacs Lisp library |
| 1058 | directories, users can load it using @kbd{M-x load-library}. Programs can | 1093 | directories, users can load it using @kbd{M-x load-library}. Programs |
| 1059 | load it by calling @code{load-library}, or with @code{load}, a more primitive | 1094 | can load it by calling @code{load}, a more primitive function that is |
| 1060 | function that is similar but accepts some additional arguments. | 1095 | similar but accepts some additional arguments. |
| 1061 | 1096 | ||
| 1062 | @kbd{M-x load-library} differs from @kbd{M-x load-file} in that it | 1097 | @kbd{M-x load-library} differs from @kbd{M-x load-file} in that it |
| 1063 | searches a sequence of directories and tries three file names in each | 1098 | searches a sequence of directories and tries three file names in each |
| @@ -1068,9 +1103,11 @@ the result of compiling @file{@var{lib}.el}; it is better to load the | |||
| 1068 | compiled file, since it will load and run faster. | 1103 | compiled file, since it will load and run faster. |
| 1069 | 1104 | ||
| 1070 | If @code{load-library} finds that @file{@var{lib}.el} is newer than | 1105 | If @code{load-library} finds that @file{@var{lib}.el} is newer than |
| 1071 | @file{@var{lib}.elc} file, it issues a warning, because it's likely that | 1106 | @file{@var{lib}.elc} file, it issues a warning, because it's likely |
| 1072 | somebody made changes to the @file{.el} file and forgot to recompile | 1107 | that somebody made changes to the @file{.el} file and forgot to |
| 1073 | it. | 1108 | recompile it. Nonetheless, it loads @file{@var{lib}.elc}. This is |
| 1109 | because people often leave unfinished edits the source file, and don't | ||
| 1110 | recompile it until they think it is ready to use. | ||
| 1074 | 1111 | ||
| 1075 | Because the argument to @code{load-library} is usually not in itself | 1112 | Because the argument to @code{load-library} is usually not in itself |
| 1076 | a valid file name, file name completion is not available. Indeed, when | 1113 | a valid file name, file name completion is not available. Indeed, when |
| @@ -1080,7 +1117,7 @@ will be used. | |||
| 1080 | @vindex load-path | 1117 | @vindex load-path |
| 1081 | The sequence of directories searched by @kbd{M-x load-library} is | 1118 | The sequence of directories searched by @kbd{M-x load-library} is |
| 1082 | specified by the variable @code{load-path}, a list of strings that are | 1119 | specified by the variable @code{load-path}, a list of strings that are |
| 1083 | directory names. The default value of the list contains the directory where | 1120 | directory names. The default value of the list contains the directories where |
| 1084 | the Lisp code for Emacs itself is stored. If you have libraries of | 1121 | the Lisp code for Emacs itself is stored. If you have libraries of |
| 1085 | your own, put them in a single directory and add that directory | 1122 | your own, put them in a single directory and add that directory |
| 1086 | to @code{load-path}. @code{nil} in this list stands for the current default | 1123 | to @code{load-path}. @code{nil} in this list stands for the current default |
| @@ -1096,15 +1133,6 @@ library. Trying to run any of those commands calls @code{load} to load | |||
| 1096 | the library; this replaces the autoload definitions with the real ones | 1133 | the library; this replaces the autoload definitions with the real ones |
| 1097 | from the library. | 1134 | from the library. |
| 1098 | 1135 | ||
| 1099 | @cindex byte code | ||
| 1100 | Emacs Lisp code can be compiled into byte-code which loads faster, | ||
| 1101 | takes up less space when loaded, and executes faster. @xref{Byte | ||
| 1102 | Compilation,, Byte Compilation, elisp, the Emacs Lisp Reference Manual}. | ||
| 1103 | By convention, the compiled code for a library goes in a separate file | ||
| 1104 | whose name consists of the library source file with @samp{c} appended. | ||
| 1105 | Thus, the compiled code for @file{foo.el} goes in @file{foo.elc}. | ||
| 1106 | That's why @code{load-library} searches for @samp{.elc} files first. | ||
| 1107 | |||
| 1108 | @vindex load-dangerous-libraries | 1136 | @vindex load-dangerous-libraries |
| 1109 | @cindex Lisp files byte-compiled by XEmacs | 1137 | @cindex Lisp files byte-compiled by XEmacs |
| 1110 | By default, Emacs refuses to load compiled Lisp files which were | 1138 | By default, Emacs refuses to load compiled Lisp files which were |
| @@ -1217,7 +1245,7 @@ The customizable variables @code{eval-expression-print-level} and | |||
| 1217 | of lists to print in the result of the evaluation commands before | 1245 | of lists to print in the result of the evaluation commands before |
| 1218 | abbreviating them. @code{eval-expression-debug-on-error} controls | 1246 | abbreviating them. @code{eval-expression-debug-on-error} controls |
| 1219 | whether evaluation errors invoke the debugger when these commands are | 1247 | whether evaluation errors invoke the debugger when these commands are |
| 1220 | used. | 1248 | used; its default is @code{t}. |
| 1221 | 1249 | ||
| 1222 | @node Lisp Interaction | 1250 | @node Lisp Interaction |
| 1223 | @section Lisp Interaction Buffers | 1251 | @section Lisp Interaction Buffers |
| @@ -1279,9 +1307,9 @@ mode. | |||
| 1279 | 1307 | ||
| 1280 | @findex lisp-mode | 1308 | @findex lisp-mode |
| 1281 | For the source files of programs to run in external Lisps, use Lisp | 1309 | For the source files of programs to run in external Lisps, use Lisp |
| 1282 | mode. This mode can be selected with @kbd{M-x lisp-mode}, and is used | 1310 | mode. You can switch to this mode with @kbd{M-x lisp-mode}, and it is |
| 1283 | automatically for files whose names end in @file{.l}, @file{.lsp}, or | 1311 | used automatically for files whose names end in @file{.l}, |
| 1284 | @file{.lisp}, as most Lisp systems usually expect. | 1312 | @file{.lsp}, or @file{.lisp}. |
| 1285 | 1313 | ||
| 1286 | @kindex C-M-x @r{(Lisp mode)} | 1314 | @kindex C-M-x @r{(Lisp mode)} |
| 1287 | @findex lisp-eval-defun | 1315 | @findex lisp-eval-defun |
| @@ -1292,12 +1320,13 @@ which finds the defun around or following point and sends it as input to | |||
| 1292 | the Lisp process. (Emacs can send input to any inferior process regardless | 1320 | the Lisp process. (Emacs can send input to any inferior process regardless |
| 1293 | of what buffer is current.) | 1321 | of what buffer is current.) |
| 1294 | 1322 | ||
| 1295 | Contrast the meanings of @kbd{C-M-x} in Lisp mode (for editing programs | 1323 | Contrast the meanings of @kbd{C-M-x} in Lisp mode (for editing |
| 1296 | to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp | 1324 | programs to be run in another Lisp system) and Emacs-Lisp mode (for |
| 1297 | programs to be run in Emacs): in both modes it has the effect of installing | 1325 | editing Lisp programs to be run in Emacs; see @pxref{Lisp Eval}): in |
| 1298 | the function definition that point is in, but the way of doing so is | 1326 | both modes it has the effect of installing the function definition |
| 1299 | different according to where the relevant Lisp environment is found. | 1327 | that point is in, but the way of doing so is different according to |
| 1300 | @xref{Executing Lisp}. | 1328 | where the relevant Lisp environment is found. |
| 1329 | |||
| 1301 | 1330 | ||
| 1302 | @ignore | 1331 | @ignore |
| 1303 | arch-tag: 9c3c2f71-b332-4144-8500-3ff9945a50ed | 1332 | arch-tag: 9c3c2f71-b332-4144-8500-3ff9945a50ed |