aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2006-06-23 14:37:10 +0000
committerKim F. Storm2006-06-23 14:37:10 +0000
commit11eced2faf50f6089b48101191295e7b5a2b01da (patch)
tree131ba01d43a2c393e372e0b74c536d1143f0fb23
parent55b903a31dd725f921700b8412c24895baf69148 (diff)
downloademacs-11eced2faf50f6089b48101191295e7b5a2b01da.tar.gz
emacs-11eced2faf50f6089b48101191295e7b5a2b01da.zip
Mention `pv variable' to print value of Lisp variables.
Mention `xpr' and fix example to use it. Add section describing commands such as `pit' that are useful for debugging redisplay related problems.
-rw-r--r--etc/DEBUG49
1 files changed, 37 insertions, 12 deletions
diff --git a/etc/DEBUG b/etc/DEBUG
index b8edb12e474..090947d57b5 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -84,7 +84,9 @@ arguments. This calls a subroutine which uses the Lisp printer.
84 84
85You can also use `pp value' to print the emacs value directly. 85You can also use `pp value' to print the emacs value directly.
86 86
87Note: It is not a good idea to try `pr' or `pp' if you know that Emacs 87To see the current value of a Lisp Variable, use `pv variable'.
88
89Note: It is not a good idea to try `pr', `pp', or `pv' if you know that Emacs
88is in deep trouble: its stack smashed (e.g., if it encountered SIGSEGV 90is in deep trouble: its stack smashed (e.g., if it encountered SIGSEGV
89due to stack overflow), or crucial data structures, such as `obarray', 91due to stack overflow), or crucial data structures, such as `obarray',
90corrupted, etc. In such cases, the Emacs subroutine called by `pr' 92corrupted, etc. In such cases, the Emacs subroutine called by `pr'
@@ -97,10 +99,17 @@ you stop Emacs while it is waiting. In such a situation, don't try to
97use `pr'. Instead, use `s' to step out of the system call. Then 99use `pr'. Instead, use `s' to step out of the system call. Then
98Emacs will be between instructions and capable of handling `pr'. 100Emacs will be between instructions and capable of handling `pr'.
99 101
100If you can't use `pr' command, for whatever reason, you can fall back 102If you can't use `pr' command, for whatever reason, you can use the
101on lower-level commands. Use the `xtype' command to print out the 103`xpr' command to print out the data type and value of the last data
102data type of the last data value. Once you know the data type, use 104value, For example:
103the command that corresponds to that type. Here are these commands: 105
106 p it->object
107 xpr
108
109You may also analyze data values using lower-level commands. Use the
110`xtype' command to print out the data type of the last data value.
111Once you know the data type, use the command that corresponds to that
112type. Here are these commands:
104 113
105 xint xptr xwindow xmarker xoverlay xmiscfree xintfwd xboolfwd xobjfwd 114 xint xptr xwindow xmarker xoverlay xmiscfree xintfwd xboolfwd xobjfwd
106 xbufobjfwd xkbobjfwd xbuflocal xbuffer xsymbol xstring xvector xframe 115 xbufobjfwd xkbobjfwd xbuflocal xbuffer xsymbol xstring xvector xframe
@@ -132,11 +141,11 @@ Then Emacs hits the breakpoint:
132 141
133 (gdb) p frame 142 (gdb) p frame
134 $1 = 139854428 143 $1 = 139854428
135 (gdb) xtype 144 (gdb) xpr
136 Lisp_Vectorlike 145 Lisp_Vectorlike
137 PVEC_FRAME 146 PVEC_FRAME
138 (gdb) xframe
139 $2 = (struct frame *) 0x8560258 147 $2 = (struct frame *) 0x8560258
148 "emacs@localhost"
140 (gdb) p *$ 149 (gdb) p *$
141 $3 = { 150 $3 = {
142 size = 1073742931, 151 size = 1073742931,
@@ -144,13 +153,12 @@ Then Emacs hits the breakpoint:
144 name = 140615219, 153 name = 140615219,
145 [...] 154 [...]
146 } 155 }
147 (gdb) p $3->name
148 $4 = 140615219
149 156
150Now we can use `pr' to print the name of the frame: 157Now we can use `pr' to print the frame parameters:
158
159 (gdb) pp $->param_alist
160 ((background-mode . light) (display-type . color) [...])
151 161
152 (gdb) pr
153 "emacs@steenrod.math.nwu.edu"
154 162
155The Emacs C code heavily uses macros defined in lisp.h. So suppose 163The Emacs C code heavily uses macros defined in lisp.h. So suppose
156we want the address of the l-value expression near the bottom of 164we want the address of the l-value expression near the bottom of
@@ -245,6 +253,23 @@ and, assuming that "xtype" says that args[0] is a symbol:
245 253
246 xsymbol 254 xsymbol
247 255
256** Debugging Emacs Redisplay problems
257
258The src/.gdbinit file defines many useful commands for dumping redisplay
259related data structures in a terse and user-friendly format:
260
261 `ppt' prints value of PT, narrowing, and gap in current buffer.
262 `pit' dumps the current display iterator `it'.
263 `pwin' dumps the current window 'win'.
264 `prow' dumps the current glyph_row `row'.
265 `pg' dumps the current glyph `glyph'.
266 `pgi' dumps the next glyph.
267 `pgrow' dumps all glyphs in current glyph_row `row'.
268 `pcursor' dumps current output_cursor.
269
270The above commands also exist in a version with an `x' suffix which
271takes an object of the relevant type as argument.
272
248** Using GDB in Emacs 273** Using GDB in Emacs
249 274
250Debugging with GDB in Emacs offers some advantages over the command line (See 275Debugging with GDB in Emacs offers some advantages over the command line (See