コード例 #1
0
        public byte[] GetCheckSum()
        {
            byte[] Data;
            int    cData = 0;

            m_unmanagedDocument.GetCheckSum(0, out cData, null);
            Data = new byte[cData];
            m_unmanagedDocument.GetCheckSum(cData, out cData, Data);
            return(Data);
        }
コード例 #2
0
        public byte[] GetCheckSum()
        {
            byte[] data;
            int    cData;

            unmanagedDocument.GetCheckSum(0, out cData, null);
            data = new byte[cData];
            unmanagedDocument.GetCheckSum(cData, out cData, data);
            return(data);
        }
コード例 #3
0
ファイル: SymbolDocument.cs プロジェクト: hmflash/dnlib
        public byte[] GetCheckSum()
        {
            uint bufSize;

            document.GetCheckSum(0, out bufSize, null);
            var buffer = new byte[bufSize];

            document.GetCheckSum((uint)buffer.Length, out bufSize, buffer);
            return(buffer);
        }
コード例 #4
0
        public byte[] GetCheckSum()
        {
            int size;

            HRESULT.ThrowOnFailure(_unmanaged.GetCheckSum(0, out size, null));

            byte[] data = new byte[size];

            HRESULT.ThrowOnFailure(_unmanaged.GetCheckSum(data.Length, out size, data));

            return(data);
        }
コード例 #5
0
        public static unsafe byte[] GetCheckSum(this ISymUnmanagedDocument symDoc)
        {
            uint actualLength;

            byte[] checkSum = new byte[20];

            fixed(byte *pCheckSum = checkSum)
            symDoc.GetCheckSum((uint)checkSum.Length, out actualLength, new IntPtr(pCheckSum));

            if (actualLength > checkSum.Length)
            {
                checkSum = new byte[actualLength];

                fixed(byte *pCheckSum = checkSum)
                symDoc.GetCheckSum((uint)checkSum.Length, out actualLength, new IntPtr(pCheckSum));
            }
            if (actualLength == 0)
            {
                return(null);
            }
            Array.Resize(ref checkSum, (int)actualLength);
            return(checkSum);
        }
コード例 #6
0
        public static SourcecodeSegment Resolve(Module module, string fileName, byte[] checkSum, int line, int column)
        {
            // Do not use ISymUnmanagedReader.GetDocument!  It is broken if two files have the same name
            // Do not use ISymUnmanagedMethod.GetOffset!  It sometimes returns negative offset

            ISymUnmanagedReader symReader = module.SymReader;

            if (symReader == null)
            {
                return(null);                               // No symbols
            }
            ISymUnmanagedDocument symDoc = GetSymDocumentFromFilename(module, fileName, checkSum);

            if (symDoc == null)
            {
                return(null);                            // Document not found
            }
            ISymUnmanagedMethod symMethod;

            try {
                uint validLine = symDoc.FindClosestLine((uint)line);
                symMethod = symReader.GetMethodFromDocumentPosition(symDoc, (uint)validLine, (uint)column);
            } catch {
                return(null);                //Not found
            }

            SequencePoint[] seqPoints = symMethod.GetSequencePoints();
            Array.Sort(seqPoints);
            if (seqPoints.Length == 0)
            {
                return(null);
            }
            if (line < seqPoints[0].Line)
            {
                return(null);
            }
            foreach (SequencePoint sqPoint in seqPoints)
            {
                if (sqPoint.Line == 0xFEEFEE)
                {
                    continue;
                }
                // If the desired breakpoint position is before the end of the sequence point
                if (line < sqPoint.EndLine || (line == sqPoint.EndLine && column < sqPoint.EndColumn))
                {
                    SourcecodeSegment segment = new SourcecodeSegment();
                    segment.module      = module;
                    segment.filename    = symDoc.GetURL();
                    segment.checkSum    = symDoc.GetCheckSum();
                    segment.startLine   = (int)sqPoint.Line;
                    segment.startColumn = (int)sqPoint.Column;
                    segment.endLine     = (int)sqPoint.EndLine;
                    segment.endColumn   = (int)sqPoint.EndColumn;
                    segment.corFunction = module.CorModule.GetFunctionFromToken(symMethod.GetToken());
                    segment.ilStart     = (int)sqPoint.Offset;
                    segment.ilEnd       = (int)sqPoint.Offset;
                    segment.stepRanges  = null;
                    return(segment);
                }
            }
            return(null);
        }