Ejemplo n.º 1
0
        static bool ExtractFromMinidump(string filename, string symPath, ref List <sCallstack> callstack, out byte[] callstackUid)
        {
            callstackUid = new byte[16];

            string output = GetCallstackFromMinidump(filename, symPath);

            string[] lines    = output.Split('\n');
            int      depth    = 0;
            string   haystack = "";

            foreach (string line in lines)
            {
                if (depth > 0)
                {
                    depth++;
                }

                int rearPos = line.IndexOf('[');
                if (rearPos != -1)
                {
                    sCallstack stack = new sCallstack();

                    if (depth == 0)
                    {
                        depth = 1;
                    }

                    stack.depth    = depth;
                    stack.funcname = line.Substring(45, rearPos - 45 - 1);
                    stack.fileline = line.Substring(rearPos);

                    haystack += stack.funcname;

                    callstack.Add(stack);
                }
            }

            if (haystack.Length <= 0)
            {
                lines = output.Split('\n');
                depth = 0;
                foreach (string line in lines)
                {
                    if (depth > 0)
                    {
                        depth++;
                    }

                    sCallstack stack = new sCallstack();

                    if (depth == 0)
                    {
                        depth = 1;
                    }

                    stack.depth    = depth;
                    stack.funcname = line;
                    stack.fileline = "";

                    haystack += stack.funcname;

                    callstack.Add(stack);
                }
            }

            System.Security.Cryptography.MD5CryptoServiceProvider hashGen = new System.Security.Cryptography.MD5CryptoServiceProvider();
            callstackUid = hashGen.ComputeHash(Encoding.ASCII.GetBytes(haystack));

            return(true);
        }
Ejemplo n.º 2
0
        static bool ExtractFromMinidump(string filename, string symPath, ref List<sCallstack> callstack, out byte[] callstackUid)
        {
            callstackUid = new byte[16];

            string output = GetCallstackFromMinidump(filename, symPath);

            string[] lines = output.Split('\n');
            int depth = 0;
            string haystack = "";
            foreach (string line in lines)
            {
                if (depth > 0)
                    depth++;

                int rearPos = line.IndexOf('[');
                if (rearPos != -1)
                {
                    sCallstack stack = new sCallstack();

                    if (depth == 0)
                        depth = 1;

                    stack.depth = depth;
                    stack.funcname = line.Substring(45, rearPos - 45 - 1);
                    stack.fileline = line.Substring(rearPos);

                    haystack += stack.funcname;

                    callstack.Add(stack);
                }
            }

            if (haystack.Length <= 0)
            {
                lines = output.Split('\n');
                depth = 0;
                foreach (string line in lines)
                {
                    if (depth > 0)
                        depth++;

                    sCallstack stack = new sCallstack();

                    if (depth == 0)
                        depth = 1;

                    stack.depth = depth;
                    stack.funcname = line;
                    stack.fileline = "";

                    haystack += stack.funcname;

                    callstack.Add(stack);
                }
            }

            System.Security.Cryptography.MD5CryptoServiceProvider hashGen = new System.Security.Cryptography.MD5CryptoServiceProvider();
            callstackUid = hashGen.ComputeHash(Encoding.ASCII.GetBytes(haystack));

            return true;
        }