如何以编程方式引用 WinDbg 中的断点?

How do I programmatically refer to a breakpoint in WinDbg?

程序断点 ID

Breakpoint Syntax (docs.microsoft.com) 声称这是关于使用 ID 表达式设置断点。

Breakpoint 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 breakpoint ID. To indicate that the expression should be interpreted as a breakpoint, use the following syntax.

b?[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 breakpoint ID.

这正是我想要做的。但是,它似乎对我不起作用。 他们给出的一个例子

b?[@$t0]

产生语法错误。我尝试了其他几种方法。

0:000> r $t0 = 300
0:000> ? $t0
Evaluate expression: 768 = 00000300
0:000> b?[@$t0]
        ^ Syntax error in 'b?[@$t0]'
0:000> b0
        ^ Syntax error in 'b0'
0:000> b
        ^ Syntax error in 'b'
0:000> bl?[@$t0]
        ^ Syntax error in 'bl?[@$t0]'
0:000> bl
 0 e 77c27d89     0001 (0001)  0:**** ntdll!LdrpDoDebuggerBreak+0x2b
0:000> bl0
 0 e 77c27d89     0001 (0001)  0:**** ntdll!LdrpDoDebuggerBreak+0x2b
0:000> bl300
0:000>

我真的不知道给出的示例是否可行,因为 bb0 不起作用。但是,我似乎无法对使用硬编码值的命令使用类似的语法。

我如何使用这个(神秘的?)功能?

(WinDbg 10.0.17134.12 X86)

什么是正则表达式替换其中任何一个 (p,u,a) 将表示 bp1 .. bpn | ba1 ... 禁令 | bu1 .. 面包

0:000> bl
 0 e 62e5f7a0     0001 (0001)  xxx
 1 e 62e5f7a2     0001 (0001)  xxx
 2 e 62e5f7a3     0001 (0001)  xxx
 3 e 62e5f7a5     0001 (0001)  xxx

0:000> bp[8-5]
breakpoint 3 exists, redefining
breakpoint 0 redefined
0:000>

或者更好的使用场景

0:000> bp .
0:000> bl
 0 e 77ac05a6     0001 (0001)  0:**** ntdll!LdrpDoDebuggerBreak+0x2c
0:000> r $t0 =0
0:000> bp[@$t0] ntdll!LdrpCompareServiceChecksum
breakpoint 0 exists, redefining
0:000> bl
 0 e 77a4b931     0001 (0001)  0:**** ntdll!LdrpCompareServiceChecksum
0:000> bp[@$t0] kernel32!CreateWaitableTimerExA
breakpoint 0 exists, redefining
0:000> bl
 0 e 77584202     0001 (0001)  0:**** kernel32!CreateWaitableTimerExA
0:000>