User-defined variables

Both the KDB kernel debugger and the kdb command allow for user-defined variables. These variables can be used to provide a custom name for a memory address or an alias for a commonly used subcommand.

After a user-defined variable is created, every occurrence of that variable in a subcommand is automatically replaced with the value assigned to the variable.

Variable substitution occurs before any other parsing of the subcommand. This allows a single variable to expand into multiple subcommand arguments. The varset, varrm, and varlist subcommands are used respectively for assigning, removing, and listing user-defined variables. The following is an example of how user-defined variables are used:

KDB(0)> varset myvar kdb_avail
KDB(0)> dw myvar
<<dw kdb_avail>>
kdb_avail+000000: 00000001 00000000 0800004C 00001C43  ...........L...C
KDB(0)> varset myvar kdb_avail 1
KDB(0)> dw myvar
<<dw kdb_avail 1>>
kdb_avail+000000: 00000001                                   ....
KDB(0)>

Any time a user variable expansion takes place at the debugger prompt, the expanded command line is printed between the << and >> marks.