I have developed an application demonstrating priority inversion in linux kernel and now I want to prove it by capturing certain context switches using kgdb. I have working setup to debug kernel on virtual machine (debian, kernel version 4.19.182) with gdb from my host with Ubuntu. I've achieved this setup with this guide: https://www.opensourceforu.com/2011/03/kgdb-with-virtualbox-debug-live-kernel/.

I compiled kernel with "Compile the kernel with debug info" option. I am able to set breakpoints on kernel functions, and everythings works fine. Now, I want to set conditional breakpoint on context_switch function, to break only on certain switches. To do so I need to add condition based on functions variables, but the problem is that they are optimised out:

enter image description here

Is threr any way to compile the kernel so that scheduler functions wouldn't be optimized out?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.