Remove XML dumper (#1184)
authorAndrew Au <andrewau@microsoft.com>
Fri, 27 Dec 2019 07:11:08 +0000 (23:11 -0800)
committerGitHub <noreply@github.com>
Fri, 27 Dec 2019 07:11:08 +0000 (23:11 -0800)
18 files changed:
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/Amd64/GcInfo.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/Amd64/GcSlotTable.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/Amd64/GcTransition.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/Amd64/UnwindInfo.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/Arm/UnwindInfo.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/Arm64/UnwindInfo.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/R2RImportSection.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/R2RMethod.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/R2RReader.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/R2RSection.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/x86/GcInfo.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/x86/GcSlotTable.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/x86/InfoHdr.cs
src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/x86/UnwindInfo.cs
src/coreclr/src/tools/r2rdump/CommandLineOptions.cs
src/coreclr/src/tools/r2rdump/R2RDump.cs
src/coreclr/src/tools/r2rdump/TextDumper.cs
src/coreclr/src/tools/r2rdump/XmlDumper.cs [deleted file]

index c610e4c..d20a60f 100644 (file)
@@ -7,7 +7,6 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Reflection.PortableExecutable;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.Amd64
 {
@@ -38,7 +37,6 @@ namespace ILCompiler.Reflection.ReadyToRun.Amd64
 
         public struct SafePointOffset
         {
-            [XmlAttribute("Index")]
             public int Index { get; set; }
             public uint Value { get; set; }
             public SafePointOffset(int index, uint value)
index b675961..b0c6fb7 100644 (file)
@@ -7,7 +7,6 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Reflection.PortableExecutable;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.Amd64
 {
@@ -15,7 +14,6 @@ namespace ILCompiler.Reflection.ReadyToRun.Amd64
     {
         public class GcSlot : BaseGcSlot
         {
-            [XmlAttribute("Index")]
             public int Index { get; set; }
             public int RegisterNumber { get; set; }
             public GcStackSlot StackSlot { get; set; }
index 723efc6..5aa1880 100644 (file)
@@ -6,13 +6,11 @@ using System;
 using System.Collections.Generic;
 using System.Reflection.PortableExecutable;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.Amd64
 {
     public struct InterruptibleRange
     {
-        [XmlAttribute("Index")]
         public uint Index { get; set; }
         public uint StartOffset { get; set; }
         public uint StopOffset { get; set; }
index 5dadd46..ecafe22 100644 (file)
@@ -4,7 +4,6 @@
 
 using System.Collections.Generic;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.Amd64
 {
@@ -43,7 +42,6 @@ namespace ILCompiler.Reflection.ReadyToRun.Amd64
     /// </summary>
     public class UnwindCode
     {
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         public byte CodeOffset { get; set; }
@@ -97,7 +95,6 @@ namespace ILCompiler.Reflection.ReadyToRun.Amd64
         public Registers FrameRegister { get; set; } //4 bits
         public byte FrameOffset { get; set; } //4 bits
         public UnwindCode[] UnwindCodeArray { get; set; }
-        [XmlIgnore]
         public Dictionary<int, List<UnwindCode>> UnwindCodes { get; set; }
         public uint PersonalityRoutineRVA { get; set; }
 
index 5eea415..5aa4af0 100644 (file)
@@ -3,13 +3,11 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.Arm
 {
     public class Epilog
     {
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         public uint EpilogStartOffset { get; set; }
@@ -48,7 +46,6 @@ namespace ILCompiler.Reflection.ReadyToRun.Arm
 
     public class UnwindCode
     {
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         public UnwindCode() { }
index 5c1f31f..8a01db6 100644 (file)
@@ -3,13 +3,11 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.Arm64
 {
     public class Epilog
     {
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         public uint EpilogStartOffset { get; set; }
@@ -48,7 +46,6 @@ namespace ILCompiler.Reflection.ReadyToRun.Arm64
 
     public class UnwindCode
     {
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         public UnwindCode() { }
index dc4e123..165cbc0 100644 (file)
@@ -6,8 +6,6 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Reflection.PortableExecutable;
-using System.Xml.Serialization;
-
 using Internal.CorConstants;
 
 namespace ILCompiler.Reflection.ReadyToRun
@@ -19,7 +17,6 @@ namespace ILCompiler.Reflection.ReadyToRun
     {
         public class ImportSectionEntry
         {
-            [XmlAttribute("Index")]
             public int Index { get; set; }
             public int StartOffset { get; set; }
             public int StartRVA { get; set; }
@@ -43,7 +40,6 @@ namespace ILCompiler.Reflection.ReadyToRun
             }
         }
 
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         /// <summary>
index 47e353c..29ea7a0 100644 (file)
@@ -10,7 +10,6 @@ using System.Linq;
 using System.Reflection.Metadata;
 using System.Reflection.Metadata.Ecma335;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun
 {
@@ -21,7 +20,6 @@ namespace ILCompiler.Reflection.ReadyToRun
 
     public abstract class BaseGcTransition
     {
-        [XmlAttribute("Index")]
         public int CodeOffset { get; set; }
 
         public BaseGcTransition() { }
@@ -41,7 +39,6 @@ namespace ILCompiler.Reflection.ReadyToRun
         public int Size { get; set; }
         public int Offset { get; set; }
         public int CodeLength { get; set; }
-        [XmlIgnore]
         public Dictionary<int, List<BaseGcTransition>> Transitions { get; set; }
         public List<List<BaseGcSlot>> LiveSlotsAtSafepoints { get; set; }
     }
@@ -54,7 +51,6 @@ namespace ILCompiler.Reflection.ReadyToRun
         /// <summary>
         /// The index of the runtime function
         /// </summary>
-        [XmlAttribute("Index")]
         public int Id { get; set; }
 
         /// <summary>
@@ -155,7 +151,6 @@ namespace ILCompiler.Reflection.ReadyToRun
         /// <summary>
         /// An unique index for the method
         /// </summary>
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         /// <summary>
@@ -195,7 +190,6 @@ namespace ILCompiler.Reflection.ReadyToRun
         /// </summary>
         public int EntryPointRuntimeFunctionId { get; set; }
 
-        [XmlIgnore]
         public BaseGcInfo GcInfo { get; set; }
 
         public FixupCell[] Fixups { get; set; }
index 2d2f882..c3704d9 100644 (file)
@@ -11,7 +11,6 @@ using System.Reflection.Metadata.Ecma335;
 using System.Reflection.PortableExecutable;
 using System.Runtime.InteropServices;
 using System.Text;
-using System.Xml.Serialization;
 
 using Internal.CorConstants;
 using Internal.ReadyToRunConstants;
@@ -26,7 +25,6 @@ namespace ILCompiler.Reflection.ReadyToRun
     /// </summary>
     public struct FixupCell
     {
-        [XmlAttribute("Index")]
         public int Index { get; set; }
 
         /// <summary>
index 3b54cbb..5e03f7e 100644 (file)
@@ -6,7 +6,6 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun
 {
@@ -35,7 +34,6 @@ namespace ILCompiler.Reflection.ReadyToRun
         /// <summary>
         /// The ReadyToRun section type
         /// </summary>
-        [XmlAttribute("Index")]
         public SectionType Type { get; set; }
 
         /// <summary>
index 4e4762a..f645951 100644 (file)
@@ -6,7 +6,6 @@ using System;
 using System.Collections.Generic;
 using System.Reflection.PortableExecutable;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.x86
 {
index 7983bfb..746871b 100644 (file)
@@ -6,7 +6,6 @@ using System;
 using System.Collections.Generic;
 using System.Reflection.PortableExecutable;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.x86
 {
@@ -14,7 +13,6 @@ namespace ILCompiler.Reflection.ReadyToRun.x86
     {
         public class GcSlot
         {
-            [XmlAttribute("Index")]
             public int Index { get; set; }
             public string Register { get; set; }
             public int StackOffset { get; set; }
index 9d457fb..dc2ff48 100644 (file)
@@ -5,7 +5,6 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.x86
 {
@@ -49,7 +48,6 @@ namespace ILCompiler.Reflection.ReadyToRun.x86
 
         public bool HasArgTabOffset { get; set; }
         public uint ArgTabOffset { get; set; }
-        [XmlIgnore]
         public List<int> Epilogs { get; set; }
 
         public InfoHdrSmall(uint prologSize, uint epilogSize, byte epilogCount, byte epilogAtEnd, byte ediSaved, byte esiSaved, byte ebxSaved, byte ebpSaved, byte ebpFrame,
index 5f4a329..4a257f0 100644 (file)
@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Text;
-using System.Xml.Serialization;
 
 namespace ILCompiler.Reflection.ReadyToRun.x86
 {
index e5a27af..bdcedc1 100644 (file)
@@ -17,7 +17,6 @@ namespace R2RDump
             RootCommand command = new RootCommand();
             command.AddOption(new Option(new[] { "--in", "-i" }, "Input file(s) to dump. Expects them to by ReadyToRun images", new Argument<FileInfo[]>()));
             command.AddOption(new Option(new[] { "--out", "-o" }, "Output file path. Dumps everything to the specified file except for help message and exception messages", new Argument<FileInfo>()));
-            command.AddOption(new Option(new[] { "--xml", "-x" }, "Output in XML format", new Argument<bool>()));
             command.AddOption(new Option(new[] { "--raw" }, "Dump the raw bytes of each section or runtime function", new Argument<bool>()));
             command.AddOption(new Option(new[] { "--header" }, "Dump R2R header", new Argument<bool>()));
             command.AddOption(new Option(new[] { "--disasm", "-d" }, "Show disassembly of methods or runtime functions", new Argument<bool>()));
@@ -33,7 +32,6 @@ namespace R2RDump
             command.AddOption(new Option(new[] { "--normalize", "-n" }, "Normalize dump by sorting the various tables and methods (default = unsorted i.e. file order)", new Argument<bool>()));
             command.AddOption(new Option(new[] { "--verbose", "-v" }, "Dump disassembly, unwindInfo, gcInfo and sectionContents", new Argument<bool>()));
             command.AddOption(new Option(new[] { "--diff" }, "Compare two R2R images", new Argument<bool>()));
-            command.AddOption(new Option(new[] { "--ignoreSensitive" }, "Ignore sensitive properties in xml dump to avoid failing tests", new Argument<bool>()));
             command.AddOption(new Option(new[] { "--reference", "-r" }, "Explicit reference assembly files", new Argument<FileInfo[]>()));
             command.AddOption(new Option(new[] { "--referencePath", "--rp" }, "Search paths for reference assemblies", new Argument<DirectoryInfo[]>()));
             command.AddOption(new Option(new[] { "--inlineSignatureBinary", "--isb" }, "Embed binary signature into its textual representation", new Argument<bool>()));
index 4979691..45ae837 100644 (file)
@@ -12,7 +12,6 @@ using System.Linq;
 using System.Reflection.Metadata.Ecma335;
 using System.Text;
 using System.Threading.Tasks;
-using System.Xml;
 
 namespace R2RDump
 {
@@ -20,8 +19,6 @@ namespace R2RDump
     {
         public FileInfo[] In { get; set; }
         public FileInfo Out { get; set; }
-
-        public bool Xml { get; set; }
         public bool Raw { get; set; }
         public bool Header { get; set; }
         public bool Disasm { get; set; }
@@ -138,15 +135,15 @@ namespace R2RDump
         abstract internal void WriteSubDivider();
         abstract internal void SkipLine();
         abstract internal void DumpHeader(bool dumpSections);
-        abstract internal void DumpSection(R2RSection section, XmlNode parentNode = null);
+        abstract internal void DumpSection(R2RSection section);
         abstract internal void DumpEntryPoints();
         abstract internal void DumpAllMethods();
-        abstract internal void DumpMethod(R2RMethod method, XmlNode parentNode = null);
-        abstract internal void DumpRuntimeFunction(RuntimeFunction rtf, XmlNode parentNode = null);
-        abstract internal void DumpDisasm(RuntimeFunction rtf, int imageOffset, XmlNode parentNode = null);
-        abstract internal void DumpBytes(int rva, uint size, XmlNode parentNode = null, string name = "Raw", bool convertToOffset = true);
-        abstract internal void DumpSectionContents(R2RSection section, XmlNode parentNode = null);
-        abstract internal XmlNode DumpQueryCount(string q, string title, int count);
+        abstract internal void DumpMethod(R2RMethod method);
+        abstract internal void DumpRuntimeFunction(RuntimeFunction rtf);
+        abstract internal void DumpDisasm(RuntimeFunction rtf, int imageOffset);
+        abstract internal void DumpBytes(int rva, uint size, string name = "Raw", bool convertToOffset = true);
+        abstract internal void DumpSectionContents(R2RSection section);
+        abstract internal void DumpQueryCount(string q, string title, int count);
     }
 
     class R2RDump
@@ -229,10 +226,10 @@ namespace R2RDump
             foreach (string q in queries)
             {
                 IList<R2RMethod> res = FindMethod(r2r, q, exact);
-                XmlNode queryNode = _dumper.DumpQueryCount(q, "Methods", res.Count);
+                _dumper.DumpQueryCount(q, "Methods", res.Count);
                 foreach (R2RMethod method in res)
                 {
-                    _dumper.DumpMethod(method, queryNode);
+                    _dumper.DumpMethod(method);
                 }
             }
         }
@@ -251,10 +248,10 @@ namespace R2RDump
             foreach (string q in queries)
             {
                 IList<R2RSection> res = FindSection(r2r, q);
-                XmlNode queryNode = _dumper.DumpQueryCount(q, "Sections", res.Count);
+                _dumper.DumpQueryCount(q, "Sections", res.Count);
                 foreach (R2RSection section in res)
                 {
-                    _dumper.DumpSection(section, queryNode);
+                    _dumper.DumpSection(section);
                 }
             }
         }
@@ -280,8 +277,8 @@ namespace R2RDump
                     WriteWarning("Unable to find by id " + q);
                     continue;
                 }
-                XmlNode queryNode = _dumper.DumpQueryCount(q.ToString(), "Runtime Function", 1);
-                _dumper.DumpRuntimeFunction(rtf, queryNode);
+                _dumper.DumpQueryCount(q.ToString(), "Runtime Function", 1);
+                _dumper.DumpRuntimeFunction(rtf);
             }
         }
 
@@ -483,14 +480,7 @@ namespace R2RDump
                         }
                     }
 
-                    if (_options.Xml)
-                    {
-                        _dumper = new XmlDumper(_options.IgnoreSensitive, r2r, _writer, disassembler, _options);
-                    }
-                    else
-                    {
-                        _dumper = new TextDumper(r2r, _writer, disassembler, _options);
-                    }
+                    _dumper = new TextDumper(r2r, _writer, disassembler, _options);
 
                     if (!_options.Diff)
                     {
@@ -512,17 +502,6 @@ namespace R2RDump
                 {
                     Console.WriteLine();
                 }
-                if (_options.Xml)
-                {
-                    XmlDocument document = new XmlDocument();
-                    XmlNode node = document.CreateNode("element", "Error", "");
-                    node.InnerText = e.Message;
-                    document.AppendChild(node);
-                    if (_writer != null)
-                    {
-                        document.Save(_writer);
-                    }
-                }
                 return 1;
             }
             finally
index ee5bac9..0784778 100644 (file)
@@ -78,7 +78,7 @@ namespace R2RDump
 
                 foreach (R2RSection section in NormalizedSections())
                 {
-                    DumpSection(section, parentNode: null);
+                    DumpSection(section);
                 }
             }
             SkipLine();
@@ -87,7 +87,7 @@ namespace R2RDump
         /// <summary>
         /// Dumps one R2RSection
         /// </summary>
-        internal override void DumpSection(R2RSection section, XmlNode parentNode = null)
+        internal override void DumpSection(R2RSection section)
         {
             WriteSubDivider();
             section.WriteTo(_writer, _options);
@@ -99,7 +99,7 @@ namespace R2RDump
             }
             if (_options.SectionContents)
             {
-                DumpSectionContents(section, parentNode);
+                DumpSectionContents(section);
                 SkipLine();
             }
         }
@@ -131,7 +131,7 @@ namespace R2RDump
         /// <summary>
         /// Dumps one R2RMethod.
         /// </summary>
-        internal override void DumpMethod(R2RMethod method, XmlNode parentNode = null)
+        internal override void DumpMethod(R2RMethod method)
         {
             WriteSubDivider();
             method.WriteTo(_writer, _options);
@@ -143,7 +143,7 @@ namespace R2RDump
 
                 if (_options.Raw)
                 {
-                    DumpBytes(method.GcInfo.Offset, (uint)method.GcInfo.Size, null, "", false);
+                    DumpBytes(method.GcInfo.Offset, (uint)method.GcInfo.Size, "", false);
                 }
             }
             SkipLine();
@@ -157,7 +157,7 @@ namespace R2RDump
         /// <summary>
         /// Dumps one runtime function.
         /// </summary>
-        internal override void DumpRuntimeFunction(RuntimeFunction rtf, XmlNode parentNode = null)
+        internal override void DumpRuntimeFunction(RuntimeFunction rtf)
         {
             _writer.WriteLine(rtf.Method.SignatureString);
             rtf.WriteTo(_writer, _options);
@@ -187,7 +187,7 @@ namespace R2RDump
         /// <summary>
         /// Dumps disassembly and register liveness
         /// </summary>
-        internal override void DumpDisasm(RuntimeFunction rtf, int imageOffset, XmlNode parentNode = null)
+        internal override void DumpDisasm(RuntimeFunction rtf, int imageOffset)
         {
             int indent = (_options.Naked ? 11 : 32);
             string indentString = new string(' ', indent);
@@ -234,7 +234,7 @@ namespace R2RDump
         /// <summary>
         /// Prints a formatted string containing a block of bytes from the relative virtual address and size
         /// </summary>
-        internal override void DumpBytes(int rva, uint size, XmlNode parentNode = null, string name = "Raw", bool convertToOffset = true)
+        internal override void DumpBytes(int rva, uint size, string name = "Raw", bool convertToOffset = true)
         {
             int start = rva;
             if (convertToOffset)
@@ -267,7 +267,7 @@ namespace R2RDump
             SkipLine();
         }
 
-        internal override void DumpSectionContents(R2RSection section, XmlNode parentNode = null)
+        internal override void DumpSectionContents(R2RSection section)
         {
             switch (section.Type)
             {
@@ -408,11 +408,10 @@ namespace R2RDump
             }
         }
 
-        internal override XmlNode DumpQueryCount(string q, string title, int count)
+        internal override void DumpQueryCount(string q, string title, int count)
         {
             _writer.WriteLine(count + " result(s) for \"" + q + "\"");
             SkipLine();
-            return null;
         }
     }
 }
diff --git a/src/coreclr/src/tools/r2rdump/XmlDumper.cs b/src/coreclr/src/tools/r2rdump/XmlDumper.cs
deleted file mode 100644 (file)
index 31b537c..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using ILCompiler.Reflection.ReadyToRun;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection.PortableExecutable;
-using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
-
-namespace R2RDump
-{
-    public class XmlDumper : Dumper
-    {
-        public XmlDocument XmlDocument { get; }
-        private XmlNode _rootNode;
-        private bool _ignoreSensitive;
-        private XmlAttributeOverrides _ignoredProperties;
-
-        public XmlDumper(bool ignoreSensitive, R2RReader r2r, TextWriter writer, Disassembler disassembler, DumpOptions options)
-            : base(r2r, writer, disassembler, options)
-        {
-            _ignoreSensitive = ignoreSensitive;
-            XmlDocument = new XmlDocument();
-
-            _ignoredProperties = new XmlAttributeOverrides();
-            XmlAttributes attrs = new XmlAttributes();
-            attrs.XmlIgnore = _ignoreSensitive;
-            _ignoredProperties.Add(typeof(R2RHeader), "RelativeVirtualAddress", attrs);
-            _ignoredProperties.Add(typeof(R2RHeader), "Size", attrs);
-            _ignoredProperties.Add(typeof(R2RImportSection), "SectionRVA", attrs);
-            _ignoredProperties.Add(typeof(R2RImportSection), "SectionSize", attrs);
-            _ignoredProperties.Add(typeof(R2RImportSection), "EntrySize", attrs);
-            _ignoredProperties.Add(typeof(R2RImportSection), "SignatureRVA", attrs);
-            _ignoredProperties.Add(typeof(R2RImportSection), "AuxiliaryDataRVA", attrs);
-            _ignoredProperties.Add(typeof(R2RImportSection.ImportSectionEntry), "SignatureSample", attrs);
-            _ignoredProperties.Add(typeof(R2RImportSection.ImportSectionEntry), "SignatureRVA", attrs);
-            _ignoredProperties.Add(typeof(RuntimeFunction), "StartAddress", attrs);
-            _ignoredProperties.Add(typeof(RuntimeFunction), "UnwindRVA", attrs);
-            _ignoredProperties.Add(typeof(R2RSection), "RelativeVirtualAddress", attrs);
-            _ignoredProperties.Add(typeof(R2RSection), "Size", attrs);
-
-            XmlAttributes ignoreAlways = new XmlAttributes();
-            ignoreAlways.XmlIgnore = true;
-            _ignoredProperties.Add(typeof(R2RReader), "ImportCellNames", ignoreAlways);
-        }
-
-        internal override void Begin()
-        {
-            _rootNode = XmlDocument.CreateNode("element", "R2RDump", "");
-            XmlDocument.AppendChild(_rootNode);
-            Serialize(_r2r, _rootNode);
-        }
-
-        internal override void End() {
-            if (_writer != null)
-            {
-                XmlDocument.Save(_writer);
-            }
-        }
-
-        internal override void WriteDivider(string title)
-        {
-        }
-
-        internal override void WriteSubDivider()
-        {
-        }
-
-        internal override void SkipLine()
-        {
-        }
-
-        /// <summary>
-        /// Dumps the R2RHeader and all the sections in the header
-        /// </summary>
-        internal override void DumpHeader(bool dumpSections)
-        {
-            XmlNode headerNode = XmlDocument.CreateNode("element", "Header", "");
-            _rootNode.AppendChild(headerNode);
-            Serialize(_r2r.R2RHeader, headerNode);
-
-            if (_options.Raw)
-            {
-                DumpBytes(_r2r.R2RHeader.RelativeVirtualAddress, (uint)_r2r.R2RHeader.Size, headerNode);
-            }
-
-            if (dumpSections)
-            {
-                XmlNode sectionsNode = XmlDocument.CreateNode("element", "Sections", "");
-                _rootNode.AppendChild(sectionsNode);
-                AddXMLNode("Count", _r2r.R2RHeader.Sections.Count.ToString(), sectionsNode);
-
-                foreach (R2RSection section in NormalizedSections())
-                {
-                    DumpSection(section, sectionsNode);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Dumps one R2RSection
-        /// </summary>
-        internal override void DumpSection(R2RSection section, XmlNode parentNode)
-        {
-            XmlNode sectionNode = XmlDocument.CreateNode("element", "Section", "");
-            AddXMLAttribute(sectionNode, "Index", $"{section.Type}");
-
-            parentNode.AppendChild(sectionNode);
-            Serialize(section, sectionNode);
-
-            if (_options.Raw)
-            {
-                DumpBytes(section.RelativeVirtualAddress, (uint)section.Size, sectionNode);
-            }
-            if (_options.SectionContents)
-            {
-                DumpSectionContents(section, sectionNode);
-            }
-        }
-
-        internal override void DumpEntryPoints()
-        {
-            XmlNode entryPointsNode = XmlDocument.CreateNode("element", "EntryPoints", "");
-            _rootNode.AppendChild(entryPointsNode);
-            AddXMLAttribute(entryPointsNode, "Count", _r2r.R2RMethods.Count.ToString());
-            foreach (R2RMethod method in NormalizedMethods())
-            {
-                DumpMethod(method, entryPointsNode);
-            }
-        }
-
-        internal override void DumpAllMethods()
-        {
-            XmlNode methodsNode = XmlDocument.CreateNode("element", "Methods", "");
-            _rootNode.AppendChild(methodsNode);
-            AddXMLAttribute(methodsNode, "Count", _r2r.R2RMethods.Count.ToString());
-            foreach (R2RMethod method in NormalizedMethods())
-            {
-                DumpMethod(method, methodsNode);
-            }
-        }
-
-        /// <summary>
-        /// Dumps one R2RMethod.
-        /// </summary>
-        internal override void DumpMethod(R2RMethod method, XmlNode parentNode)
-        {
-            XmlNode methodNode = XmlDocument.CreateNode("element", "Method", "");
-            AddXMLAttribute(methodNode, "Index", $"{method.Index}");
-            parentNode.AppendChild(methodNode);
-            Serialize(method, methodNode);
-
-            if (_options.GC && method.GcInfo != null)
-            {
-                XmlNode gcNode = XmlDocument.CreateNode("element", "GcInfo", "");
-                methodNode.AppendChild(gcNode);
-                Serialize(method.GcInfo, gcNode);
-
-                foreach (List<BaseGcTransition> transitionList in method.GcInfo.Transitions.Values)
-                {
-                    foreach (BaseGcTransition transition in transitionList)
-                    {
-                        Serialize(transition, gcNode);
-                    }
-                }
-
-                if (_options.Raw)
-                {
-                    DumpBytes(method.GcInfo.Offset, (uint)method.GcInfo.Size, gcNode, "Raw", false);
-                }
-            }
-
-            XmlNode rtfsNode = null;
-            rtfsNode = XmlDocument.CreateNode("element", "RuntimeFunctions", "");
-            methodNode.AppendChild(rtfsNode);
-
-            foreach (RuntimeFunction runtimeFunction in method.RuntimeFunctions)
-            {
-                DumpRuntimeFunction(runtimeFunction, rtfsNode);
-            }
-        }
-
-        /// <summary>
-        /// Dumps one runtime function.
-        /// </summary>
-        internal override void DumpRuntimeFunction(RuntimeFunction rtf, XmlNode parentNode)
-        {
-            XmlNode rtfNode = XmlDocument.CreateNode("element", "RuntimeFunction", "");
-            AddXMLAttribute(rtfNode, "Index", $"{rtf.Id}");
-            parentNode.AppendChild(rtfNode);
-            AddXMLNode("MethodRid", rtf.Method.Rid.ToString(), rtfNode);
-            Serialize(rtf, rtfNode);
-
-            if (_options.Disasm)
-            {
-                DumpDisasm(rtf, _r2r.GetOffset(rtf.StartAddress), rtfNode);
-            }
-
-            if (_options.Raw)
-            {
-                DumpBytes(rtf.StartAddress, (uint)rtf.Size, rtfNode);
-            }
-            if (_options.Unwind && rtf.UnwindInfo != null)
-            {
-                XmlNode unwindNode = null;
-                unwindNode = XmlDocument.CreateNode("element", "UnwindInfo", "");
-                rtfNode.AppendChild(unwindNode);
-                Serialize(rtf.UnwindInfo, unwindNode);
-
-                if (_options.Raw)
-                {
-                    DumpBytes(rtf.UnwindRVA, (uint)((ILCompiler.Reflection.ReadyToRun.Amd64.UnwindInfo)rtf.UnwindInfo).Size, unwindNode);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Dumps disassembly and register liveness
-        /// </summary>
-        internal override void DumpDisasm(RuntimeFunction rtf, int imageOffset, XmlNode parentNode)
-        {
-            int rtfOffset = 0;
-            int codeOffset = rtf.CodeOffset;
-
-            while (rtfOffset < rtf.Size)
-            {
-                string instr;
-                int instrSize = _disassembler.GetInstruction(rtf, imageOffset, rtfOffset, out instr);
-
-                AddXMLNode("offset" + codeOffset, instr, parentNode, $"{codeOffset}");
-
-                if (rtf.Method.GcInfo != null && rtf.Method.GcInfo.Transitions.ContainsKey(codeOffset))
-                {
-                    foreach (BaseGcTransition transition in rtf.Method.GcInfo.Transitions[codeOffset])
-                    {
-                        AddXMLNode("Transition", transition.ToString(), parentNode, $"{codeOffset}");
-                    }
-                }
-
-                CoreDisTools.ClearOutputBuffer();
-                rtfOffset += instrSize;
-                codeOffset += instrSize;
-            }
-        }
-
-        /// <summary>
-        /// Prints a formatted string containing a block of bytes from the relative virtual address and size
-        /// </summary>
-        internal override void DumpBytes(int rva, uint size, XmlNode parentNode, string name = "Raw", bool convertToOffset = true)
-        {
-            int start = rva;
-            if (convertToOffset)
-                start = _r2r.GetOffset(rva);
-            if (start > _r2r.Image.Length || start + size > _r2r.Image.Length)
-            {
-                throw new IndexOutOfRangeException();
-            }
-
-            if (parentNode != null)
-            {
-                StringBuilder sb = new StringBuilder();
-                sb.Append($"{_r2r.Image[start]:X2}");
-                for (uint i = 1; i < size; i++)
-                {
-                    sb.Append($" {_r2r.Image[start + i]:X2}");
-                }
-                AddXMLNode(name, sb.ToString(), parentNode, $"{start}");
-                return;
-            }
-        }
-
-        internal override void DumpSectionContents(R2RSection section, XmlNode parentNode)
-        {
-            XmlNode contentsNode = XmlDocument.CreateNode("element", "Contents", "");
-            parentNode.AppendChild(contentsNode);
-
-            switch (section.Type)
-            {
-                case R2RSection.SectionType.READYTORUN_SECTION_AVAILABLE_TYPES:
-                    int availableTypesId = 0;
-                    foreach (string name in _r2r.AvailableTypes)
-                    {
-                        AddXMLNode("AvailableType", name, contentsNode, $"{availableTypesId++}");
-                    }
-                    break;
-                case R2RSection.SectionType.READYTORUN_SECTION_RUNTIME_FUNCTIONS:
-                    if (_ignoreSensitive)
-                        break;
-                    int rtfOffset = _r2r.GetOffset(section.RelativeVirtualAddress);
-                    int rtfEndOffset = rtfOffset + section.Size;
-                    int rtfIndex = 0;
-                    while (rtfOffset < rtfEndOffset)
-                    {
-                        uint rva = NativeReader.ReadUInt32(_r2r.Image, ref rtfOffset);
-                        AddXMLNode($"id{rtfIndex}", $"0x{rva:X8}", contentsNode, $"{rtfIndex}");
-                        rtfIndex++;
-                    }
-                    break;
-                case R2RSection.SectionType.READYTORUN_SECTION_COMPILER_IDENTIFIER:
-                    AddXMLNode("CompilerIdentifier", _r2r.CompilerIdentifier, contentsNode);
-                    break;
-                case R2RSection.SectionType.READYTORUN_SECTION_IMPORT_SECTIONS:
-                    foreach (R2RImportSection importSection in _r2r.ImportSections)
-                    {
-                        XmlNode importSectionsNode = XmlDocument.CreateNode("element", "ImportSection", "");
-                        AddXMLAttribute(importSectionsNode, "Index", $"{importSection.Index}");
-                        contentsNode.AppendChild(importSectionsNode);
-
-                        Serialize(importSection, importSectionsNode);
-                        if (_options.Raw && importSection.Entries.Count != 0)
-                        {
-                            if (importSection.SectionRVA != 0)
-                            {
-                                DumpBytes(importSection.SectionRVA, (uint)importSection.SectionSize, importSectionsNode, "SectionBytes");
-                            }
-                            if (importSection.SignatureRVA != 0)
-                            {
-                                DumpBytes(importSection.SignatureRVA, (uint)importSection.Entries.Count * sizeof(int), importSectionsNode, "SignatureBytes");
-                            }
-                            if (importSection.AuxiliaryDataRVA != 0)
-                            {
-                                DumpBytes(importSection.AuxiliaryDataRVA, (uint)importSection.AuxiliaryDataSize, importSectionsNode, "AuxiliaryDataBytes");
-                            }
-                        }
-                        foreach (R2RImportSection.ImportSectionEntry entry in importSection.Entries)
-                        {
-                            Serialize(entry, importSectionsNode);
-                        }
-                    }
-                    break;
-            }
-        }
-
-        internal override XmlNode DumpQueryCount(string q, string title, int count)
-        {
-            XmlNode queryNode = XmlDocument.CreateNode("element", title, "");
-            _rootNode.AppendChild(queryNode);
-            AddXMLAttribute(queryNode, "Query", q);
-            AddXMLAttribute(queryNode, "Count", count.ToString());
-            return queryNode;
-        }
-
-        private void Serialize(object obj, XmlNode node)
-        {
-            using (XmlWriter xmlWriter = node.CreateNavigator().AppendChild())
-            {
-                xmlWriter.WriteWhitespace("");
-                XmlSerializer Serializer = new XmlSerializer(obj.GetType(), _ignoredProperties);
-                Serializer.Serialize(xmlWriter, obj);
-            }
-        }
-
-        private XmlNode AddXMLNode(String name, String contents, XmlNode parentNode, string index = "")
-        {
-            XmlNode node = XmlDocument.CreateNode("element", name, "");
-            if (!index.Equals(""))
-            {
-                AddXMLAttribute(node, "Index", index);
-            }
-            parentNode.AppendChild(node);
-            node.InnerText = contents;
-            return node;
-        }
-
-        private void AddXMLAttribute(XmlNode node, string name, string value)
-        {
-            XmlAttribute attr = XmlDocument.CreateAttribute(name);
-            attr.Value = value;
-            node.Attributes.SetNamedItem(attr);
-        }
-    }
-}