private void AddBacktrace(IEnumerable <StackFrame> stackTrace, int skipFrames, bool skipInterpreterRunMethod)
        {
            if (stackTrace != null)
            {
                foreach (var frame in InterpretedFrame.GroupStackFrames(stackTrace))
                {
                    string methodName, file;
                    int    line;

                    if (_interpretedFrames != null && _interpretedFrameIndex < _interpretedFrames.Count &&
                        InterpretedFrame.IsInterpretedFrame(frame.GetMethod()))
                    {
                        if (skipInterpreterRunMethod)
                        {
                            skipInterpreterRunMethod = false;
                            continue;
                        }

                        InterpretedFrameInfo info = _interpretedFrames[_interpretedFrameIndex++];

                        if (info.DebugInfo != null)
                        {
                            file = info.DebugInfo.FileName;
                            line = info.DebugInfo.StartLine;
                        }
                        else
                        {
                            file = null;
                            line = 0;
                        }
                        methodName = info.MethodName;

                        // TODO: We need some more general way to recognize and parse non-Ruby interpreted frames
                        TryParseRubyMethodName(ref methodName, ref file, ref line);

                        if (methodName == InterpretedCallSiteName)
                        {
                            // ignore ruby interpreted call sites
                            continue;
                        }
                    }
                    else if (TryGetStackFrameInfo(frame, out methodName, out file, out line))
                    {
                        // special case: the frame will be added with the next frame's source info:
                        if (line == NextFrameLine)
                        {
                            _nextFrameMethodName = methodName;
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }

                    if (_nextFrameMethodName != null)
                    {
                        if (skipFrames == 0)
                        {
                            _trace.Add(MutableString.Create(FormatFrame(file, line, _nextFrameMethodName), _encoding));
                        }
                        else
                        {
                            skipFrames--;
                        }
                        _nextFrameMethodName = null;
                    }

                    if (skipFrames == 0)
                    {
                        _trace.Add(MutableString.Create(FormatFrame(file, line, methodName), _encoding));
                    }
                    else
                    {
                        skipFrames--;
                    }
                }
            }
        }