I would like to study the flow of some linux device drivers and some minimal flow of kernel (threading cum context switching and interrupt management).

How can I debug the linux kernel? What are the basic steps for doing that?

Recently i successfully compiled and integrated new kernel ( into my machine running the 2.6.29 kernel.

  • Linus is adamantly opposed to debuggers, so the support for that is rather scanty. Try to decipher the data flow you are interested in by reading the code, hanging out in lwn.net or kernelnewbies.org, reading books, ... [The problem is that much is time-critical, can't stop to take a peek, printk might mess up execution, ...]
    – vonbrand
    Jan 23, 2013 at 20:01

3 Answers 3


It depends on what you really need. Probably simple printk() function is gonna be OK for the beginning. There is also the /proc interface you can use to get useful information from kernel.

If you need something more complicated, use KGDB (kernel debugger).


Go to your kernel sources folder and have a look inside Documentation/ folder. Start with going through the file kernel-parameters.txt looking for references to debugging.

If your kernel is compiled with CONFIG_DEBUG_KERNEL option set, you can easily adjust the verbosity of kernel messages via the loglevel boot option.


The other options other then KGDB would be debugging the kernel using the QEMU and GDB. Unlike the KGDB, the QEMU-GDB combine requires only a single machine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .