许多调试器命令将线程标识符作为其参数。 平铺 (~) 显示在线程标识符之前。
线程标识符可以是以下值之一。
Thread identifier | Description |
---|---|
~. |
当前线程。 |
~# |
导致当前异常或调试事件的线程。 |
~* |
进程中的所有线程。 |
~ Number |
The thread whose index is Number. |
~~[TID] |
The thread whose thread ID is TID. (需要方括号,不能在第二个波形符和左方括号之间添加空格。 |
~[Expression] |
The thread whose thread ID is the integer to which the numerical Expression resolves. |
线程在创建时分配索引。 请注意,此数字不同于Microsoft Windows作系统使用的线程 ID。
调试开始时,当前线程是导致当前异常或调试事件(或者调试器附加到进程的活动线程)的线程。 该线程将保留当前线程,直到使用 ~s(设置当前线程) 命令或使用 WinDbg 中的 “进程和线程”窗口 指定新线程。
线程标识符通常显示为命令前缀。 请注意,并非所有通配符都可用于使用线程标识符的所有命令。
An example of the ~[Expression] syntax would be ~[@$t0]
. 在此示例中,线程会根据用户定义的伪寄存器的值而更改。 此语法允许调试器脚本以编程方式选择线程。
在内核模式下控制线程
在内核模式下,无法使用线程标识符来控制线程。 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. 在内核模式调试中,可以使用波形符指定处理器。 For more information about how to specify processors, see Multiprocessor Syntax.