Thread Syntax

Many debugger commands have thread identifiers as their parameters. A tilde ( ~ ) appears before the thread identifier.

The thread identifier can be one of the following values.

Thread identifier Description

~.

The current thread.

~#

The thread that caused the current exception or debug event.

~*

All threads in the process.

~Number

The thread whose index is Number.

~~[TID]

The thread whose thread ID is TID. (The brackets are required And you cannot add a space between the second tilde and the opening bracket.)

~[Expression]

The thread whose thread ID is the integer to which the numerical Expression resolves.

Threads are assigned indexes as they are created. Note that this number differs from the thread ID that the Microsoft Windows operating system uses.

When debugging begins, the current thread is the one that caused the present exception or debug event (or the active thread when the debugger attached to the process). That thread remains the current thread until you specify a new one by using a ~s (Set Current Thread) command or by using the Processes and Threads window in WinDbg.

Thread identifiers typically appear as command prefixes. Note that not all wildcard characters are available in all commands that use thread identifiers.

An example of the ~[Expression] syntax would be ~[@$t0]. In this example, the thread changes depending on the value of a user-defined pseudo-register. This syntax allows debugger scripts to programmatically select a thread.

Controlling Threads in Kernel Mode

In kernel mode, you cannot control threads by using thread identifiers. For more information about how to access thread-specific information in kernel mode, see Changing Contexts.

Note  You can use the tilde character ( ~ ) to specify threads during user-mode debugging. In kernel-mode debugging, you can use the tilde to specify processors. For more information about how to specify processors, see Multiprocessor Syntax.