Changeset 4098 for trunk/etc/DEBUG
- Timestamp:
- 07/01/06 08:27:06 (2 years ago)
- Files:
-
- trunk/etc/DEBUG (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/etc/DEBUG
r4058 r4098 21 21 where the executable was made. That directory has a .gdbinit file 22 22 that defines various "user-defined" commands for debugging Emacs. 23 (These commands are described below under "Examining Lisp object 24 values" and "Debugging Emacs Redisplay problems".) 23 25 24 26 ** When you are trying to analyze failed assertions, it will be … … 85 87 You can also use `pp value' to print the emacs value directly. 86 88 87 Note: It is not a good idea to try `pr' or `pp' if you know that Emacs 89 To see the current value of a Lisp Variable, use `pv variable'. 90 91 Note: It is not a good idea to try `pr', `pp', or `pv' if you know that Emacs 88 92 is in deep trouble: its stack smashed (e.g., if it encountered SIGSEGV 89 93 due to stack overflow), or crucial data structures, such as `obarray', … … 98 102 Emacs will be between instructions and capable of handling `pr'. 99 103 100 If you can't use `pr' command, for whatever reason, you can fall back 101 on lower-level commands. Use the `xtype' command to print out the 102 data type of the last data value. Once you know the data type, use 103 the command that corresponds to that type. Here are these commands: 104 If you can't use `pr' command, for whatever reason, you can use the 105 `xpr' command to print out the data type and value of the last data 106 value, For example: 107 108 p it->object 109 xpr 110 111 You may also analyze data values using lower-level commands. Use the 112 `xtype' command to print out the data type of the last data value. 113 Once you know the data type, use the command that corresponds to that 114 type. Here are these commands: 104 115 105 116 xint xptr xwindow xmarker xoverlay xmiscfree xintfwd xboolfwd xobjfwd … … 133 144 (gdb) p frame 134 145 $1 = 139854428 135 (gdb) x type146 (gdb) xpr 136 147 Lisp_Vectorlike 137 148 PVEC_FRAME 138 (gdb) xframe139 149 $2 = (struct frame *) 0x8560258 150 "emacs@localhost" 140 151 (gdb) p *$ 141 152 $3 = { … … 145 156 [...] 146 157 } 147 (gdb) p $3->name 148 $4 = 140615219 149 150 Now we can use `pr' to print the name of the frame: 151 152 (gdb) pr 153 "emacs@steenrod.math.nwu.edu" 158 159 Now we can use `pr' to print the frame parameters: 160 161 (gdb) pp $->param_alist 162 ((background-mode . light) (display-type . color) [...]) 163 154 164 155 165 The Emacs C code heavily uses macros defined in lisp.h. So suppose … … 246 256 xsymbol 247 257 258 ** Debugging Emacs Redisplay problems 259 260 The src/.gdbinit file defines many useful commands for dumping redisplay 261 related data structures in a terse and user-friendly format: 262 263 `ppt' prints value of PT, narrowing, and gap in current buffer. 264 `pit' dumps the current display iterator `it'. 265 `pwin' dumps the current window 'win'. 266 `prow' dumps the current glyph_row `row'. 267 `pg' dumps the current glyph `glyph'. 268 `pgi' dumps the next glyph. 269 `pgrow' dumps all glyphs in current glyph_row `row'. 270 `pcursor' dumps current output_cursor. 271 272 The above commands also exist in a version with an `x' suffix which 273 takes an object of the relevant type as argument. 274 248 275 ** Using GDB in Emacs 249 276 … … 252 279 features available just for debugging Emacs: 253 280 254 1) The command gud-pp is available on the tool bar (the `pp' icon) and allows255 the user to print the s-expression of the variable at point, in the GUD256 buffer.281 1) The command gud-pp is available on the tool bar (the `pp' icon) and 282 allows the user to print the s-expression of the variable at point, 283 in the GUD buffer. 257 284 258 285 2) Pressing `p' on a component of a watch expression that is a lisp object
