Unloading and loading modules
  Home
  Introduction
  Getting KGDB
  Documentation
  Using KGDB
  Credits
  Miscellaneous
  Troubleshooting
  FAQ
  Copyright
  About KGDB
  GEEks of Pune (GEEP)

  Unloading a module and loading it again.

kgdb versions 1.9 and above are capable of detecting loading and unloading of modules. You can load and unload modules as and when needed. gdb will automatically load and unload object files corresponding to them. For kgdb versions 1.8 and earlier you have to use following procedure.

Unloading a module and loading it again in kgdb 1.8 and earlier.
A module can be unloaded as usual using rmmod command. You can again load it using loadmodule.sh script. After this you cannot immediately source the gdb script generated by loadmodule.sh script. This is because gdb will already have all the symbols loaded. You'll need to remove all of the symbol table from gdb and then start from scratch.

You can use the symbol-file command of gdb. symbol-file command removes existing symbol table and loads a new one. symbol-file vmlinux will load all vmlinux symbols from scratch. After this you can load module object files as per the usual procedure.

I have found that above procedure sometimes doesn't work correctly. A better way is to quit from gdb and start afresh. Please refer to using gdb for kernel debugging page for details. You'll need to remember that breakpoints placed by previous gdb will be absent when you load new gdb.