Exemplo n.º 1
0
        public SymDocumentWriter(ISymUnmanagedDocumentWriter unmanagedDocumentWriter)
        {
            // We should not wrap null instances
            if (unmanagedDocumentWriter == null)
                throw new ArgumentNullException("unmanagedDocumentWriter");

            m_unmanagedDocumentWriter = unmanagedDocumentWriter;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Flushes accumulated sequence points and re-initializes sequence point state.
        /// </summary>
        private void DefineSequencePointsForCurrentDocument()
        {
            //^ requires this.currentDocument != null && this.currentDocument != SourceDummy.PrimarySourceDocument
            ISymUnmanagedDocumentWriter document = this.GetDocumentWriterFor(this.currentDocument);
            uint seqPointCount = (uint)this.offsets.Count;

            if (seqPointCount > 0)
            {
                uint[] offsets      = this.offsets.ToArray();
                uint[] startLines   = this.startLines.ToArray();
                uint[] startColumns = this.startColumns.ToArray();
                uint[] endLines     = this.endLines.ToArray();
                uint[] endColumns   = this.endColumns.ToArray();
                this.SymWriter.DefineSequencePoints(document, seqPointCount, offsets, startLines, startColumns, endLines, endColumns);
            }
            this.currentDocument = null;
            this.offsets.Clear();
            this.startLines.Clear();
            this.startColumns.Clear();
            this.endLines.Clear();
            this.endColumns.Clear();
        }
Exemplo n.º 3
0
 internal ISymUnmanagedDocumentWriter GetUnmanagedDocument(ISymUnmanagedWriter2 symUnmanagedWriter)
 {
     if (unmanagedDocument == null)
     {
         unmanagedDocument = symUnmanagedWriter.DefineDocument(url, ref language, ref languageVendor, ref documentType);
     }
     return unmanagedDocument;
 }
Exemplo n.º 4
0
 public virtual extern void __DefineSequencePoints([In, MarshalAs(UnmanagedType.Interface)] ISymUnmanagedDocumentWriter document, [In] uint spCount, [In] ref uint offsets, [In] ref uint lines, [In] ref uint columns, [In] ref uint endLines, [In] ref uint endColumns);
Exemplo n.º 5
0
 public SymDocumentWriter(ISymUnmanagedDocumentWriter unmanagedDocumentWriter)
 {
     m_unmanagedDocumentWriter = unmanagedDocumentWriter;
 }
Exemplo n.º 6
0
 private void WriteSequencePoints(ISymUnmanagedDocumentWriter symDocument, int count)
 {
     try
     {
         symWriter.DefineSequencePoints(
             symDocument,
             (uint)count,
             sequencePointOffsets,
             sequencePointStartLines,
             sequencePointStartColumns,
             sequencePointEndLines,
             sequencePointEndColumns);
     }
     catch (Exception ex)
     {
         throw new PdbWritingException(ex);
     }
 }
	// Constructors.
	public unsafe SymDocumentWriter
				(ISymUnmanagedDocumentWriter *pDocumentWriter)
			{
				this.pDocumentWriter = pDocumentWriter;
			}
Exemplo n.º 8
0
 public virtual void DefineSequencePoints(ISymUnmanagedDocumentWriter document, uint count, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] offsets, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] lines, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] columns, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] endLines, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] endColumns)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
        /// <summary>
        /// Creates symbols for method identified by <c>oldToken</c> by translating symbols 
        /// from new version of method identified by <c>newToken</c>.
        /// </summary>
        /// <param name="newToken">Identifies new version of method.</param>
        /// <param name="oldToken">Identifies old version of method.</param>
        /// <param name="placeholder">Translation definition for local variables.</param>
        public List<SequencePoint> EmitMethod(uint oldToken,uint newToken,Dictionary<int,int> placeholder=null)
        {
            if(State != WriterState.Building){
                throw new TranslatingException("ISym* interfaces were not initializde. (EnC)");
            }
            int bla = ((IMetaDataImport)manager.MetadataManager.OldEmitter.CorMetaDataEmit).IsValidToken(oldToken);
            ISymUnmanagedMethod smMethod = mReader.__GetMethod(newToken);
            mWriter.__OpenMethod(oldToken);

            uint seqCount = smMethod.__GetSequencePointCount();

            uint[] lines = new uint[seqCount];
            uint[] offsets = new uint[seqCount];
            uint[] columns = new uint[seqCount];
            uint[] endLines = new uint[seqCount];
            uint[] endColumns = new uint[seqCount];
            ISymUnmanagedDocument[] documents = new ISymUnmanagedDocument[seqCount];
            ISymUnmanagedDocumentWriter[] docWriters = new ISymUnmanagedDocumentWriter[seqCount];
            uint cCount;

            smMethod.__GetSequencePoints(seqCount,out cCount,offsets,documents,lines,columns,endLines,endColumns);
            for (int i = 0; i < seqCount; i++) {
                docWriters[i] = DefineDocument(documents[i]);
                mWriter.__DefineSequencePoints(docWriters[i],1,ref offsets[i],ref lines[i],ref columns[i],
                                               ref endLines[i],ref endColumns[i]);
            }
            mWriter.__SetMethodSourceRange(docWriters[0],lines[0],columns[0],docWriters[seqCount - 1],endLines[seqCount - 1],endColumns[seqCount - 1]);

            EmitScope(smMethod.__GetRootScope(),placeholder); //

            try{
                mWriter.__CloseMethod();
            } catch(COMException){

            }

            return SequencePoint.StoreSequencePoints(offsets,lines,columns,endLines,endColumns);
        }
 public static void SetSource(this ISymUnmanagedDocumentWriter instance, uint sourceSize, ref byte source)
 {
     instance.__SetSource(sourceSize, ref source);
     ProcessOutParameter(source);
 }
        public static ISymUnmanagedDocumentWriter DefineDocument(this ISymUnmanagedWriter2 instance, IntPtr url, ref Guid language, ref Guid languageVendor, ref Guid documentType)
        {
            ISymUnmanagedDocumentWriter returnValue = instance.__DefineDocument(url, ref language, ref languageVendor, ref documentType);

            return(returnValue);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Gets methods(described by metadata token) sequence points from <c>ISymUnmanagedReader</c>.
        /// </summary>
        /// <param name="reader">Reader for getting debugging symbols.</param>
        /// <param name="mToken">Metadata token of the method.</param>
        /// <returns><c>List</c> of SequencePoint.</returns>
        public static List<SequencePoint> GetMethodSequencePoints(ISymUnmanagedReader reader,uint mToken)
        {
            ISymUnmanagedMethod pMethod = reader.__GetMethod(mToken);
            uint seqCount = pMethod.__GetSequencePointCount();

            uint[] lines = new uint[seqCount];
            uint[] offsets = new uint[seqCount];
            uint[] columns = new uint[seqCount];
            uint[] endLines = new uint[seqCount];
            uint[] endColumns = new uint[seqCount];
            ISymUnmanagedDocument[] documents = new ISymUnmanagedDocument[seqCount];
            ISymUnmanagedDocumentWriter[] docWriters = new ISymUnmanagedDocumentWriter[seqCount];
            uint cCount;

            pMethod.__GetSequencePoints(seqCount,out cCount,offsets,documents,lines,columns,endLines,endColumns);

            List<SequencePoint> store = new List<SequencePoint>();
            for (int i = 0; i < offsets.Length; i++) {
                SequencePoint point;
                point.Column = columns[i];
                point.Offset = offsets[i];
                point.Line = lines[i];
                point.EndColumn = endColumns[i];
                point.EndLine = endLines[i];
                store.Add(point);
            }
            return store;
        }
		public void MapTokenToSourceSpan (uint token, ISymUnmanagedDocumentWriter document, uint startLine, uint startColumn, uint endLine, uint endColumn)
		{
			var assembly = writer.Context.Module.AsAssembly;
			if (assembly != null && assembly.Kind == OutputKind.WindowsRuntimeMetadata) {
				//I guess Mono doesn't care about .winmdobj file generation
			} else {
				throw new NotUsedInRoslynException ();
			}
		}
		public void SetMethodSourceRange (ISymUnmanagedDocumentWriter startDoc, uint startLine, uint startColumn, object endDoc, uint endLine, uint endColumn)
		{
			throw new NotUsedInRoslynException ();
		}
		public void DefineSequencePoints (ISymUnmanagedDocumentWriter document, uint count, uint[] offsets, uint[] lines, uint[] columns, uint[] endLines, uint[] endColumns)
		{
			msw.SetMethodUnit (((ICompileUnit)document).Entry);
			var doc = (SymbolDocumentWriterImpl)document;
			var file = doc != null ? doc.Entry.SourceFile : null;
			for (int n = 0; n < count; n++) {
				if (n > 0 && offsets [n] == offsets [n - 1] && lines [n] == lines [n - 1] && columns [n] == columns [n - 1])
					continue;
				msw.MarkSequencePoint ((int)offsets [n], file, (int)lines [n], (int)columns [n], (int)endLines [n], (int)endColumns [n], lines [n] == 0xfeefee);
			}
		}
Exemplo n.º 16
0
 public virtual extern void __SetMethodSourceRange([In, MarshalAs(UnmanagedType.Interface)] ISymUnmanagedDocumentWriter startDoc, [In] uint startLine, [In] uint startColumn, [In, MarshalAs(UnmanagedType.Interface)] ISymUnmanagedDocumentWriter endDoc, [In] uint endLine, [In] uint endColumn);
 public static void SetMethodSourceRange(this ISymUnmanagedWriter2 instance, ISymUnmanagedDocumentWriter startDoc, uint startLine, uint startColumn, ISymUnmanagedDocumentWriter endDoc, uint endLine, uint endColumn)
 {
     instance.__SetMethodSourceRange(startDoc, startLine, startColumn, endDoc, endLine, endColumn);
 }
Exemplo n.º 18
0
		public SymbolDocumentWriter(ISymUnmanagedDocumentWriter writer) {
			this.writer = writer;
		}
Exemplo n.º 19
0
 public void MapTokenToSourceSpan(uint token, ISymUnmanagedDocumentWriter document, uint startLine, uint startColumn, uint endLine, uint endColumn)
 {
     throw new NotImplementedException();
 }
 public static void SetCheckSum(this ISymUnmanagedDocumentWriter instance, Guid algorithmId, uint checkSumSize, ref byte checkSum)
 {
     instance.__SetCheckSum(algorithmId, checkSumSize, ref checkSum);
     ProcessOutParameter(checkSum);
 }
Exemplo n.º 21
0
 internal void Release()
 {
     if (unmanagedDocument != null)
     {
         Marshal.ReleaseComObject(unmanagedDocument);
         unmanagedDocument = null;
     }
 }
 public static void DefineSequencePoints(this ISymUnmanagedWriter2 instance, ISymUnmanagedDocumentWriter document, uint spCount, ref uint offsets, ref uint lines, ref uint columns, ref uint endLines, ref uint endColumns)
 {
     instance.__DefineSequencePoints(document, spCount, ref offsets, ref lines, ref columns, ref endLines, ref endColumns);
 }
Exemplo n.º 23
0
		public SymDocumentWriter (ISymUnmanagedDocumentWriter unmanagedDocumentWriter)
		{
			m_unmanagedDocumentWriter = unmanagedDocumentWriter;
		}
Exemplo n.º 24
0
 public virtual void SetMethodSourceRange(ISymUnmanagedDocumentWriter startDoc, uint startLine, uint startColumn, object endDoc, uint endLine, uint endColumn)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 25
0
 public void SetMethodSourceRange(ISymUnmanagedDocumentWriter startDoc, uint startLine, uint startColumn, object endDoc, uint endLine, uint endColumn)
 {
     throw new NotUsedInRoslynException();
 }
Exemplo n.º 26
0
 private void WriteSequencePoints(ISymUnmanagedDocumentWriter symDocument, int count)
 {
     try
     {
         _symWriter.DefineSequencePoints(
             symDocument,
             (uint)count,
             _sequencePointOffsets,
             _sequencePointStartLines,
             _sequencePointStartColumns,
             _sequencePointEndLines,
             _sequencePointEndColumns);
         if (_callLogger.LogOperation(OP.DefineSequencePoints))
         {
             _callLogger.LogArgument((uint)count);
             _callLogger.LogArgument(_sequencePointOffsets);
             _callLogger.LogArgument(_sequencePointStartLines);
             _callLogger.LogArgument(_sequencePointStartColumns);
             _callLogger.LogArgument(_sequencePointEndLines);
             _callLogger.LogArgument(_sequencePointEndColumns);
         }
     }
     catch (Exception ex)
     {
         throw new PdbWritingException(ex);
     }
 }
		public static void SetMethodSourceRange(this ISymUnmanagedWriter2 instance, ISymUnmanagedDocumentWriter startDoc, uint startLine, uint startColumn, ISymUnmanagedDocumentWriter endDoc, uint endLine, uint endColumn)
		{
			instance.__SetMethodSourceRange(startDoc, startLine, startColumn, endDoc, endLine, endColumn);
		}
Exemplo n.º 28
0
 public SymDocumentWriter(ISymUnmanagedDocumentWriter writer)
 {
     this.writer = writer;
 }
		public static void DefineSequencePoints(this ISymUnmanagedWriter2 instance, ISymUnmanagedDocumentWriter document, uint spCount, ref uint offsets, ref uint lines, ref uint columns, ref uint endLines, ref uint endColumns)
		{
			instance.__DefineSequencePoints(document, spCount, ref offsets, ref lines, ref columns, ref endLines, ref endColumns);
		}
 public SymbolDocumentWriter(ISymUnmanagedDocumentWriter writer) => this.writer = writer;
 public SymbolDocumentWriter(ISymUnmanagedDocumentWriter writer)
 {
     SymUnmanagedDocumentWriter = writer;
 }