Changeset 4098 for trunk/etc/DEBUG

Show
Ignore:
Timestamp:
07/01/06 08:27:06 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/etc/DEBUG

    r4058 r4098  
    2121where the executable was made.  That directory has a .gdbinit file 
    2222that defines various "user-defined" commands for debugging Emacs. 
     23(These commands are described below under "Examining Lisp object 
     24values" and "Debugging Emacs Redisplay problems".) 
    2325 
    2426** When you are trying to analyze failed assertions, it will be 
     
    8587You can also use `pp value' to print the emacs value directly. 
    8688 
    87 Note: It is not a good idea to try `pr' or `pp' if you know that Emacs 
     89To see the current value of a Lisp Variable, use `pv variable'. 
     90 
     91Note: It is not a good idea to try `pr', `pp', or `pv' if you know that Emacs 
    8892is in deep trouble: its stack smashed (e.g., if it encountered SIGSEGV 
    8993due to stack overflow), or crucial data structures, such as `obarray', 
     
    98102Emacs will be between instructions and capable of handling `pr'. 
    99103 
    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: 
     104If 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 
     106value, For example: 
     107 
     108    p it->object 
     109    xpr 
     110 
     111You 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. 
     113Once you know the data type, use the command that corresponds to that 
     114type.  Here are these commands: 
    104115 
    105116    xint xptr xwindow xmarker xoverlay xmiscfree xintfwd xboolfwd xobjfwd 
     
    133144    (gdb) p frame 
    134145    $1 = 139854428 
    135     (gdb) xtype 
     146    (gdb) xpr 
    136147    Lisp_Vectorlike 
    137148    PVEC_FRAME 
    138     (gdb) xframe 
    139149    $2 = (struct frame *) 0x8560258 
     150    "emacs@localhost" 
    140151    (gdb) p *$ 
    141152    $3 = { 
     
    145156      [...] 
    146157    } 
    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 
     159Now we can use `pr' to print the frame parameters: 
     160 
     161    (gdb) pp $->param_alist 
     162    ((background-mode . light) (display-type . color) [...]) 
     163 
    154164 
    155165The Emacs C code heavily uses macros defined in lisp.h.  So suppose 
     
    246256   xsymbol 
    247257 
     258** Debugging Emacs Redisplay problems 
     259 
     260The src/.gdbinit file defines many useful commands for dumping redisplay 
     261related 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 
     272The above commands also exist in a version with an `x' suffix which 
     273takes an object of the relevant type as argument. 
     274 
    248275** Using GDB in Emacs 
    249276 
     
    252279features available just for debugging Emacs: 
    253280 
    254 1) The command gud-pp isavailable on the tool bar (the `pp' icon) and allows 
    255    the user to print the s-expression of the variable at point, in the GUD 
    256    buffer. 
     2811) 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. 
    257284 
    2582852) Pressing `p' on a component of a watch expression that is a lisp object