Debug Kernel Modules With KGDB

Freeman Zhang freeman.zhang1992 at gmail.com
Mon Dec 1 04:56:09 EST 2014


Hi list,

I've been trying to setup a debug environment for linux
kernel(v3.4,Android,ARM) with kgdb. It worked fine untill I tried to use
it to debug a module. Under the instruction from LDD, I add module debug
info in gdb with command:

	add-symbol-file test-module.ko  address

LDD uses `cat /sys/module/test-module/sections/.text` to get the address
where the module has been loaded. However, I got:
	
	0x00000000

When I use `lsmod`, I got:

	test-module 15278 0 - Live 0x00000000 (O)

Why nothing but 0x00000000 ??

So I have to do some research in kernel/module.c, and find out that
struct module -> module_core = 0xbf000000. But when I try these in gdb:

	add-symbol-file test-module.ko  0xbf000000
	break one_of_my_function

I got:

	Cannot access memory at address 0xbf002350

:(
Could somebody help?


All the best!
Freeman Zhang

	
	


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141201/0c8874e6/attachment.bin 


More information about the Kernelnewbies mailing list