How to get anything useful out of kgdb?
Sean Bruno
sbruno at ignoranthack.me
Fri May 15 16:00:05 UTC 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On 05/15/15 08:50, John Baldwin wrote:
> On Saturday, May 09, 2015 10:20:46 AM Sean Bruno wrote:
>> tl;dr What are the kernel config options to get good output of
>> kgdb?
>>
>>
>> I'm trying to get the ability to debug and display internal
>> variables, as one does, with kgdb. I'm *must* be doing this
>> wrong as I cannot get any useful output from accessing variables
>> that were JUST accessed in order to invoke a panic() that I have
>> inserted. This is a GENERIC kernel without INVARIANTS and
>> without WITNESS:
>>
>> https://people.freebsd.org/~sbruno/wtf_kgdb.txt
>>
>> I seem to have debug enabled and am able to browse source, but I
>> obviously haven't compiled correctly as things are optimized
>> out.
>
> 1) gdb7 does a better job. I hope to get the kgdb patches into
> the port soon. If you are feeling brave:
>
> # add texinfo for HEAD % pkg install gmake bison
>
> % git clone https://github.com/bsdjhb/gdb.git % cd gdb % git
> checkout freebsd-7.9.0-kgdb % fetch
> http://people.freebsd.org/~jhb/gdb/build % sh ./build % cd obj #
> or obj.i386 for i386 % gmake
>
> Then use /path/to/git/gdb/obj/gdb/kgdb
>
> 2) Even with gdb7 it can't figure out variables that it should
> figure out sometimes. Other options are either to find the
> variable in a higher frame (e.g. if it is something like 'td' or a
> driver softc) or to start poking around in the dissassembly to work
> out which register it is in (or which register points to a
> structure that contains it) and go from there.
>
So one non-obvious thing that I'd like an explanation about: If I
manually break to the debbugger and cause a dump (doadump), how do I
poke around in the crash dump later on to find a thread that I'm
looking for, e.g. I want to poke at various bits inside em(4).
sean
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQF8BAEBCgBmBQJVVhgAXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx
MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5kTR0IANHGeY0qH9wj8OKBUcAV/anR
8fpZMd4KxBIxy+2K2/TsAHWbXYDS+q/0LBNLI919ArDmPdR00iJjnMOCmBc4gCJr
53943f1x5+qKgtVVN9rQdKfHl6SilG2EeVI79HJasVNaghiV7o5vseu8p6FtQgai
ytJPh5eWwBbNkYr0h9aNlXnODiqaZWLfwzSha/1VIU9nuhb1/zDh6O/MyvmuOF1B
zu9kaNRyLSQBSe/YIK3D5pKiAotM4D/AQIkylc+Pan1G2JKIbqiaEqpETnjNQTSM
BbVv7ccTEQXb+jow09z4JsAXyphVU7Jn+XdB7xnw0cUNkuUWMPy7x98dOJ10rM0=
=jntV
-----END PGP SIGNATURE-----
More information about the freebsd-hackers
mailing list