开发者

Debugging a IndexOutOfRangeException in WinDBG

i am trying to debug some .NET executable (that i don't have the source code for) which is acting strange.

When attaching to it using WinDBG, i've noticed it's throwing an IndexOutOfRangeException.

I am trying to understand which line is actually throwing this exception -- how can i see the index access that is causing this?

I can see the stack using !CLRStack but it doesn't lead me to the exact line of code that threw it.

This is what i see in !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.In开发者_StackOverflow中文版stallerInterface.InstallerInterface.NotifyServerAlive(UInt32)
0015ed60 03939655 InstallerLibrary.InstallaterManager.NotifyServerAlive(UInt32)
0015ed88 00580f13 InstallerInit.Class1.Main(System.String[])


The line number information is stored in pdbs. If you don't have privat symbols the !clrstack won't be able to provide that

The sosex extension can provide IL offset when using !mk even when there isn't pdbs.

To see the index access that is causing this you would have look at the locals using !clrstack -a or using sosex !mdv


Use !dso to dump the stack objects at the time of exception. You will be getting the index also as an integer in the stack. This will help you in narrowing down on the code.

Also use !dumpheap -type IndexOutOfRangeException. And note the object address(say xxx). Now use !pe xxx to see the exception stack for IndexOutOfRangeException.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜