NetBSD kernel developer cheat-sheet

From NetBSD Wiki

Jump to: navigation, search

NetBSD kernel Developer cheat-sheet

This article is going to be a collection of random notes which I have found during my development in kernel. I have found that there are some hints which every developer knows, but there is no documentation where newbie can learn them.


Finding where the bug is

When you get crash in kernel you want to find way how to translate address from backtrace to line in source code.

Stopped in pid 496.1 (gdb) at netbsd:breakpoint+0x5: leave

you need to find address of breakpoint function in running kernel image with command nm.

nm netbsd | grep breakpoint

then add 0x5 to it and use addr2line to get exact line in kernel source code where you get crash.

addr2line -g netbsd {sum address}

What to do if gdb cannot backtrace through trap()

Use ('source') .../sys/arch/i386/gdbscripts/stack gdb script and run 'stack'. See also PR 10313.

Personal tools