Method 1: Using the lke subcommand

This method describes using the lke subcommand. The KDB lke subcommand displays a list of loaded kernel extensions.

To find the address of the modules for a particular extension use the KDB subcommand lke entry_number, where entry_number is the extension number of interest. A list of Process Trace Backs that shows the beginning addresses of routines contained in the extension is in the displayed data.

Note: The default prompt is KDB(0)>.
  1. Determine the address where the kernel extension is loaded. For information about how to do this, see Viewing and modifying global data.
  2. List all loaded extensions by typing lke on the command line.

    The results should be similar to the following:

       ADDRESS     FILE FILESIZE    FLAGS MODULE NAME
    
    1 04E17F80 01303F00 000007F0 00000272  ./demokext
    2 04E17E80 0503A000 00000E88 00000248  /unix
    3 04E17C00 04FA3000 00071B34 00000272  /usr/lib/drivers/nfs.ext
    4 04E17A80 05021000 00000E88 00000248  /unix
    5 04E17800 01303B98 00000348 00000272  /usr/lib/drivers/nfs_kdes.ext
    6 04E17B80 04F96000 00000E34 00000248  /unix
    7 04E17500 01301A10 0000217C 00000272  /etc/drivers/blockset64
                         .
                         .

    Enter the Ctrl+C key sequence to exit the KDB kernel debugger paging function. Pressing Enter displays the next page of data. Pressing the Spacebar displays the next line of data. The number of lines per page can be changed by typing set screen_size nn on the command line where nn is the number of lines per page.

  3. List detailed information about the extension of interest.

    The parameter to the lke subcommand is the slot number for the ./demokext entry from the previous step. To display information for slot 1, type the following on the command line:

    lke 1

    The output from this command is similar to:

         ADDRESS     FILE FILESIZE    FLAGS MODULE NAME
    
      1 04E17F80 01303F00 000007F0 00000272  ./demokext
    le_flags....... TEXT KERNELEX DATAINTEXT DATA DATAEXISTS
    le_next........ 04E17E80 le_fp.......... 00000000
    le_filename.... 04E17FD8 le_file........ 01303F00
    le_filesize.... 000007F0 le_data........ 013045C8
    le_tid......... 00000000 le_datasize.... 00000128
    le_usecount.... 00000003 le_loadcount... 00000001
    le_ndepend..... 00000001 le_maxdepend... 00000001
    le_ule......... 0502E000 le_deferred.... 00000000
    le_exports..... 0502E000 le_de.......... 6C696263
    le_searchlist.. B0000420 le_dlusecount.. 00000000
    le_dlindex..... 00002F6C le_lex......... 00000000
    le_fh.......... 00000000 le_depend.... @ 04E17FD4
    TOC@........... 013046D4
                                 <PROCESS TRACE BACKS>
                       .demokext 01304040                   .close_log 013041FC
                      .write_log 01304240                    .open_log 013042B4
                         .strcpy 01304320               .sprintf.glink 01304428
                 .fp_close.glink 01304450                      .strlen 01304480
                 .fp_write.glink 01304578               .fp_open.glink 013045A0

    From the PROCESS TRACE BACKS, you can see that the first instruction of demokext is at 01304040. The break for line 67 would be at this address plus E0.

  4. Set the break at the desired location by typing the following:
    b 01304040+e0

    KDB displays the address at which the breakpoint is located.

  5. Clear all breakpoints by typing the following:
    ca