Debugging kernel modules

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
scgtrp
Member
Member
Posts: 30
Joined: Sat Mar 28, 2009 7:32 pm

Debugging kernel modules

Post 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.
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Debugging kernel modules

Post 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.
User avatar
scgtrp
Member
Member
Posts: 30
Joined: Sat Mar 28, 2009 7:32 pm

Re: Debugging kernel modules

Post 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.
mikeee
Posts: 7
Joined: Wed Mar 18, 2009 8:04 am

Re: Debugging kernel modules

Post by mikeee »

Could "add-symbol-file" be what you're looking for?
Post Reply