Esempio n. 1
0
 public static PdbCustomDebugInfo Read(ModuleDef module, TypeDef typeOpt, CilBody bodyOpt, GenericParamContext gpContext, Guid kind, ref DataReader reader)
 {
     try {
         var cdiReader = new PortablePdbCustomDebugInfoReader(module, typeOpt, bodyOpt, gpContext, ref reader);
         var cdi       = cdiReader.Read(kind);
         Debug.Assert(cdiReader.reader.Position == cdiReader.reader.Length);
         return(cdi);
     }
     catch (ArgumentException) {
     }
     catch (OutOfMemoryException) {
     }
     catch (IOException) {
     }
     return(null);
 }
 public static PdbCustomDebugInfo Read(ModuleDef module, TypeDef typeOpt, CilBody bodyOpt, GenericParamContext gpContext, Guid kind, byte[] data)
 {
     try {
         using (var reader = new PortablePdbCustomDebugInfoReader(module, typeOpt, bodyOpt, gpContext, MemoryImageStream.Create(data))) {
             var cdi = reader.Read(kind);
             Debug.Assert(reader.reader.Position == reader.reader.Length);
             return(cdi);
         }
     }
     catch (ArgumentException) {
     }
     catch (OutOfMemoryException) {
     }
     catch (IOException) {
     }
     return(null);
 }
Esempio n. 3
0
        void GetCustomDebugInfos(int token, GenericParamContext gpContext, IList <PdbCustomDebugInfo> result, MethodDef methodOpt, CilBody bodyOpt, out PdbAsyncMethodSteppingInformationCustomDebugInfo asyncStepInfo)
        {
            asyncStepInfo = null;
            var mdToken = new MDToken(token);
            var ridList = pdbMetadata.GetCustomDebugInformationRidList(mdToken.Table, mdToken.Rid);

            if (ridList.Count == 0)
            {
                return;
            }
            var typeOpt = methodOpt?.DeclaringType;

            for (int i = 0; i < ridList.Count; i++)
            {
                var rid = ridList[i];
                if (!pdbMetadata.TablesStream.TryReadCustomDebugInformationRow(rid, out var row))
                {
                    continue;
                }
                var guid = pdbMetadata.GuidStream.Read(row.Kind);
                if (!pdbMetadata.BlobStream.TryCreateReader(row.Value, out var reader))
                {
                    continue;
                }
                Debug.Assert(guid is not null);
                if (guid is null)
                {
                    continue;
                }
                var cdi = PortablePdbCustomDebugInfoReader.Read(module, typeOpt, bodyOpt, gpContext, guid.Value, ref reader);
                Debug.Assert(cdi is not null);
                if (cdi is not null)
                {
                    if (cdi is PdbAsyncMethodSteppingInformationCustomDebugInfo asyncStepInfoTmp)
                    {
                        Debug.Assert(asyncStepInfo is null);
                        asyncStepInfo = asyncStepInfoTmp;
                    }
                    else
                    {
                        result.Add(cdi);
                    }
                }
            }
        }
Esempio n. 4
0
        void GetCustomDebugInfos(int token, GenericParamContext gpContext, IList <PdbCustomDebugInfo> result, MethodDef methodOpt, CilBody bodyOpt, out PdbAsyncMethodSteppingInformationCustomDebugInfo asyncStepInfo)
        {
            asyncStepInfo = null;
            var mdToken = new MDToken(token);
            var ridList = pdbMetaData.GetCustomDebugInformationRidList(mdToken.Table, mdToken.Rid);

            if (ridList.Count == 0)
            {
                return;
            }
            var typeOpt = methodOpt == null ? null : methodOpt.DeclaringType;

            for (int i = 0; i < ridList.Count; i++)
            {
                var  rid = ridList[i];
                uint kind;
                uint value = pdbMetaData.TablesStream.ReadCustomDebugInformationRow2(rid, out kind);
                var  guid  = pdbMetaData.GuidStream.Read(kind);
                var  data  = pdbMetaData.BlobStream.Read(value);
                Debug.Assert(guid != null && data != null);
                if (guid == null || data == null)
                {
                    continue;
                }
                var cdi = PortablePdbCustomDebugInfoReader.Read(module, typeOpt, bodyOpt, gpContext, guid.Value, data);
                Debug.Assert(cdi != null);
                if (cdi != null)
                {
                    var asyncStepInfoTmp = cdi as PdbAsyncMethodSteppingInformationCustomDebugInfo;
                    if (asyncStepInfoTmp != null)
                    {
                        Debug.Assert(asyncStepInfo == null);
                        asyncStepInfo = asyncStepInfoTmp;
                    }
                    else
                    {
                        result.Add(cdi);
                    }
                }
            }
        }