I tried the KGDB tutorial to debug custom kernel provided on the webpage.
Everything works as posted, but I have problem stepping the code in “load_module”. When I hit step (F10), it only steps normally for a few lines of code, then jumps to “log_store” function in file “printk.c” and the session stops there. The output window shows “INFO: NMI handler (kgdb_nmi_handler) took too long to run: 9817.647 msecs”. Sometimes, it also shows “[sched_delayed] sched: RT throttling activated”. It looks like whenever there is something coming up in the output window, the session would get stuck at “log_store” function, or even sometimes “LinuxKernelDebugHelper” function.
It is very annoying when doing step like this. Is there any workaround for this problem?
I have also tried to use VMWare stub as well. But the problem is still there. But this time the session is frequently interrupted to the another function “native_apic_mem_write” at “apic.h”. The GDB session window shows like “Cannot access memory at address 0x202”. Sometimes also interrupted at “LinuxKernelDebugHelper”. The “cannot access memory…” error sometimes also occurs when using KGDB as well.
Finally, here is my system setup. I put my debugged system in a VMWare (10.0.4) virtual machine. The installed Linux distro is Ubuntu 14.04, the debugged kernel version is 18.104.22.168 (downloaded automatically by VisualKernel).
As I am new to kernel debugging, any suggestions will be appreciated. Thanks!
This happens because VisualKernel hooks the log_store() function in order to display the output of printk(). You can disable this feature via VisualKernel Project Properties (debug settings page), however then you won’t see the printk() output in Visual Studio.