Пример #1
0
        public static int GetToken(this ISymUnmanagedMethod method)
        {
            SymbolToken token;
            int         hr = method.GetToken(out token);

            ThrowExceptionForHR(hr);
            return(token.GetToken());
        }
Пример #2
0
        public static int GetToken(this ISymUnmanagedMethod method)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            int token;

            ThrowExceptionForHR(method.GetToken(out token));
            return(token);
        }
        // ISymUnmanagedMethod

        public static SequencePoint[] GetSequencePoints(this ISymUnmanagedMethod symMethod, int codesize)
        {
            uint count = symMethod.GetSequencePointCount();

            ISymUnmanagedDocument[] documents = new ISymUnmanagedDocument[count];
            uint[] offsets    = new uint[count];
            uint[] lines      = new uint[count];
            uint[] columns    = new uint[count];
            uint[] endLines   = new uint[count];
            uint[] endColumns = new uint[count];

            symMethod.GetSequencePoints(
                count,
                out count,
                offsets,
                documents,
                lines,
                columns,
                endLines,
                endColumns
                );

            var sequencePoints = new SequencePoint[count];
            var urls           = documents.Distinct().ToDictionary(d => d, d => d.GetURL());
            var sums           = documents.Distinct().ToDictionary(d => d, d => d.GetCheckSum());

            uint token = symMethod.GetToken();

            for (int i = 0; i < count; i++)
            {
                sequencePoints[i] = new SequencePoint()
                {
                    MethodDefToken = token,
                    ILRanges       = new [] { new ILRange((int)offsets[i], i + 1 < count ? (int)offsets[i + 1] : codesize) },
                    Filename       = urls[documents[i]],
                    FileCheckSum   = sums[documents[i]],
                    StartLine      = (int)lines[i],
                    StartColumn    = (int)columns[i],
                    EndLine        = (int)endLines[i],
                    EndColumn      = (int)endColumns[i]
                };
            }

            return(sequencePoints);
        }