Page 1 of 1
Debugging kernel modules
Posted: Wed May 27, 2009 4:10 pm
by scgtrp
Does anyone know of a way to debug a relocatable ELF kernel module via gdb/qemu? gdb won't load symbols from a .o file, and even if I try to link the module against the kernel with ld -R it still reports "no debugging symbols found" and won't show the source code.
Re: Debugging kernel modules
Posted: Wed May 27, 2009 4:55 pm
by NickJohnson
Are you talking about a Linux kernel module? I'll assume so, because I think you would know the details of your own module loading system if it was yours.
Did you check to see if the module was stripped for some reason? Just do readelf -s on it to list all the symbols: no symbols means it was stripped at some point, and can't be used with the debugger. Although, I'm not sure if it would even load if it was stripped...
I think it would be helpful to have some more info on the problem, such as what the module is, who compiled it, and why you're debugging it.
Re: Debugging kernel modules
Posted: Thu May 28, 2009 9:02 am
by scgtrp
Are you talking about a Linux kernel module? I'll assume so, because I think you would know the details of your own module loading system if it was yours.
No, I was looking for hints on using gdb with multiple files. Loading a new symbol-file appears to clear the old symbol list. I'm not debugging the module loading system, I'm debugging the module itself.
Re: Debugging kernel modules
Posted: Thu May 28, 2009 10:09 am
by mikeee
Could "add-symbol-file" be what you're looking for?