Multiprocessor Syntax

KD and kernel-mode WinDbg support multiple processor debugging. You can perform this kind of debugging on any multiprocessor platform.

Processors are numbered zero through n.

If the current processor is processor 0 (that is, if it is the processor that currently caused the debugger to be active), you can examine the other non-current processors (processors one through n). However, you cannot change anything in the non-current processors. You can only view their state.

Selecting a Processor

You can use the .echocpunum (Show CPU Number) command to display the processor numbers of the current processor. The output from this command enables you to immediately tell when you are working on a multiple processor system by the text in the kernel debugging prompt.

In the following example, 0: in front of the kd> prompt indicates that you are debugging the first processor in the computer.

0: kd>

Use the ~s (Change Current Processor) command to switch between processors, as the following example shows.

0: kd> ~1s
1: kd>

Now you are debugging the second processor in the computer.

You might have to change processors on a multiprocessor system if you encounter a break and you cannot understand the stack trace. The break might have occurred on a different processor.

Specifying Processors in Other Commands

You can add a processor number before several commands. This number is not preceded by a tilde (~), except in the ~S command.

Note   In user-mode debugging, the tilde is used to specify threads. For more information about this syntax, see Thread Syntax.

Processor IDs do not have to be referred to explicitly. Instead, you can use a numerical expression that resolves to an integer that corresponds to a processor ID. To indicate that the expression should be interpreted as a processor, use the following syntax.

||[Expression]

In this syntax, the square brackets are required, and Expression stands for any numerical expression that resolves to an integer that corresponds to a processor ID.

In the following example, the processor changes depending on the value of a user-defined pseudo-register.

||[@$t0]

Examples

The following example uses the k (Display Stack Backtrace) command to display a stack trace from processor two.

1: kd> 2k 

The following example uses the r (Registers) command to display the eax register of processor three.

1: kd> 3r eax 

However, the following command gives a syntax error, because you cannot change the state of a processor other than the current processor.

1: kd> 3r eax=808080 

Breakpoints

During kernel debugging, the bp, bu, bm (Set Breakpoint) and ba (Break on Access) commands apply to all processors of a multiple processor computer.

For example, if the current processor is three, you can enter the following command to put a breakpoint at SomeAddress.

1: kd> bp SomeAddress 

Then, any processor (not only processor one) that executes at that address causes a breakpoint trap.

Displaying Processor Information

You can use the !running extension to display the status of each processor on the target computer. For each processor, !running can also display the current and next thread fields from the process control block (PRCB), the state of the 16 built-in queued spinlocks, and a stack trace.

You can use the !cpuinfo and !cpuid extensions to display information about the processors themselves.