コード例 #1
0
        public static void GetSourceExtentInDocument(this ISymEncUnmanagedMethod method, ISymUnmanagedDocument document, out int startLine, out int endLine)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            ThrowExceptionForHR(method.GetSourceExtentInDocument(document, out startLine, out endLine));
        }
コード例 #2
0
        public static List <string> GetLineForEachILOffset(int startOffset, int endOffset, ISymEncUnmanagedMethod method)
        {
            var results = new List <string>();

            for (int offset = startOffset; offset < endOffset; offset++)
            {
                int hr = method.GetLineFromOffset(offset, out int startLine, out int startColumn, out int endLine, out int endColumn, out int spOffset);
                if (hr == HResult.S_OK)
                {
                    results.Add($"IL_{spOffset:X4} ({startLine}, {startColumn}) - ({endLine}, {endColumn})");
                }
                else
                {
                    results.Add($"<error: 0x{hr:X8}>");
                }
            }

            return(results);
        }
コード例 #3
0
        public static List <string> GetFileNameForEachILOffset(int startOffset, int endOffset, ISymEncUnmanagedMethod method)
        {
            var name  = new char[100];
            var names = new List <string>();

            for (int offset = startOffset; offset < endOffset; offset++)
            {
                int hr = method.GetFileNameFromOffset(offset, name.Length, out int count, name);
                if (hr == HResult.S_OK)
                {
                    Assert.Equal('\0', name[count - 1]);
                    names.Add(new string(name, 0, count - 1));
                }
                else
                {
                    names.Add($"<error: 0x{hr:X8}>");
                }
            }

            return(names);
        }