GetSymbolReader() 공개 메소드

public GetSymbolReader ( ModuleDefinition module, Stream symbolStream ) : ISymbolReader
module ModuleDefinition
symbolStream Stream
리턴 ISymbolReader
예제 #1
0
파일: CecilTries.cs 프로젝트: halllo/MTSS12
 private static ISymbolReader ReadAssemblyWithPdb(string toAnalyze)
 {
     var pdb = new PdbReaderProvider();
     string pdbFile = Path.ChangeExtension(toAnalyze, "pdb");
     var moduleToAnalyze = ModuleDefinition.ReadModule(toAnalyze);
     return pdb.GetSymbolReader(moduleToAnalyze, pdbFile);
 }
예제 #2
0
        private static void Analysis(XmlTextWriter writer, ModuleDefinition module, string fullPath, bool withTypes)
        {
            try
            {
                module.ReadSymbols();

                var provider = new PdbReaderProvider();
                var reader = provider.GetSymbolReader(module, fullPath);
            }
            catch (FileNotFoundException fex)
            {
                // we don't want to fail on a missing pdb.
                // though we may place a breakpoint below.
                var debugException = fex;
            }

            Console.WriteLine("Parsing {0}", module.Name);
            writer.WriteStartElement("Assembly");
            writer.WriteAttributeString("name", module.Assembly.Name.Name);
            writer.WriteAttributeString("version", module.Assembly.Name.Version.ToString());
            writer.WriteStartElement("References");
            foreach (var item in module.AssemblyReferences)
            {
                writer.WriteStartElement("Reference");
                writer.WriteAttributeString("name", item.Name);
                writer.WriteAttributeString("fullName", item.FullName);
                writer.WriteAttributeString("version", item.Version.ToString());
                writer.WriteEndElement();

                if (!parsedAssemblies.Contains(item.FullName) && !assembliesToParse.Contains(item.FullName))
                {
                    assembliesToParse.Add(item.FullName);
                }
            }
            writer.WriteEndElement();

            if (withTypes)
            {
                writer.WriteStartElement("TypeReferences");
                foreach (var t in module.Types)
                {
                    ParseType(writer, t);
                }

                writer.WriteEndElement();
            }

            writer.WriteEndElement();

            if (assembliesToParse.Contains(module.Assembly.Name.FullName))
            {
                assembliesToParse.Remove(module.Assembly.Name.FullName);
            }

            parsedAssemblies.Add(module.Assembly.Name.FullName);
        }
예제 #3
0
        static void Analysis(XmlTextWriter writer, ModuleDefinition module, string fullPath, bool withTypes)
        {
            try
            {
                module.ReadSymbols();

                var provider = new PdbReaderProvider();
                var reader = provider.GetSymbolReader(module, fullPath);
            }
            catch (FileNotFoundException)
            {

            }

            Console.WriteLine("Parsing {0}", module.Name);
            writer.WriteStartElement("Assembly");
            writer.WriteAttributeString("name", module.Assembly.Name.Name);
            writer.WriteAttributeString("version", module.Assembly.Name.Version.ToString());
            writer.WriteStartElement("References");
            foreach (var item in module.AssemblyReferences)
            {
                writer.WriteStartElement("Reference");
                writer.WriteAttributeString("name", item.Name);
                writer.WriteAttributeString("fullName", item.FullName);
                writer.WriteAttributeString("version", item.Version.ToString());
                writer.WriteEndElement();

                if (!Parsed.Contains(item.FullName) && !ToParse.Contains(item.FullName))
                {
                    ToParse.Add(item.FullName);
                }
            }
            writer.WriteEndElement();

            if (withTypes)
            {
                writer.WriteStartElement("TypeReferences");
                foreach (var t in module.Types)
                {
                    ParseType(writer, t);
                }

                writer.WriteEndElement();

                if (designAnalysis)
                {
                    GenerateTypeDesignMeasures(writer, module);
                }
            }

            writer.WriteEndElement();

            if (ToParse.Contains(module.Assembly.Name.FullName))
            {
                ToParse.Remove(module.Assembly.Name.FullName);
            }

            Parsed.Add(module.Assembly.Name.FullName);
        }