[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Kernel Extensions and Device Support Programming Concepts

Conditional Subcommands

test Subcommand

The test subcommand can be used in conjunction with the bt subcommand to break at a specified address when a condition becomes true. This is done by including the test subcommand in a script that is executed when a trace point set by the bt command is hit. When included in a script, the test command evaluates the specified condition, and if true causes a break.

Syntax

 

test cond

Aliases: [

The conditional test requires two operands and a single operator. Values that can be used as operands in a test subcommand include symbols, hexadecimal values, and hexadecimal expressions. Comparison operators that are supported include: ==, !=, >=, <=, >, and <. Additionally, the bitwise operators ^ (exclusive OR), & (AND), and | (OR) are supported. When bitwise operators are used, any non-zero result is considered to be true.

Note
The syntax for the test subcommand requires that the operands and operator be delimited by spaces. This is very important to remember if the [ alias is used. For example the subcommand test kernel_heap != 0 can be written as [ kernel_heap != 0 ]. However, this would not be a valid command if kernel_heap, !=, and 0 were not preceded by and followed by spaces.
Example

   KDB(0)> bt open "[ @sysinfo >= 3d ]" stop on open() if condition true
   KDB(0)> e exit debugger
   ...
   Enter kdb [ @sysinfo >= 3d ]
   KDB(1)> bt display current active trace break points
   0:      .open+000000 (sid:00000000)  trace {hit: 1} {script: [ @sysinfo >= 3d ]}
   KDB(1)> dw sysinfo 1 print sysinfo value
   sysinfo+000000: 0000004A

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]