Re: Examining core dump with gdb

Martin Husemann <[email protected]> Wed, 12 Mar 2025 11:16:19 +0100
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
On Wed, Mar 12, 2025 at 11:04:26AM +0100, Peter Skvarka wrote:
> Hello,
> I have /etc/defaults/rc.conf setup like described on:
> https://wiki.netbsd.org/tutorials/panic/ relating to savecore,
> savecore_flags, savecore_dir. (on NetBSD 10.1)
> 
> On the page is written:
> "...To load the core dump into gdb, after uncompressing it with gunzip(1),
> use target kvm /path/to/netbsd.core..."

Ideally you have a netbsd.gdb kernel from your kernel compile directory,
otherwise use plain netbsd. Then:

 gdb netbsd.gdb
 [..]
 gdb> target kvm netbsd.core

Martin
P.S.: you get a netbsd.gdb kernel from: build.sh kernel.gdb=GENERIC
or by passing "-D DEBUG=-g" to (nb)config when configuring the kernel.