You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WinDbg中StopOnException命令的伪寄存器编号参数作用是什么?

Understanding the Pseudo-Register Parameter in WinDbg's !soe Command

Great question about that often-overlooked parameter in the !soe (StopOnException) command! Let me break down exactly what it does:

  • Core Purpose: The <pseudo-register number for result> tells WinDbg to store the memory address of the caught exception object into a specific pseudo-register when the debugger pauses on the specified exception. This lets you quickly reference the exception for further debugging without having to hunt down its address manually.

WinDbg uses pseudo-registers named $r0 through $r15 (the number you pass maps directly to the suffix here). For example, in the sample command:

!soe -create System.OutOfMemoryException 1

When a System.OutOfMemoryException is thrown and the debugger stops, the address of that exception object will be saved to $r1.

Practical Use Case

Right after the debugger pauses, you can use the pseudo-register to inspect the exception details immediately. For example:

!dumpobj $r1

This command will dump all the properties, inner exceptions, and other metadata of the OutOfMemoryException object stored in $r1—saving you the step of locating the exception address via stack frames or other commands.

If you omit this parameter, the debugger will still pause on the exception, but you'll have to manually retrieve the exception address through other means (like examining the current stack frame's exception pointer), which is less efficient.

内容的提问来源于stack exchange,提问作者StayOnTarget

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 17:42:46