diff options
| author | Paul Eggert | 2016-09-26 13:32:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-09-26 13:32:28 -0700 |
| commit | dcd90f60eb8952d119d97efcef9564ec96def054 (patch) | |
| tree | 2d3a5bbac64d7fbd94f3af0774218911a522e61f /etc/DEBUG | |
| parent | c44ecb77ab33f0a0559c3e5da42fb486d6b014dd (diff) | |
| parent | 0ffc9cef49b0fceb3c5e904837ea5675fe4306ac (diff) | |
| download | emacs-dcd90f60eb8952d119d97efcef9564ec96def054.tar.gz emacs-dcd90f60eb8952d119d97efcef9564ec96def054.zip | |
Merge from origin/emacs-25
0ffc9ce Update admin/authors.el
0ad7410 Update Antinews in ELisp manual
ea0f750 Fix comments on window height macros
0bbdeed Fix 'url-http-create-request' when cookies are used
0045998 Fix cross reference in frames.texi
1392894 ; * etc/DEBUG: Minor copyedits.
304a5c8 ; * etc/DEBUG: Improve documentation of getting control to GDB.
56bf7d7 Fix regexp-opt documentation (bug #17862)
803ad6f ; Fix documentation of seq-subseq
ed4530d * lisp/emacs-lisp/gv.el (gv-ref): Fix example of PLACE in doc...
88ea396 ; Spelling fixes
17197d0 Fix tags-query-replace docstring
80a7f8b Clarify documentation of precision in format specs
88a5052 Improve and clarify documentation of subprocesses
89eb09f * etc/PROBLEMS: Mention gnutls-cli 3.5.3 (Bug#24247).
# Conflicts:
# etc/PROBLEMS
# src/process.c
Diffstat (limited to 'etc/DEBUG')
| -rw-r--r-- | etc/DEBUG | 75 |
1 files changed, 53 insertions, 22 deletions
| @@ -190,24 +190,44 @@ kick in, provided that you run under GDB. | |||
| 190 | 190 | ||
| 191 | ** Getting control to the debugger | 191 | ** Getting control to the debugger |
| 192 | 192 | ||
| 193 | Setting a breakpoint in a strategic place, after loading Emacs into | ||
| 194 | the debugger, but before running it, is the most efficient way of | ||
| 195 | making sure control will be returned to the debugger when you need | ||
| 196 | that. | ||
| 197 | |||
| 193 | 'Fsignal' is a very useful place to put a breakpoint in. All Lisp | 198 | 'Fsignal' is a very useful place to put a breakpoint in. All Lisp |
| 194 | errors go through there. If you are only interested in errors that | 199 | errors go through there. If you are only interested in errors that |
| 195 | would fire the debugger, breaking at 'maybe_call_debugger' is useful. | 200 | would fire the Lisp debugger, breaking at 'maybe_call_debugger' is |
| 201 | useful. | ||
| 202 | |||
| 203 | Another technique for get control to the debugger is to put a | ||
| 204 | breakpoint in some rarely used function. One such convenient function | ||
| 205 | is Fredraw_display, which you can invoke at will interactively with | ||
| 206 | "M-x redraw-display RET". | ||
| 196 | 207 | ||
| 197 | It is useful, when debugging, to have a guaranteed way to return to | 208 | It is also useful to have a guaranteed way to return to the debugger |
| 198 | the debugger at any time. When using X, this is easy: type C-z at the | 209 | at any arbitrary time. When using X, this is easy: type C-z at the |
| 199 | window where Emacs is running under GDB, and it will stop Emacs just | 210 | window where you are interacting with GDB, and it will stop Emacs just |
| 200 | as it would stop any ordinary program. When Emacs is running in a | 211 | as it would stop any ordinary program. (This doesn't work if GDB was |
| 201 | terminal, things are not so easy. | 212 | attached to a running Emacs process; in that case, you will need to |
| 213 | type C-z to the shell window from which Emacs was started, or use the | ||
| 214 | "kill -TSTP" method described below.) | ||
| 215 | |||
| 216 | When Emacs is displaying on a text terminal, things are not so easy, | ||
| 217 | so we describe the various alternatives below (however, those of them | ||
| 218 | that use signals only work on Posix systems). | ||
| 202 | 219 | ||
| 203 | The src/.gdbinit file in the Emacs distribution arranges for SIGINT | 220 | The src/.gdbinit file in the Emacs distribution arranges for SIGINT |
| 204 | (C-g in Emacs) to be passed to Emacs and not give control back to GDB. | 221 | (C-g in Emacs on a text-mode frame) to be passed to Emacs and not give |
| 205 | On modern POSIX systems, you can override that with this command: | 222 | control back to GDB. On modern systems, you can override that with |
| 223 | this command: | ||
| 206 | 224 | ||
| 207 | handle SIGINT stop nopass | 225 | handle SIGINT stop nopass |
| 208 | 226 | ||
| 209 | After this 'handle' command, SIGINT will return control to GDB. If | 227 | After this 'handle' command, SIGINT will return control to GDB. If |
| 210 | you want the C-g to cause a QUIT within Emacs as well, omit the 'nopass'. | 228 | you want the C-g to cause a QUIT within Emacs as well, omit the 'nopass'. |
| 229 | See the GDB manual for more details about signal handling and the | ||
| 230 | 'handle' command. | ||
| 211 | 231 | ||
| 212 | A technique that can work when 'handle SIGINT' does not is to store | 232 | A technique that can work when 'handle SIGINT' does not is to store |
| 213 | the code for some character into the variable stop_character. Thus, | 233 | the code for some character into the variable stop_character. Thus, |
| @@ -216,26 +236,37 @@ the code for some character into the variable stop_character. Thus, | |||
| 216 | 236 | ||
| 217 | makes Control-] (decimal code 29) the stop character. | 237 | makes Control-] (decimal code 29) the stop character. |
| 218 | Typing Control-] will cause immediate stop. You cannot | 238 | Typing Control-] will cause immediate stop. You cannot |
| 219 | use the set command until the inferior process has been started. | 239 | use the set command until the inferior process has been started, so |
| 220 | Put a breakpoint early in 'main', or suspend the Emacs, | 240 | start Emacs with the 'start' command, to get an opportunity to do the |
| 221 | to get an opportunity to do the set command. | 241 | above 'set' command. |
| 222 | 242 | ||
| 223 | Another technique for get control to the debugger is to put a | 243 | On a Posix host, you can also send a signal using the 'kill' command |
| 224 | breakpoint in some rarely used function. One such convenient function | 244 | from a shell prompt, like this: |
| 225 | is Fredraw_display, which you can invoke at will interactively with | ||
| 226 | "M-x redraw-display RET". | ||
| 227 | 245 | ||
| 228 | When Emacs is running in a terminal, it is sometimes useful to use a separate | 246 | kill -TSTP Emacs-PID |
| 229 | terminal for the debug session. This can be done by starting Emacs as usual, | ||
| 230 | then attaching to it from gdb with the 'attach' command which is explained in | ||
| 231 | the node "Attach" of the GDB manual. | ||
| 232 | 247 | ||
| 233 | On MS-Windows, you can start Emacs in its own separate terminal by | 248 | where Emacs-PID is the process ID of Emacs being debugged. Other |
| 234 | setting the new-console option before running Emacs under GDB: | 249 | useful signals to send are SIGUSR1 and SIGUSR2; see "Error Debugging" |
| 250 | in the ELisp manual for how to use those. | ||
| 251 | |||
| 252 | When Emacs is displaying on a text terminal, it is useful to have a | ||
| 253 | separate terminal for the debug session. This can be done by starting | ||
| 254 | Emacs as usual, then attaching to it from gdb with the 'attach' | ||
| 255 | command which is explained in the node "Attach" of the GDB manual. | ||
| 256 | |||
| 257 | On MS-Windows, you can alternatively start Emacs from its own separate | ||
| 258 | console by setting the new-console option before running Emacs under | ||
| 259 | GDB: | ||
| 235 | 260 | ||
| 236 | (gdb) set new-console 1 | 261 | (gdb) set new-console 1 |
| 237 | (gdb) run | 262 | (gdb) run |
| 238 | 263 | ||
| 264 | If you do this, then typing C-c or C-BREAK into the console window | ||
| 265 | through which you interact with GDB will stop Emacs and return control | ||
| 266 | to the debugger, no matter if Emacs displays GUI or text-mode frames. | ||
| 267 | This is the only reliable alternative on MS-Windows to get control to | ||
| 268 | the debugger, besides setting breakpoints in advance. | ||
| 269 | |||
| 239 | ** Examining Lisp object values. | 270 | ** Examining Lisp object values. |
| 240 | 271 | ||
| 241 | When you have a live process to debug, and it has not encountered a | 272 | When you have a live process to debug, and it has not encountered a |
| @@ -848,7 +879,7 @@ directed to the xterm window you opened above. | |||
| 848 | Similar arrangement is possible on a character terminal by using the | 879 | Similar arrangement is possible on a character terminal by using the |
| 849 | 'screen' package. | 880 | 'screen' package. |
| 850 | 881 | ||
| 851 | On MS-Windows, you can start Emacs in its own separate terminal by | 882 | On MS-Windows, you can start Emacs in its own separate console by |
| 852 | setting the new-console option before running Emacs under GDB: | 883 | setting the new-console option before running Emacs under GDB: |
| 853 | 884 | ||
| 854 | (gdb) set new-console 1 | 885 | (gdb) set new-console 1 |