許多偵錯工具命令都有執行緒識別碼作為其參數。 波浪號 ( ~ ) 出現在執行緒識別碼之前。
執行緒識別碼可以是下列其中一個值。
| 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.