Hello all, I found how to do it, I had asked it on stackoverflow.com and posted it as an answer there. Please see if you are interested. https://stackoverflow.com/questions/71749640/how-can-i-debug-kernel-module-r unning-on-a-virtual-machine/71753139#71753139 Thank you! Chan Kim
-----Original Message----- From: Chan Kim <ckim@etri.re.kr> Sent: Tuesday, April 5, 2022 6:54 PM To: 'qemu-discuss' <qemu-discuss@nongnu.org>; kernelnewbies@kernelnewbies.org Subject: How can I debug kernel module running on a virtual machine?
Hello all,
I think I have once read about this but can't find it now. I'm running linux-5.4.188 on a qemu arm64 virtual machine. Because I built the kernel from the source, I can debug(analyze) the kernel by attaching to the linux kernel program running on a remote machine(qemu virtual machine). To test an application which uses our device(the device model is in qemu too), I compiled a device driver against kernel 5.4.188 and the linux application and can do insmod the driver and run the application. Now something is wrong and I have panic while running the application. I can debug linux kernel itself, but I don't know where the kernel module was loaded, so the debugger cannot debug the driver module. How can I debug the device driver? (or even the application? in case I need to someday). I remember by first getting the loaded address of the kernel module, and doing add-symbol-file for the driver image relative to that loaded address, it is possible to do kernel module debug. I think this is what driver developers will be doing always. Please tell me how I can do it. If this is possible, it will save many days for me.
Thank you! Chan Kim