许多调试器命令将进程标识符作为其参数。 垂直条形图 (|) 显示在进程标识符之前。
进程标识符可以是以下值之一。
| Process identifier | Description |
|---|---|
|. |
当前进程。 |
|# |
导致当前异常或调试事件的进程。 |
|* |
All processes. |
| Number |
The process whose ordinal is Number. |
|~[PID] |
The process whose process ID is PID. (括号是必需的,不能在波形符(~)和左方括号之间添加空格。 |
|[Expression] |
The process whose process ID is the integer to which the numerical Expression resolves. |
进程在创建时分配序号。 请注意,此数字不同于Microsoft Windows作系统使用的进程 ID(PID)。
当前进程定义内存空间和使用的线程集。 调试开始时,当前进程是导致当前异常或调试事件(或调试器附加到的进程)的进程。 该进程将保持当前进程,直到使用 |s(设置当前进程) 命令或使用 WinDbg 中的 “进程和线程”窗口 来指定新进程。
进程标识符用作多个命令中的参数,通常用作命令前缀。 请注意,WinDbg 和 CDB 可以调试原始进程创建的子进程。 WinDbg 和 CDB 还可以附加到多个不相关的进程。
An example of the |[Expression] syntax would be |[@$t0]. 在此示例中,进程会根据用户定义的伪寄存器的值而更改。 此语法允许调试器脚本以编程方式选择进程。
在内核模式下控制进程
在内核模式下,无法使用进程标识符控制进程。 For more information about how to access process-specific information in kernel mode, see Changing Contexts.