# Debugging FreeBSD kernel



## bv_arvind (Jan 9, 2013)

Hi,

I am using FB FreeBSD in a Xen environment. I am working on a feature in the kernel and I noticed that booting up of the system suddenly slows down. The system does not hang though (it does not reach the console either). I am using a multi-core multi-threaded system and I am unable to break into ddb after the threads are spawned. I was wondering if there was way to get 'top' style output in kernel when the system is booting up to check the status of the background processes.

Thanks


----------



## SirDice (Jan 9, 2013)

Not sure if it's going to work on XEN but you might want to check out remote kernel debugging. 

FreeBSD Developers' Handbook: 10.5 On-Line Kernel Debugging Using Remote GDB
(Yes, we have a handbook for everything  )


----------



## bv_arvind (Jan 9, 2013)

Thank you for pointing out the link. I can enable the debugger and start the kernel debugging. However I have smp enabled and I am running on multi-core machine. So even if I am able to set a break point, it doesn't stop at the console but it keeps continuing. I also suspect it's not a foreground process that's slowing it down but a background process. I am essentially looking for programmatically having "top" output in kernel code [ Not sure if there is any call to achieve this]

Thanks
Arvind


----------



## ondra_knezour (Jan 9, 2013)

http://lists.freebsd.org/pipermail/freebsd-xen/2009-September/000305.html ?


----------



## bv_arvind (Jan 9, 2013)

Thanks. Ill take a look at the link and see if it helps.


----------



## bv_arvind (Jan 10, 2013)

I am using xen 4.1 and I don't have the xen/tools directory to apply patch. Can this be done on xen 4.1?


----------



## ondra_knezour (Jan 10, 2013)

http://www.xen.org/files/xensummit_intel09/xen-debugging.pdf
http://xenbits.xensource.com/ext/debuggers.hg - some references to Xen 4.1 in this repo

Side note - I never used any debugging on Xen, ale those references was found on Googles' first page in couple of minutes.


----------

