|
|
The SVR5 kernel maintains a dynamic symbol table in kernel address space that contains all global symbols defined in the static kernel as well as all global symbols defined in all currently loaded modules. The contents of the dynamic symbol table change as modules are loaded and unloaded; when a module is loaded, its symbolic information is added to the table, and when the module is unloaded, its symbolic information is deleted.
Note that the symbols defined in loadable modules are not known to the kernel debuggers until they have been successfully relocated and resolved during loading. When debugging routines are called while a DLKM's _load(D2) entry point is executing, it is useful to have access to the module's symbols as soon as possible.
The best way to do this in a DDI 8 driver is:
%esp r b qto single step until the symbol availability flag is set (about 10 instructions). Once available, the loadable module's symbols can be accessed in the same manner as you would access any other kernel symbol.
The call_demon( ) function is not available to pre-DDI 8 drivers. For earlier drivers, you can create a small stub driver with a single entry point that is called at the beginning of the real driver's _load( ) entry point. Load the stub driver first, and set a break point on the stub driver's single entry point routine so you end up in kdb when it is called. To resume the real driver at the return point, issue the following string from inside kdb:
$esp r b q
For information about the dynamic symbol table, see the getksym manual page.