// frameInfoCode is the ClrFunctionId OR the NativeIP, depending on codeKind public bool TryGetFrameAtIndex(UInt16 index, out StackFrameCodeKind codeKind, out UInt64 frameInfoCode) { if (IsValid() && 0 <= index && index < GetFramesCountUnsafe()) { GetFrameAtIndexUnsafe(index, out codeKind, out frameInfoCode); return(true); } else { codeKind = StackFrameCodeKind.Unknown; frameInfoCode = 0; return(false); } }
public static void TryResolveStackFrameSymbols( StackFrameCodeKind frameCodeKind, UInt64 frameInfoCode, ref IntPtr pFunctionName, ref IntPtr pContainingTypeName, ref IntPtr pContainingAssemblyName) { if (Environment.Is64BitProcess) { if (!TryResolveStackFrameSymbols_x64(frameCodeKind, frameInfoCode, ref pFunctionName, ref pContainingTypeName, ref pContainingAssemblyName)) { ClrShutdownException.Throw("TryResolveStackFrameSymbols is called AFTER CLR shutdown"); } } else { if (!TryResolveStackFrameSymbols_x86(frameCodeKind, frameInfoCode, ref pFunctionName, ref pContainingTypeName, ref pContainingAssemblyName)) { ClrShutdownException.Throw("TryResolveStackFrameSymbols is called AFTER CLR shutdown"); } } }
[return : MarshalAs(UnmanagedType.Bool)] // default value, but use the attribute to make it explicit that it is a 4 bytes integer value (i.e. C BOOL on the native side) private static extern bool TryResolveStackFrameSymbols_x64( StackFrameCodeKind frameCodeKind, UInt64 frameInfoCode, ref IntPtr pFunctionName, ref IntPtr pContainingTypeName, ref IntPtr pContainingAssemblyName);
public void GetFrameAtIndexUnsafe(UInt16 index, out StackFrameCodeKind codeKind, out UInt64 frameInfoCode) { codeKind = (StackFrameCodeKind)Marshal.ReadByte(ptr: _dataPtr, ofs: 26 + index * 9); frameInfoCode = (UInt64)Marshal.ReadInt64(ptr: _dataPtr, ofs: 27 + index * 9); }