cvs commit: src/gnu/usr.bin/gdb/kgdb kgdb.h main.c trgt.c

Yar Tikhiy yar at FreeBSD.org
Wed Jan 23 09:33:08 PST 2008


On Thu, Jan 17, 2008 at 04:52:30PM -0500, John Baldwin wrote:
> On Thursday 17 January 2008 04:43:12 pm John Baldwin wrote:
> > jhb         2008-01-17 21:43:12 UTC
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     gnu/usr.bin/gdb/kgdb kgdb.h main.c trgt.c 
> >   Log:
> >   Add a new 'add-kld <kld>' command to kgdb to make it easier to analyze
> >   crash dumps with kernel modules.  The command is basically a wrapper
> >   around add-symbol-file except that it uses the kernel linker data
> >   structures and the ELF section headers of the kld to calculate the
> >   section addresses add-symbol-file needs.
> 
> Forgot to say:
> 
> Tested on:	i386, amd64
> 
> A sample run on i386:
> 
> > sudo ./kgdb -c /usr/crash/vmcore.10 /boot/kernel/kernel
> ...
> crash: blow the kernel stack on purpose
> 
> Fatal double fault:
> eip = 0xc05c6220
> esp = 0xe61b0000
> ebp = 0xe61b0018
> panic: double fault
> KDB: enter: panic
> ...
> (kgdb) where
> #0  doadump () at pcpu.h:195
> #1  0xc05d399c in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:417
> #2  0xc05d3c0a in panic (fmt=Variable "fmt" is not available.
> ) at /usr/src/sys/kern/kern_shutdown.c:571
> #3  0xc08115d9 in dblfault_handler () at /usr/src/sys/i386/i386/trap.c:927
> #4  0xc05c6220 in mtx_pool_setup_dynamic ()
> #5  0xc065e125 in arc4rand (ptr=0xe61b0168, len=4, reseed=0)
>     at /usr/src/sys/libkern/arc4random.c:142
> #6  0xc065e171 in arc4random () at /usr/src/sys/libkern/arc4random.c:150
> #7  0xc3d43402 in ?? ()
> #8  0xb15ac28c in ?? ()
> #9  0x793b5626 in ?? ()
> #10 0xe61b018c in ?? ()
> #11 0xc3d43410 in ?? ()
> #12 0xbc8e58bf in ?? ()
> ...
> (kgdb) add-kld crash.ko
> add symbol table from file "/boot/modules/crash.ko.symbols" at
>         .text_addr = 0xc3d416f0
>         .data_addr = 0xc3d44000
>         .bss_addr = 0xc3d44254
>         .rodata_addr = 0xc3d4364e
> Reading symbols from /boot/modules/crash.ko.symbols...done.

Thank you!

By the way, if there are a lot of modules to load, using asf(8)
might be a little easier: one needs to run asf once and then he
can source its output (written to .asf by default) into the kgdb
session.  Just a little advertisment so that my work on asf(8)
doesn't fall into oblivion. :-)

OTOH, I can imagine `add-all-klds' command for kgdb implemented in
a similar vein since there is a full list of loaded modules in the
core image.

Yar


More information about the cvs-src mailing list