On Friday 24 March 2006 04:25, Mikado wrote: > - How can I debug loadable modules at run time? > > Here is my way: > > ( /tmp/mymodule.ko exists on both [Host] and [UML] ) > + [Host] # gdb linux > + [Host] (gdb) ... > + [Host] (gdb) r <params> > + [UML] # insmod /tmp/mymodule.ko > + [UML] # cat /sys/module/mymodule/sections/{.text,.bss,.data} > + [Host] (gdb) add-symbol-file /tmp/mymodule.ko <.text_addr> -s .bss > <.bss_addr> -s .data <.data_addr> > + ... > > Tell me if I was wrong, thanks! > > - How can I set breakpoint at module's init function? > > After add module's symbol, I set breakpoint at init function then > 'rmmod' then re-'insmod' but gdb didn't break at init function. What was > wrong?
gdb modifies the program code to set breakpoints, but the code is reloaded on module reload. So, break on the caller of the module init function, and step from there. Maybe Bahi's mail refers to 2.4, I'm not sure, but the concepts are the same. Most module-related code is in kernel/module.c, as for instance static LIST_HEAD(modules); which is the new name for module_list. > - Sometimes gdb can't follow source codes in '.h' header files. Did I > miss something? What happens? Maybe gdb is stepping there but the calls are inlined and it's not apparent that it's looking at source code. However I've not clear what you describe, anyway. -- Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade ___________________________________ Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive http://it.messenger.yahoo.com ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ User-mode-linux-user mailing list User-mode-linux-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user