cvs commit: src/gnu/usr.bin/gdb/kgdb kgdb.h kld.c trgt.c
Attilio Rao
attilio at freebsd.org
Wed Jan 30 05:53:04 PST 2008
2008/1/30, John Baldwin <jhb at freebsd.org>:
> On Tuesday 29 January 2008 06:44:34 pm John Baldwin wrote:
> > jhb 2008-01-29 23:44:34 UTC
> >
> > FreeBSD src repository
> >
> > Modified files:
> > gnu/usr.bin/gdb/kgdb kgdb.h kld.c trgt.c
> > Log:
> > - Rework the kld support to hook into GDB's shared library support.
> > kgdb(8) now treats kld's as shared libraries relative to the kernel
> > "binary". Thus, you can use 'info sharedlibrary' to list the kld's
> > along with 'sharedlibrary' and 'nosharedlibrary' to manage symbol
> > loading and unloading. Note that there isn't an easy way to force GDB
> > to use a specific path for a shared library. However, you can use
> > 'nosharedlibrary' to unload all the klds and then use 'sharedlibrary'
> > to load specific klds where it gets the kld correct and use
> > 'add-kld' for the kld's where the default open behavior doesn't work.
> > klds opened via 'sharedlibrary' (and during startup) do have their
> > sections listed in 'info files'.
> > - Change the 'add-kld' command to use filename completion to complete its
> > argument.
>
> So now what it looks like:
>
> > sudo ./kgdb -q
> [GDB will not be able to debug user-mode threads: /usr/lib/libthread_db.so:
> Undefined symbol "ps_pglobal_lookup"]
> Reading symbols from /boot/kernel/iwi_bss.ko...Reading symbols
> from /boot/kernel/iwi_bss.ko.symbols...done.
> done.
> Loaded symbols for /boot/kernel/iwi_bss.ko
> Reading symbols from /boot/kernel/logo_saver.ko...Reading symbols
> from /boot/kernel/logo_saver.ko.symbols...done.
> done.
> Loaded symbols for /boot/kernel/logo_saver.ko
> #0 sched_switch (td=0xc08fdb90, newtd=Variable "newtd" is not available.
> ) at /usr/src/sys/kern/sched_ule.c:1905
> 1905 cpuid = PCPU_GET(cpuid);
> (kgdb) info sharedlibrary
> From To Syms Read Shared Object Library
> 0xc3e875a0 0xc3e8763b Yes /boot/kernel/iwi_bss.ko
> 0xc41077a0 0xc4107c28 Yes /boot/kernel/logo_saver.ko
>
> And for a crash dump:
>
> > sudo ./kgdb -q -c /usr/crash/vmcore.10 /boot/kernel/kernel
> [GDB will not be able to debug user-mode threads: /usr/lib/libthread_db.so:
> Undefined symbol "ps_pglobal_lookup"]
> Reading symbols from /boot/modules/crash.ko...Reading symbols
> from /boot/modules/crash.ko.symbols...done.
> done.
> Loaded symbols for /boot/modules/crash.ko
> #0 doadump () at pcpu.h:195
> 195 pcpu.h: No such file or directory.
> in pcpu.h
> (kgdb) info sharedlibrary
> From To Syms Read Shared Object Library
> 0xc3d416f0 0xc3d4364e Yes /boot/modules/crash.ko
> (kgdb) info files
> Symbols from "/boot/kernel/kernel".
> kernel core files:
> `/boot/kernel/kernel', file type elf32-i386-freebsd.
> 0xc04000d4 - 0xc04000e1 is .interp
> 0xc04000e4 - 0xc0410330 is .hash
> 0xc0410330 - 0xc0430b30 is .dynsym
> 0xc0430b30 - 0xc0451348 is .dynstr
> 0xc0451350 - 0xc0826880 is .text
> 0xc0826880 - 0xc084207c is .rodata
> 0xc084207c - 0xc08980ec is .rodata.str1.1
> 0xc08980ec - 0xc0899204 is set_sysctl_set
> 0xc0899204 - 0xc0899e20 is set_sysinit_set
> 0xc0899e20 - 0xc089a2ac is set_sysuninit_set
> 0xc089a2ac - 0xc089a7ec is set_modmetadata_set
> ...
> 0xc089a950 - 0xc089a96c is set_scrndr_set
> ---Type <return> to continue, or q <return> to quit---
> 0xc089b980 - 0xc08e702a is .data
> 0xc08e702c - 0xc08e7038 is .got
> 0xc08e7038 - 0xc08e70a0 is .dynamic
> 0xc08e70c0 - 0xc091691c is .bss
> 0xc3d3f094 - 0xc3d3f318 is .hash in /boot/modules/crash.ko
> 0xc3d3f318 - 0xc3d3f8d8 is .dynsym in /boot/modules/crash.ko
> 0xc3d3f8d8 - 0xc3d3fc7e is .dynstr in /boot/modules/crash.ko
> 0xc3d3fc80 - 0xc3d416f0 is .rel.dyn in /boot/modules/crash.ko
> 0xc3d416f0 - 0xc3d4364e is .text in /boot/modules/crash.ko
> 0xc3d4364e - 0xc3d43f4e is .rodata in /boot/modules/crash.ko
> ...
Thanks John, great work!
Attilio
--
Peace can only be achieved by understanding - A. Einstein
More information about the cvs-src
mailing list