Date: Tue, 29 Jan 2008 18:55:37 -0500 From: John Baldwin <jhb@freebsd.org> To: src-committers@freebsd.org Cc: cvs-src@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/gnu/usr.bin/gdb/kgdb kgdb.h kld.c trgt.c Message-ID: <200801291855.37308.jhb@freebsd.org> In-Reply-To: <200801292344.m0TNiYrd039016@repoman.freebsd.org> References: <200801292344.m0TNiYrd039016@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 29 January 2008 06:44:34 pm John Baldwin wrote:
> jhb 2008-01-29 23:44:34 UTC
>=20
> FreeBSD src repository
>=20
> Modified files:
> gnu/usr.bin/gdb/kgdb kgdb.h kld.c trgt.c=20
> 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 i=
ts
> 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:=
=20
Undefined symbol "ps_pglobal_lookup"]
Reading symbols from /boot/kernel/iwi_bss.ko...Reading symbols=20
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=20
from /boot/kernel/logo_saver.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/logo_saver.ko
#0 sched_switch (td=3D0xc08fdb90, newtd=3DVariable "newtd" is not availabl=
e.
) at /usr/src/sys/kern/sched_ule.c:1905
1905 cpuid =3D PCPU_GET(cpuid);
(kgdb) info sharedlibrary
=46rom 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:=
=20
Undefined symbol "ps_pglobal_lookup"]
Reading symbols from /boot/modules/crash.ko...Reading symbols=20
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
=46rom 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
=2E..
0xc089a950 - 0xc089a96c is set_scrndr_set
=2D--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
=2E..
=2D-=20
John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801291855.37308.jhb>
