clrwindbgsosex

Navigate from stackframe to stackframe in the Managed stack inside CDB/WinDbg


I have been given a dozen of dump files. Using windbg/sosex command !dumpstack -EE, a lot of them show these lines by the end :

0aa6ce7c 028ea126 (MethodDesc 02756288 +0x16 TheCompany.Toolbox.Log.Logger.Info(System.String))
0aa6cecc 028ea126 (MethodDesc 02756288 +0x16 TheCompany.Toolbox.Log.Logger.Info(System.String))
0aa6cf54 028ea126 (MethodDesc 02756288 +0x16 TheCompany.Toolbox.Log.Logger.Info(System.String))
0aa6d080 6f42bc51 (MethodDesc 6f1da670 +0x81 System.TimeSpan.TimeToTicks(Int32, Int32, Int32))
0aa6d0a8 6f42c0a0 (MethodDesc 6f1daf1c +0x40 System.DateTime.TimeToTicks(Int32, Int32, Int32))
0aa6d0d0 6f42cb8f (MethodDesc 6f1da8ec +0x7f System.DateTime.Add(Double, Int32))

Unfortunately, trying to get the local variable with !clrstack -a does not give me sensible results:

0:045> !clrstack -a
OS Thread Id: 0xf50 (45)
Child SP       IP Call Site
0aa6ed78 76df7094 [GCFrame: 0aa6ed78]
0aa6ef5c 76df7094 [DebuggerU2MCatchHandlerFrame: 0aa6ef5c]

Is there a way to move to another frame than the last one ? ( so as to get the locals in this frame).

In native mode, I can do :

.frame @$.frame +1

then I can have the locals in that previous frame with

dv

I wonder how to do the same with the managed stack, so as I can do !clrstack -a inside previous frames. I also would like to know the function parameters value/reference in this stackframe.

Are there commands to perform such actions ?


Solution

  • Steve Johnson's SOSEX has the !mframe command.

    Although you have tagged the question , you have not used any SOSEX command, only SOS commands, which could be a reason why you did not find the command.

    You get the frame numbers from !mk. If you have DML enabled, the frame numbers can be clicked and a !mframe command is automatically done. After that, you can do !mdv to display arguments and locals.

    Alternatively, !mdv <frame> also takes a frame number directly.

    However, I'm not sure if this always helps. SOSEX can't do magic and needs to rely on the information given by the .NET framework. If that's broken for some reason, you could be unlucky.