FreeBSD kernel Debugging tools for Virtual Memory Module

Eugene Grosbein eugen at kuzbass.ru
Fri Jan 2 08:56:16 UTC 2009


On Thu, Jan 01, 2009 at 06:27:44PM -0800, Kamlesh Patel wrote:

> I am working on Virtual Memory parts of FreeBSD OS. My Problem is, whenever i modify little code of vmpage.c file i need to build the whole kernel to check the modification and i even am not able to debug the kernel code.
> 
> Could anyone please inform me kernel Debugging tools for FreeBSD OS?

First, you need to recompile source you change for sure :-)
But you have not rebuild all other files all the time.
You need to add to your /etc/src.conf (or /etc/make.conf for 6.x and earlier):

MODULES_WITH_WORLD=yes

This will skip rebuilding of all modules during 'make buildkernel'
but you MUST to copy all modules from /boot/kernel to /boot/modules
(all files other than /boot/kernel/kernel*) if you do this.
Otherwise, you'll lose modules and system may not boot due to missing
vital modules like acpi.ko

Then, if you do not change kernel config file,
recompile your changes with command (only second time and then):

cd /usr/src; make NO_KERNELDEPEND=yes NO_KERNELCLEAN=yes buildkernel

So, your rebuild time changes drastically: no modules rebuild,
no other sources rebuild other that you touched last time.
It will relink previously compiled object code with your changes only,
that's way much quicker. Reinstall kernel and reboot.

Second, you should use some kind of virtual machine (like qemu from ports)
to speedup your development cycle even more: install the system
into virtual machine and you'll need not another box to debug the kernel
and need not rebuild your development box. Test your changes with the system
installed into VM and reboot it only. Use ddb or kgdb already noted here.

Eugene Grosbein


More information about the freebsd-hackers mailing list