PERWAPI.MergeBuffer.Add C# (CSharp) Method

Add() public method

public Add ( CILInstruction inst, uint offset ) : void
inst CILInstruction
offset uint
return void
        public void Add(CILInstruction inst, uint offset)
        {
            while (_current < _buffer.Length && _buffer[_current].offset < offset)
             _debugBuffer.Add(_buffer[_current++]);
               if (_debugBuffer.Count > 0 && offset >= ((CILInstruction) _debugBuffer[_debugBuffer.Count - 1]).offset) {
             inst.offset = offset;
             _debugBuffer.Add(inst);
               } else {
             int i;

             for (i = 0; i < _debugBuffer.Count; i++)
               if (((CILInstruction) _debugBuffer[i]).offset > offset)
                 break;

             inst.offset = offset;
             _debugBuffer.Insert((i > 0 ? i - 1 : i), inst);
               }
        }

Usage Example

コード例 #1
0
ファイル: PERWAPI.cs プロジェクト: nomit007/f4
        //public void ReadPDB() {
        //  PDBReader reader = new PDBReader(this.fileName);
        //  foreach (ClassDef cDef in GetClasses())
        //    foreach (MethodDef mDef in cDef.GetMethods()) {
        //      CILInstructions buffer = mDef.GetCodeBuffer();
        //      PDBMethod meth = reader.GetMethod((int) mDef.Token());
        //      if (meth == null)
        //        continue; // no symbols for this method
        //      PDBSequencePoint[] spList = meth.SequencePoints;
        //      MergeBuffer mergeBuffer = new MergeBuffer(buffer.GetInstructions());
        //      PDBScope outer = meth.Scope;
        //      buffer.currentScope = ReadPDBScope(outer, mergeBuffer, null, mDef);
        //      foreach (PDBSequencePoint sp in spList) {
        //        PDBDocument doc = sp.Document;
        //        mergeBuffer.Add(new Line((uint) sp.Line, (uint) sp.Column, (uint) sp.EndLine, (uint) sp.EndColumn,
        //          SourceFile.GetSourceFile(doc.URL, doc.Language, doc.LanguageVendor, doc.DocumentType)),
        //          (uint) sp.Offset);
        //      }
        //      buffer.SetInstructions(mergeBuffer.Instructions);
        //    }
        // }
        private Scope ReadPDBScope(PDBScope scope, MergeBuffer mergeBuffer, Scope parent, MethodDef thisMeth)
        {
            Scope thisScope = new Scope(parent, thisMeth);

            if (parent != null) mergeBuffer.Add(new OpenScope(thisScope), (uint) scope.StartOffset);

            foreach (PDBVariable var in scope.Variables)
                thisScope.AddLocalBinding(var.Name, var.Address);

            foreach (PDBScope child in scope.Children)
                ReadPDBScope(child, mergeBuffer, thisScope, thisMeth);

            if (parent != null) mergeBuffer.Add(new CloseScope(thisScope), (uint) scope.EndOffset);

            return thisScope;
        }