// Construct a stack frame from packed exception or thread frame data. internal StackFrame(PackedStackFrame frame, bool needFileInfo) { offset = frame.offset; nativeOffset = frame.nativeOffset; #if CONFIG_REFLECTION method = MethodBase.GetMethodFromHandle(frame.method); if(needFileInfo && method != null && offset != OFFSET_UNKNOWN) { filename = InternalGetDebugInfo (frame.method, offset, out line, out column); } #endif }
// Unpack a stack trace which was encoded into an exception or thread. private void UnpackStackTrace(PackedStackFrame[] trace, int skipFrames, bool needFileInfo) { int traceSize, posn; // Get the size of the packed stack trace. if(trace != null) { traceSize = trace.Length; } else { traceSize = 0; } // Validate the "skipFrames" parameter. if(skipFrames < 0) { skipFrames = 0; } else if(skipFrames > traceSize) { skipFrames = traceSize; } // Convert the trace information into its expanded form. numFrames = traceSize - skipFrames; frames = new StackFrame [numFrames]; for(posn = 0; posn < numFrames; ++posn) { frames[posn] = new StackFrame(trace[posn + skipFrames], needFileInfo); } }