0

我正在尝试调试一些行为奇怪的 .NET 可执行文件(我没有源代码)。

使用 WinDBG 附加到它时,我注意到它抛出了 IndexOutOfRangeException。

我试图了解哪一行实际上引发了这个异常——我怎样才能看到导致这个异常的索引访问?

我可以使用 !CLRStack 查看堆栈,但它并没有引导我找到抛出它的确切代码行。

这就是我在 !CLRStack 中看到的:

 0015ec9c 6f1459d8 System.Management.Instrumentation.InstrumentedAssembly+TypeInfo.Fire(System.Object)
0015eccc 6f144bdc System.Management.Instrumentation.InstrumentedAssembly.Fire(System.Type, System.Object)
0015ecd8 6f145164 System.Management.Instrumentation.InstrumentedAssembly.Fire(System.Object)
0015ecec 6f142268 System.Management.Instrumentation.Instrumentation.Fire(System.Object)
0015ecf8 034ce47b InstallerLibrary.InstallerInterface.WMIEventGenerator.FireEvent(System.Object)
0015ed2c 0393970c InstallerLibrary.InstallerInterface.WMIEventGenerator.GenerateServerAlive(UInt32)
0015ed54 039396b7 InstallerLibrary.InstallerInterface.InstallerInterface.NotifyServerAlive(UInt32)
0015ed60 03939655 InstallerLibrary.InstallaterManager.NotifyServerAlive(UInt32)
0015ed88 00580f13 InstallerInit.Class1.Main(System.String[])
4

2 回答 2

1

行号信息存储在 pdbs 中。如果您没有私有符号,则 !clrstack 将无法提供该符号

sosex 扩展可以在使用 !mk 时提供 IL 偏移,即使没有 pdb。

要查看导致此问题的索引访问,您可以使用 !clrstack -a 或使用 sosex !mdv 查看本地人

于 2011-05-15T12:15:49.450 回答
0

使用 !dso 在异常时转储堆栈对象。您还将在堆栈中以整数形式获取索引。这将帮助您缩小代码范围。

也使用 !dumpheap -type IndexOutOfRangeException。并记下对象地址(比如 xxx)。现在使用 !pe xxx 查看 IndexOutOfRangeException 的异常堆栈。

于 2012-03-27T06:45:51.500 回答