示例#1
0
        private static void ReadSymbols(MethodSymbols symbols, ISymbolReaderResolver symbolReaderResolver, PdbFunction function)
        {
            var pdbSymbols = symbols as PdbMethodSymbols;

            if (pdbSymbols != null)
            {
                // Iterator info
                pdbSymbols.IteratorClass = function.iteratorClass;

                if (function.iteratorScopes != null)
                {
                    pdbSymbols.IteratorScopes = new Collection <PdbIteratorScope> ();
                    foreach (var iteratorScope in function.iteratorScopes)
                    {
                        pdbSymbols.IteratorScopes.Add(new PdbIteratorScope(
                                                          CodeReader.GetInstruction(symbols.Body.Instructions, (int)iteratorScope.Offset),                                   // start
                                                          CodeReader.GetInstruction(symbols.Body.Instructions, (int)iteratorScope.Offset + (int)iteratorScope.Length)        // end
                                                          ?? CodeReader.GetInstruction(symbols.Body.Instructions, (int)iteratorScope.Offset + (int)iteratorScope.Length + 1) // alternative end
                                                          ));
                    }
                }

                // Using info
                pdbSymbols.MethodWhoseUsingInfoAppliesToThisMethod = symbolReaderResolver.LookupMethod(new MetadataToken(function.tokenOfMethodWhoseUsingInfoAppliesToThisMethod));

                // Note: since we don't generate scopes from PDB, we use first scope and ignore custom data stored in function.usedNamespaces for now
                if (function.scopes.Length > 0 && function.scopes [0].usedNamespaces.Length > 0)
                {
                    pdbSymbols.UsedNamespaces = new Collection <string> (function.scopes[0].usedNamespaces);
                }
                if (function.usingCounts != null)
                {
                    pdbSymbols.UsingCounts = new Collection <ushort>(function.usingCounts);
                }

                // Store asyncMethodInfo
                if (function.synchronizationInformation != null)
                {
                    pdbSymbols.SynchronizationInformation = new PdbSynchronizationInformation {
                        KickoffMethod = symbolReaderResolver.LookupMethod(new MetadataToken(function.synchronizationInformation.kickoffMethodToken)),
                        GeneratedCatchHandlerIlOffset = function.synchronizationInformation.generatedCatchHandlerIlOffset,
                    };
                    if (function.synchronizationInformation.synchronizationPoints != null)
                    {
                        pdbSymbols.SynchronizationInformation.SynchronizationPoints = new Collection <PdbSynchronizationPoint> ();
                        foreach (var synchronizationPoint in function.synchronizationInformation.synchronizationPoints)
                        {
                            pdbSymbols.SynchronizationInformation.SynchronizationPoints.Add(new PdbSynchronizationPoint {
                                SynchronizeOffset  = synchronizationPoint.synchronizeOffset,
                                ContinuationMethod = symbolReaderResolver.LookupMethod(new MetadataToken(synchronizationPoint.continuationMethodToken)),
                                ContinuationOffset = synchronizationPoint.continuationOffset,
                            });
                        }
                    }
                }
            }
        }
示例#2
0
        public void Read(MethodSymbols symbols, ISymbolReaderResolver symbolReaderResolver)
        {
            var entry = symbol_file.GetMethodByToken(symbols.OriginalMethodToken.ToInt32());

            if (entry == null)
            {
                return;
            }

            ReadLineNumbers(entry, symbols);
            ReadLocalVariables(entry, symbols);
        }
示例#3
0
        public void Read(MethodSymbols symbols, ISymbolReaderResolver symbolReaderResolver)
        {
            PdbFunction function;

            if (!functions.TryGetValue(symbols.OriginalMethodToken.ToUInt32(), out function))
            {
                return;
            }

            ReadSequencePoints(function, symbols);
            ReadScopeAndLocals(function.scopes, null, symbols);

            ReadSymbols(symbols, symbolReaderResolver, function);
        }
示例#4
0
        public void Read(MethodBody body, InstructionMapper mapper, ISymbolReaderResolver symbolReaderResolver)
        {
            var method_token = body.Method.MetadataToken;
            var entry        = symbol_file.GetMethodByToken(method_token.ToInt32());

            if (entry == null)
            {
                return;
            }

            var scopes = ReadScopes(entry, body, mapper);

            ReadLineNumbers(entry, mapper);
            ReadLocalVariables(entry, body, scopes);
        }
示例#5
0
        public void Read(MethodBody body, InstructionMapper mapper, ISymbolReaderResolver symbolReaderResolver)
        {
            var method_token = body.Method.MetadataToken;

            PdbFunction function;

            if (!functions.TryGetValue(method_token.ToUInt32(), out function))
            {
                return;
            }

            ReadSequencePoints(function, mapper);
            ReadScopeAndLocals(function.scopes, null, body, mapper);

            body.Symbols = new PdbMethodSymbols(body);
            ReadSymbols(body.Symbols, symbolReaderResolver, function);
        }