aboutsummaryrefslogtreecommitdiffstats
path: root/etc/DEBUG
diff options
context:
space:
mode:
authorEli Zaretskii2001-01-31 17:34:45 +0000
committerEli Zaretskii2001-01-31 17:34:45 +0000
commit3102e429e643bf64f7d12cb97537cdf70c66f950 (patch)
treeaf7df60de727fe0c47d932da4f02776b91b375a9 /etc/DEBUG
parent27fcb2fcb01c7e345c04abb340bdd644b9649d3f (diff)
downloademacs-3102e429e643bf64f7d12cb97537cdf70c66f950.tar.gz
emacs-3102e429e643bf64f7d12cb97537cdf70c66f950.zip
Changes, clean-ups, and typo fixes from Richard M. Stallman.
Diffstat (limited to 'etc/DEBUG')
-rw-r--r--etc/DEBUG72
1 files changed, 41 insertions, 31 deletions
diff --git a/etc/DEBUG b/etc/DEBUG
index 3f00da3553b..f78656cb3b4 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -28,14 +28,27 @@ kick in, provided that you run under GDB.
28 28
29** Getting control to the debugger 29** Getting control to the debugger
30 30
31`Fsignal' is a very useful place to stop in. 31`Fsignal' is a very useful place to put a breakpoint in.
32All Lisp errors go through there. 32All Lisp errors go through there.
33 33
34It is useful, when debugging, to have a guaranteed way 34It is useful, when debugging, to have a guaranteed way to return to
35to return to the debugger at any time. If you are using 35the debugger at any time. When using X, this is easy: type C-c at the
36interrupt-driven input, which is the default, then Emacs is using 36window where Emacs is running under GDB, and it will stop Emacs just
37RAW mode and the only way you can do it is to store 37as it would stop any ordinary program. When Emacs is running in a
38the code for some character into the variable stop_character: 38terminal, things are not so easy.
39
40The src/.gdbinit file in the Emacs distribution arranges for SIGINT
41(C-g in Emacs) to be passed to Emacs and not give control back to GDB.
42On modern POSIX systems, you can override that with this command:
43
44 handle int stop nopass
45
46After this `handle' command, SIGINT will return control to GDB. If
47you want the C-g to cause a QUIT within Emacs as well, omit the
48`nopass'.
49
50A technique that can work when `handle SIGINT' does not is to store
51the code for some character into the variable stop_character. Thus,
39 52
40 set stop_character = 29 53 set stop_character = 29
41 54
@@ -45,16 +58,6 @@ use the set command until the inferior process has been started.
45Put a breakpoint early in `main', or suspend the Emacs, 58Put a breakpoint early in `main', or suspend the Emacs,
46to get an opportunity to do the set command. 59to get an opportunity to do the set command.
47 60
48If you are using cbreak input (see the Lisp function set-input-mode),
49then typing Control-g will cause a SIGINT, which will return control
50to GDB immediately if you type this command first:
51
52 handle 2 stop
53
54By default the src/.gdbinit file in the Emacs distribution arranges
55for SIGINT to be passed to Emacs. You can type C-z, which generates
56SIGTSTP, to cause GDB to regain control.
57
58** Examining Lisp object values. 61** Examining Lisp object values.
59 62
60When you have a live process to debug, and it has not encountered a 63When you have a live process to debug, and it has not encountered a
@@ -69,13 +72,16 @@ corrupted, etc. In such cases, the Emacs subroutine called by `pr'
69might make more damage, like overwrite some data that is important for 72might make more damage, like overwrite some data that is important for
70debugging the original problem. 73debugging the original problem.
71 74
72If you can't use `pr' command, either because the process can't run a 75Also, on some systems it is impossible to use `pr' if you stopped
73subroutine or because the data is invalid or Emacs already got a fatal 76Emacs while it was inside `select'. This is in fact what happens if
74signal, you can fall back on lower-level commands. 77you stop Emacs while it is waiting. In such a situation, don't try to
78use `pr'. Instead, use `s' to step out of the system call. Then
79Emacs will be between instructions and capable of handling `pr'.
75 80
76Use the `xtype' command to print out the data type of the last data 81If you can't use `pr' command, for whatever reason, you can fall back
77value. Once you know the data type, use the command that corresponds 82on lower-level commands. Use the `xtype' command to print out the
78to that type. Here are these commands: 83data type of the last data value. Once you know the data type, use
84the command that corresponds to that type. Here are these commands:
79 85
80 xint xptr xwindow xmarker xoverlay xmiscfree xintfwd xboolfwd xobjfwd 86 xint xptr xwindow xmarker xoverlay xmiscfree xintfwd xboolfwd xobjfwd
81 xbufobjfwd xkbobjfwd xbuflocal xbuffer xsymbol xstring xvector xframe 87 xbufobjfwd xkbobjfwd xbuflocal xbuffer xsymbol xstring xvector xframe
@@ -190,7 +196,8 @@ where you can define xvector-elts as follows:
190 196
191** Getting Lisp-level backtrace information within GDB 197** Getting Lisp-level backtrace information within GDB
192 198
193The most convenient way is to use the `xbacktrace' command. 199The most convenient way is to use the `xbacktrace' command. This
200shows the names of the Lisp functions that are currently active.
194 201
195If that doesn't work (e.g., because the `backtrace_list' structure is 202If that doesn't work (e.g., because the `backtrace_list' structure is
196corrupted), type "bt" at the GDB prompt, to produce the C-level 203corrupted), type "bt" at the GDB prompt, to produce the C-level
@@ -360,6 +367,11 @@ the machine where you started GDB and use the debugger from there.
360 367
361** Running Emacs with Purify 368** Running Emacs with Purify
362 369
370Some people who are willing to use non-free software use Purify. We
371can't ethically ask you to you become a Purify user; but if you have
372it, and you test Emacs with it, we will not refuse to look at the
373results you find.
374
363Emacs compiled with Purify won't run without some hacking. Here are 375Emacs compiled with Purify won't run without some hacking. Here are
364some of the changes you might find necessary (SYSTEM-NAME and 376some of the changes you might find necessary (SYSTEM-NAME and
365MACHINE-NAME are the names of your OS- and CPU-specific headers in the 377MACHINE-NAME are the names of your OS- and CPU-specific headers in the
@@ -387,7 +399,6 @@ alarms, you will have to hack the definitions of these data structures
387on the respective headers to remove the ":N" bitfield definitions 399on the respective headers to remove the ":N" bitfield definitions
388(which will cause each such field to use a full int). 400(which will cause each such field to use a full int).
389 401
390
391** Debugging problems which happen in GC 402** Debugging problems which happen in GC
392 403
393The array `last_marked' (defined on alloc.c) can be used to display 404The array `last_marked' (defined on alloc.c) can be used to display
@@ -407,22 +418,21 @@ Once you discover the corrupted Lisp object or data structure, it is
407useful to look at it in a fresh session and compare its contents with 418useful to look at it in a fresh session and compare its contents with
408a session that you are debugging. 419a session that you are debugging.
409 420
410
411** Some suggestions for debugging on MS Windows: 421** Some suggestions for debugging on MS Windows:
412 422
413 (written by Marc Fleischeuers, Geoff Voelker and Andrew Innes) 423 (written by Marc Fleischeuers, Geoff Voelker and Andrew Innes)
414 424
415To debug emacs with Microsoft Visual C++, you either start emacs from 425To debug Emacs with Microsoft Visual C++, you either start emacs from
416the debugger or attach the debugger to a running emacs process. To 426the debugger or attach the debugger to a running emacs process. To
417start emacs from the debugger, you can use the file bin/debug.bat. The 427start emacs from the debugger, you can use the file bin/debug.bat. The
418Microsoft Developer studio will start and under Project, Settings, 428Microsoft Developer studio will start and under Project, Settings,
419Debug, General you can set the command-line arguments and emacs' 429Debug, General you can set the command-line arguments and Emacs's
420startup directory. Set breakpoints (Edit, Breakpoints) at Fsignal and 430startup directory. Set breakpoints (Edit, Breakpoints) at Fsignal and
421other functions that you want to examine. Run the program (Build, 431other functions that you want to examine. Run the program (Build,
422Start debug). Emacs will start and the debugger will take control as 432Start debug). Emacs will start and the debugger will take control as
423soon as a breakpoint is hit. 433soon as a breakpoint is hit.
424 434
425You can also attach the debugger to an already running emacs process. 435You can also attach the debugger to an already running Emacs process.
426To do this, start up the Microsoft Developer studio and select Build, 436To do this, start up the Microsoft Developer studio and select Build,
427Start debug, Attach to process. Choose the Emacs process from the 437Start debug, Attach to process. Choose the Emacs process from the
428list. Send a break to the running process (Debug, Break) and you will 438list. Send a break to the running process (Debug, Break) and you will
@@ -432,7 +442,7 @@ breakpoints in Emacs (Edit, Breakpoints). Continue the running Emacs
432process (Debug, Step out) and control will return to Emacs, until a 442process (Debug, Step out) and control will return to Emacs, until a
433breakpoint is hit. 443breakpoint is hit.
434 444
435To examine the contents of a lisp variable, you can use the function 445To examine the contents of a Lisp variable, you can use the function
436'debug_print'. Right-click on a variable, select QuickWatch (it has 446'debug_print'. Right-click on a variable, select QuickWatch (it has
437an eyeglass symbol on its button in the toolbar), and in the text 447an eyeglass symbol on its button in the toolbar), and in the text
438field at the top of the window, place 'debug_print(' and ')' around 448field at the top of the window, place 'debug_print(' and ')' around
@@ -452,7 +462,7 @@ an input event. Use the `Call Stack' window to select the procedure
452`w32_msp_pump' up the call stack (see below for why you have to do 462`w32_msp_pump' up the call stack (see below for why you have to do
453this). Open the QuickWatch window and enter 463this). Open the QuickWatch window and enter
454"debug_print(Vexec_path)". Evaluating this expression will then print 464"debug_print(Vexec_path)". Evaluating this expression will then print
455out the contents of the lisp variable `exec-path'. 465out the contents of the Lisp variable `exec-path'.
456 466
457If QuickWatch reports that the symbol is unknown, then check the call 467If QuickWatch reports that the symbol is unknown, then check the call
458stack in the `Call Stack' window. If the selected frame in the call 468stack in the `Call Stack' window. If the selected frame in the call
@@ -469,7 +479,7 @@ execution (e.g., due to a breakpoint) in the context of the current
469thread, so this should only be a problem if you've explicitly switched 479thread, so this should only be a problem if you've explicitly switched
470threads. 480threads.
471 481
472It is also possible to keep appropriately masked and typecast lisp 482It is also possible to keep appropriately masked and typecast Lisp
473symbols in the Watch window, this is more convenient when steeping 483symbols in the Watch window, this is more convenient when steeping
474though the code. For instance, on entering apply_lambda, you can 484though the code. For instance, on entering apply_lambda, you can
475watch (struct Lisp_Symbol *) (0xfffffff & args[0]). 485watch (struct Lisp_Symbol *) (0xfffffff & args[0]).