예제 #1
0
        internal void CompileCallStack(System.Text.StringBuilder sb, List <ulong> m_CachedCallstack, FrameDataView frameDataView)
        {
            sb.Append(BaseStyles.callstackText);
            sb.Append('\n');
            var fullCallStack = showFullDetailsForCallStacks;

            foreach (var addr in m_CachedCallstack)
            {
                var methodInfo = frameDataView.ResolveMethodInfo(addr);
                if (string.IsNullOrEmpty(methodInfo.methodName))
                {
                    if (fullCallStack)
                    {
                        sb.AppendFormat("0x{0:X}\n", addr);
                    }
                }
                else if (string.IsNullOrEmpty(methodInfo.sourceFileName))
                {
                    if (fullCallStack)
                    {
                        sb.AppendFormat("0x{0:X}\t\t{1}\n", addr, methodInfo.methodName);
                    }
                    else
                    {
                        sb.AppendFormat("{0}\n", methodInfo.methodName);
                    }
                }
                else
                {
                    var normalizedPath = methodInfo.sourceFileName.Replace('\\', '/');
                    if (methodInfo.sourceFileLine == 0)
                    {
                        if (fullCallStack)
                        {
                            sb.AppendFormat("0x{0:X}\t\t{1}\t<a href=\"{2}\" line=\"1\">{2}</a>\n", addr, methodInfo.methodName, normalizedPath);
                        }
                        else
                        {
                            sb.AppendFormat("{0}\t<a href=\"{1}\" line=\"1\">{1}</a>\n", methodInfo.methodName, normalizedPath);
                        }
                    }
                    else
                    {
                        if (fullCallStack)
                        {
                            sb.AppendFormat("0x{0:X}\t\t{1}\t<a href=\"{2}\" line=\"{3}\">{2}:{3}</a>\n", addr, methodInfo.methodName, normalizedPath, methodInfo.sourceFileLine);
                        }
                        else
                        {
                            sb.AppendFormat("{0}\t<a href=\"{1}\" line=\"{2}\">{1}:{2}</a>\n", methodInfo.methodName, normalizedPath, methodInfo.sourceFileLine);
                        }
                    }
                }
            }
        }