Changes between Version 5 and Version 6 of CclUnderGdb


Ignore:
Timestamp:
Feb 26, 2009, 2:05:33 PM (10 years ago)
Author:
gz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CclUnderGdb

    v5 v6  
    6262lisp objects, as they wouldn't if the exception occurred in foreign
    6363code.)
     64
    6465
    6566GDB's much more likely to be able to make at least some sense
     
    156157To enter GDB when lisp is starting up, set a breakpoint at *_SPfuncall, which is called soon after the image is loaded (and is rarely called thereafter, since funcall is inlined).
    157158
     159----
     160To enter GDB when lisp is already in the kernel debugger after an exception in foreign code, first do the `R` command in the kernel debugger to display raw (hex) register values and note the value in {{{RIP}}} (the program counter/instruction pointer.)  Then:
     161
     162{{{
     163shell> gdb /path/to/lisp-kernel
     164(gdb) source lisp-kernel/linuxx8664/.gdbinit
     165(gdb) attach <pid>    # pid is printed in brackets in the kernel debugger prompt
     166(gdb) br *0x87654321  # or whatever the RIP value is
     167(gdb) continue
     168}}}
     169
     170Back in the kernel debugger:
     171
     172{{{
     173[pid] Clozure CL kernel debugger: x
     174}}}
     175
     176
     177That should immediately break into gdb at the instruction that caused the
     178fault.  At that point:
     179
     180{{{
     181(gdb) x/i $pc   # disassembles the instruction at the pc/%rip
     182(gdb) bt        # do a C backtrace
     183}}}
     184
     185Some Linux distributions provide debugging information and library source
     186for the standard libraries; on Fedora, this information is contained in
     187optional "debuginfo" packages.  If it's available, the information is
     188often very useful.
     189
     190----
    158191To cause GC (including the EGC) to run integrity checks on entry, add `-DGC_INTEGRITY_CHECKING` to the CDEFINES in the kernel Makefile and rebuild the kernel.  Alternately you can `(setq ccl::*gc-event-status-bits* 4)` at any time for the same effect.
    159192