How to load debug symbols of external linux module in gdbd?
13:48 03 Mar 2026

Could you please help me with the following GDB debugging scenario:

I have a vmlinux image with debug symbols. I also have a kernel module (.ko file) that I need to debug. However, I need to debug the module during its initialization (i.e., the very moment it is loaded and probed). This means I cannot load the module first, then check /proc/modules for its load address, and then add symbols — by the time I do that, the initialization code I want to debug has already run.

Is there a way to load the debug symbols for my kernel module before it is actually loaded into the kernel, so that when QEMU starts and GDB connects to the kernel, I can set breakpoints on functions in my module and have them resolved automatically when the module is loaded?

c debugging linux-kernel gdb