コード例 #1
0
ファイル: Program.cs プロジェクト: shirhatti/diagnostics
        static void Main(string[] args)
        {
            string pdbPath = @"pdb";
            string dwarfPath = @"dwarf";

            Dictionary<string, Type> pdbTypes = new Dictionary<string, Type>();
            Dictionary<string, Type> dwarfTypes = new Dictionary<string, Type>();

            foreach (Type type in PdbParser.Parse(File.ReadLines(pdbPath)))
            {
                if (pdbTypes.ContainsKey(type.FullName))
                {
                    if (!pdbTypes[type.FullName].Alternates.ContainsKey(type.ToString()))
                    {
                        pdbTypes[type.FullName].Alternates[type.ToString()] = type;
                    }
                }
                else
                {
                    pdbTypes[type.FullName] = type;
                    pdbTypes[type.FullName].Alternates[type.ToString()] = type;
                }
            }

            foreach (Type type in DwarfParser.Parse(File.ReadLines(dwarfPath)))
            {
                if (dwarfTypes.ContainsKey(type.FullName))
                {
                    if (!dwarfTypes[type.FullName].Alternates.ContainsKey(type.ToString()))
                    {
                        dwarfTypes[type.FullName].Alternates[type.ToString()] = type;
                    }
                }
                else
                {
                    dwarfTypes[type.FullName] = type;
                    dwarfTypes[type.FullName].Alternates[type.ToString()] = type;
                }
            }

            foreach (Type type in dwarfTypes.Values.OrderBy(x => x.FullName))
            {
                foreach (string alt in type.Alternates.Keys.OrderBy(x => x))
                {
                    // Console.WriteLine(alt);
                }

                if (pdbTypes.ContainsKey(type.FullName) && ! pdbTypes[type.FullName].Alternates.ContainsKey(type.ToString()))
                {
                    Console.WriteLine($"Type Mismatch: {type.FullName}\n{type}\n{type.SourceLine}");
                    foreach (string pdbType in pdbTypes[type.FullName].Alternates.Keys)
                    {
                        Console.WriteLine(pdbType);
                    }
                }
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string pdbPath   = @"pdb";
            string dwarfPath = @"dwarf";

            Dictionary <string, Type> pdbTypes   = new Dictionary <string, Type>();
            Dictionary <string, Type> dwarfTypes = new Dictionary <string, Type>();

            foreach (Type type in PdbParser.Parse(File.ReadLines(pdbPath)))
            {
                if (pdbTypes.ContainsKey(type.FullName))
                {
                    if (!pdbTypes[type.FullName].Alternates.ContainsKey(type.ToString()))
                    {
                        pdbTypes[type.FullName].Alternates[type.ToString()] = type;
                    }
                }
                else
                {
                    pdbTypes[type.FullName] = type;
                    pdbTypes[type.FullName].Alternates[type.ToString()] = type;
                }
            }

            foreach (Type type in DwarfParser.Parse(File.ReadLines(dwarfPath)))
            {
                if (dwarfTypes.ContainsKey(type.FullName))
                {
                    if (!dwarfTypes[type.FullName].Alternates.ContainsKey(type.ToString()))
                    {
                        dwarfTypes[type.FullName].Alternates[type.ToString()] = type;
                    }
                }
                else
                {
                    dwarfTypes[type.FullName] = type;
                    dwarfTypes[type.FullName].Alternates[type.ToString()] = type;
                }
            }

            foreach (Type type in dwarfTypes.Values.OrderBy(x => x.FullName))
            {
                if (pdbTypes.ContainsKey(type.FullName))
                {
                    CompareTypes(type, pdbTypes[type.FullName]);
                }
            }
        }
コード例 #3
0
        int Main(string pdbPath, string dwarfPath)
        {
            Dictionary <string, Type> pdbTypes   = new Dictionary <string, Type>();
            Dictionary <string, Type> dwarfTypes = new Dictionary <string, Type>();

            foreach (Type type in PdbParser.Parse(File.ReadLines(pdbPath)))
            {
                if (pdbTypes.ContainsKey(type.FullName))
                {
                    if (!pdbTypes[type.FullName].Alternates.ContainsKey(type.ToString()))
                    {
                        pdbTypes[type.FullName].Alternates[type.ToString()] = type;
                    }
                }
                else
                {
                    pdbTypes[type.FullName] = type;
                    pdbTypes[type.FullName].Alternates[type.ToString()] = type;
                }
            }

            Console.WriteLine($"PDB unique types : {pdbTypes.Keys.Count}");

            foreach (Type type in DwarfParser.Parse(File.ReadLines(dwarfPath)))
            {
                if (dwarfTypes.ContainsKey(type.FullName))
                {
                    if (!dwarfTypes[type.FullName].Alternates.ContainsKey(type.ToString()))
                    {
                        dwarfTypes[type.FullName].Alternates[type.ToString()] = type;
                    }
                }
                else
                {
                    dwarfTypes[type.FullName] = type;
                    dwarfTypes[type.FullName].Alternates[type.ToString()] = type;
                }
            }

            Console.WriteLine($"Dwarf unique types : {dwarfTypes.Keys.Count}");

            foreach (Type type in dwarfTypes.Values.OrderBy(x => x.FullName))
            {
                if (pdbTypes.ContainsKey(type.FullName))
                {
                    CompareTypes(type, pdbTypes[type.FullName]);
                }
                else
                {
                    // Console.WriteLine($"dwarf unique type : {type.FullName}");
                    dwarfUnique++;
                }
            }

            foreach (Type type in pdbTypes.Values.OrderBy(x => x.FullName))
            {
                if (!dwarfTypes.ContainsKey(type.FullName))
                {
                    // Console.WriteLine($"PDB unique type : {type.FullName}");
                    pdbUnique++;
                }
            }

            Console.WriteLine($"Matches: {matched}");
            Console.WriteLine($"Ignored: {ignored}");
            Console.WriteLine($"Mismatched: {mismatched}");
            Console.WriteLine($"DwarfUnique: {dwarfUnique}");
            Console.WriteLine($"PdbUnique: {pdbUnique}");

            return(mismatched + (matched == 0 ? 1 : 0));
        }