We can debug a kernel code simply with the command printks. Else we can also use KDB and kernel probes. Other methods are: