コード例 #1
0
        void SampleMain(string[] args)
        {
            Console.WriteLine("Test harness for PDB2XML.");

            if (args.Length < 2)
            {
                Console.WriteLine("Usage: Pdb2Xml <input managed exe> <output xml>");
                Console.WriteLine("This will load the pdb for the managed exe, and then spew the pdb contents to an XML file.");
                return;
            }
            string stInputExe  = args[0];
            string stOutputXml = args[1];

            // Get a Text Writer to spew the PDB to.
            XmlDocument doc = new XmlDocument();
            XmlWriter   xw  = doc.CreateNavigator().AppendChild();

            // Do the pdb for the exe into an xml stream.
            Pdb2XmlConverter p = new Pdb2XmlConverter(xw, stInputExe);

            p.ReadPdbAndWriteToXml();
            xw.Close();

            // Print the XML we just generated and save it to a file for more convenient viewing.
            Console.WriteLine(doc.OuterXml);

            doc.Save(stOutputXml);
            {
                // Proove that it's valid XML by reading it back in...
                XmlDocument d2 = new XmlDocument();
                d2.Load(stOutputXml);
            }

            // Now demonstrate some different queries.
            XmlNode root = doc.DocumentElement;

            DoQuery(QueryForStartRow("Foo.Main", 3), root);
            DoQuery(QueryForEntryName(), root);
            DoQuery(QueryForAllLocalsInMethod("Foo.Main"), root);
        } // end Main
コード例 #2
0
         void SampleMain(string[] args)
        {
            Console.WriteLine("Test harness for PDB2XML.");

            if (args.Length < 2)
            {
                Console.WriteLine("Usage: Pdb2Xml <input managed exe> <output xml>");
                Console.WriteLine("This will load the pdb for the managed exe, and then spew the pdb contents to an XML file.");
                return;
            }
            string stInputExe = args[0];
            string stOutputXml = args[1];

            // Get a Text Writer to spew the PDB to.
            XmlDocument doc = new XmlDocument();
            XmlWriter xw = doc.CreateNavigator().AppendChild();

            // Do the pdb for the exe into an xml stream. 
            Pdb2XmlConverter p = new Pdb2XmlConverter(xw, stInputExe);
            p.ReadPdbAndWriteToXml();
            xw.Close();

            // Print the XML we just generated and save it to a file for more convenient viewing.
            Console.WriteLine(doc.OuterXml);

            doc.Save(stOutputXml);
            {
                // Proove that it's valid XML by reading it back in...
                XmlDocument d2 = new XmlDocument();
                d2.Load(stOutputXml);
            }

            // Now demonstrate some different queries.
            XmlNode root = doc.DocumentElement;

            DoQuery(QueryForStartRow("Foo.Main", 3), root);
            DoQuery(QueryForEntryName(), root);
            DoQuery(QueryForAllLocalsInMethod("Foo.Main"), root);
        } // end Main