Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jan 2008 08:35:33 +0300
From:      Yar Tikhiy <yar@comp.chem.msu.su>
To:        John Baldwin <jhb@freebsd.org>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/gnu/usr.bin/gdb/kgdb kgdb.h main.c trgt.c
Message-ID:  <20080124053533.GA59743@comp.chem.msu.su>
In-Reply-To: <200801231546.59937.jhb@freebsd.org>
References:  <200801172143.m0HLhCm8016953@repoman.freebsd.org> <200801171652.31546.jhb@freebsd.org> <20080123173307.GA27907@freefall.freebsd.org> <200801231546.59937.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 23, 2008 at 03:46:59PM -0500, John Baldwin wrote:
> On Wednesday 23 January 2008 12:33:07 pm Yar Tikhiy wrote:
> > 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.
> 
> Actually, that is my next step is to make the kgdb auto-load all klds it can 
> find on startup.  asf(8) does work, but I find it a bit more work to have to 
> use an external utility to do it, and potentially more confusing for users.

Of course, asf(8) is inferior to auto-loading by kgdb.  asf(8) did
its job for me already, so I won't mind if it is retired now and
replaced by the better solution.  It's just what is called progress.

Many thanks for your work in this area!  If it were assigned to a
lazy person like me, people would have to use asf(8) forever. :-)

-- 
Yar



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080124053533.GA59743>