diff options
| author | Kim F. Storm | 2006-06-23 14:37:10 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-06-23 14:37:10 +0000 |
| commit | 11eced2faf50f6089b48101191295e7b5a2b01da (patch) | |
| tree | 131ba01d43a2c393e372e0b74c536d1143f0fb23 | |
| parent | 55b903a31dd725f921700b8412c24895baf69148 (diff) | |
| download | emacs-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/DEBUG | 49 |
1 files changed, 37 insertions, 12 deletions
| @@ -84,7 +84,9 @@ arguments. This calls a subroutine which uses the Lisp printer. | |||
| 84 | 84 | ||
| 85 | You can also use `pp value' to print the emacs value directly. | 85 | You can also use `pp value' to print the emacs value directly. |
| 86 | 86 | ||
| 87 | Note: It is not a good idea to try `pr' or `pp' if you know that Emacs | 87 | To see the current value of a Lisp Variable, use `pv variable'. |
| 88 | |||
| 89 | Note: It is not a good idea to try `pr', `pp', or `pv' if you know that Emacs | ||
| 88 | is in deep trouble: its stack smashed (e.g., if it encountered SIGSEGV | 90 | is in deep trouble: its stack smashed (e.g., if it encountered SIGSEGV |
| 89 | due to stack overflow), or crucial data structures, such as `obarray', | 91 | due to stack overflow), or crucial data structures, such as `obarray', |
| 90 | corrupted, etc. In such cases, the Emacs subroutine called by `pr' | 92 | corrupted, 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 | |||
| 97 | use `pr'. Instead, use `s' to step out of the system call. Then | 99 | use `pr'. Instead, use `s' to step out of the system call. Then |
| 98 | Emacs will be between instructions and capable of handling `pr'. | 100 | Emacs will be between instructions and capable of handling `pr'. |
| 99 | 101 | ||
| 100 | If you can't use `pr' command, for whatever reason, you can fall back | 102 | If you can't use `pr' command, for whatever reason, you can use the |
| 101 | on 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 |
| 102 | data type of the last data value. Once you know the data type, use | 104 | value, For example: |
| 103 | the command that corresponds to that type. Here are these commands: | 105 | |
| 106 | p it->object | ||
| 107 | xpr | ||
| 108 | |||
| 109 | You 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. | ||
| 111 | Once you know the data type, use the command that corresponds to that | ||
| 112 | type. 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 | ||
| 150 | Now we can use `pr' to print the name of the frame: | 157 | Now 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 | ||
| 155 | The Emacs C code heavily uses macros defined in lisp.h. So suppose | 163 | The Emacs C code heavily uses macros defined in lisp.h. So suppose |
| 156 | we want the address of the l-value expression near the bottom of | 164 | we 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 | |||
| 258 | The src/.gdbinit file defines many useful commands for dumping redisplay | ||
| 259 | related 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 | |||
| 270 | The above commands also exist in a version with an `x' suffix which | ||
| 271 | takes an object of the relevant type as argument. | ||
| 272 | |||
| 248 | ** Using GDB in Emacs | 273 | ** Using GDB in Emacs |
| 249 | 274 | ||
| 250 | Debugging with GDB in Emacs offers some advantages over the command line (See | 275 | Debugging with GDB in Emacs offers some advantages over the command line (See |