Subject: Re: debugging kernel core dumps ?
To: None <burgess@s069.infonet.net>
From: Greg Earle <earle@isolar.Tujunga.CA.US>
List: current-users
Date: 09/10/1994 22:22:28
Dave Burgess writes:
>>> Having compiled a NetBSD(-current)/sparc kernel with the DEBUG and
>>> DIAGNOSTIC options in, how do I then debug the core dumps ?
>>
>> Good question. I would have used adb -k, but adb doesn't exist under
>> NetBSD/sparc (which is a pain for more reasons than just kernel
>> coredumps!).
>>
>>> gdb won't recognise vmcore,
>>
>> Did you try gdb -k? Just a guess by analogy to adb -k....
>>
>
>If this works, I will add it to the FAQ. If not, then what would the
>correct incantation to make it go be?
Yes, "gdb -k netbsd.N vmcore.N" works - sort of. It puts you into a "kgdb"
mode.
The reason I say "sort of" is because I'm puzzled by this behavior - I also
have a kernel with options like
...
# Standard system options
options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
options DEBUG, DIAGNOSTIC # extra kernel debugging
options KTRACE # system call tracing support
options KGDB # support for kernel gdb
options KGDBDEV=0xc01, KGDBRATE=38400 # device & baud rate
...
(I don't have "device-pseudo ddb" or "pseudo-device ddb" or "options DDB",
however.)
Twice in the last month I've had my machine (SPARCstation IPC, NetBSD/SPARC)
go down with a "panic: rtfree". Running "gdb -k netbsd.1 vmcore.1" yields
netbsd4me [/var/crash] # gdb -k netbsd.1 vmcore.1
(no debugging symbols found)...panic: rtfree 2
#0 0xf8006c9c in snapshot ()
(kgdb) where
#0 0xf8006c9c in snapshot ()
#1 0xf8006ca4 in snapshot ()
#2 0xf80a21a0 in boot ()
#3 0xf8017818 in panic ()
#4 0xf804055c in rtfree ()
#5 0xf8040a6c in rtrequest ()
#6 0xf80414dc in route_output ()
#7 0xf80401f0 in raw_usrreq ()
#8 0xf80411c0 in route_usrreq ()
#9 0xf80233a8 in sosend ()
...
(kgdb)
Why does it say "No debugging symbols found" (and apparently there aren't) if
I built the kernel with "options DEBUG, DIAGNOSTIC"? Presumably because my
kernel compile Makefile (i.e., /sys/arch/sparc/compile/NETBSD4ME/Makefile) has
CFLAGS= ${COPTS} -O2
in it. I guess I would have assumed that config.new would see "options DEBUG"
and make it "CFLAGS= ${COPTS} -g" instead? The man page for config.new
admonishes
The old undocumented-gflag is no longer supported. Instead, use
``makeoptions DEBUG="-g"'' and (typically) ``options KGDB''.
Perhaps a reminder that `options DEBUG, DIAGNOSTIC' *and* `makeoptions
DEBUG="-g"' are probably both needed to get crash dumps working is in order?
- Greg