Method 1: Using the symbol name

This method demonstrates the simplest method of accessing global data. This is the primary method of accessing global data when using the KDB kernel debugger.

Global variables within the KDB kernel debugger can be accessed directly by name. For example, the dw subcommand can be used to display the value of the demokext_j variable. If the demokext_j variable is an array, a specific value can be viewed by adding the appropriate offset (for example, dw demokext_j+20). Access to individual elements of a structure is accomplished by adding the proper offset to the base address for the variable.

Note: The default prompt is KDB(0)>.

To view and modify global variables using the symbol name, do the following:

  1. Display a word at the address of the demokext_j variable with the following command:
    dw demokext_j

    Because the kernel extension was just loaded, this variable should have a value of 99 and the KDB kernel debugger should display that value. The data displayed should be similar to the following:

    demokext_j+000000: 00000063 01304040 01304754 00000000  ...c.0@@.0GT....
  2. Turn off symbolic name translation by typing the following:
    ns
  3. To display the word at the address of the demokext_j variable, type the following:
    dw demokext_j

    With symbolic name translation turned off, the data displayed should be similar to the following:

    01304744: 00000063 01304040 01304754 00000000  ...c.0@@.0GT....
  4. Turn symbolic name translation on by typing the following:
    ns
  5. Modify the word at the address of the demokext_j variable by typing the following:
    mw demokext_j

    The KDB kernel debugger displays the current value of the word and waits for user input to change the value. The data displayed should be similar to the following:

    01304744:  00000063  =

    Type a new value and press Enter. After a new value is entered, the next word of memory is displayed for possible modification. To end memory modification type a period (.) and press Enter. Type a value of 64 (100 decimal) for the first address, type a period and press Enter to end modification.