From: Amy Yu Date: Fri, 22 Jun 2018 01:31:22 +0000 (-0700) Subject: Xml serialize section contents and gcinfo transitions X-Git-Tag: submit/tizen/20210909.063632~11030^2~4506^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9db79855c0a88a354700b8c8c73c96198a836741;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Xml serialize section contents and gcinfo transitions Commit migrated from https://github.com/dotnet/coreclr/commit/5678ab7e406ba8040aff07cb9364c70ac6042d83 --- diff --git a/src/coreclr/src/tools/r2rdump/GCInfo.cs b/src/coreclr/src/tools/r2rdump/GCInfo.cs index cf51c8b..c423eab 100644 --- a/src/coreclr/src/tools/r2rdump/GCInfo.cs +++ b/src/coreclr/src/tools/r2rdump/GCInfo.cs @@ -127,8 +127,9 @@ namespace R2RDump public GcSlotTable SlotTable { get; set; } public int Size { get; set; } public int Offset { get; set; } + [XmlIgnore] - public Dictionary Transitions { get; } + public Dictionary Transitions { get; set; } public GcInfo() { } diff --git a/src/coreclr/src/tools/r2rdump/R2RDump.cs b/src/coreclr/src/tools/r2rdump/R2RDump.cs index 1e6ccf6..6606b49 100644 --- a/src/coreclr/src/tools/r2rdump/R2RDump.cs +++ b/src/coreclr/src/tools/r2rdump/R2RDump.cs @@ -230,7 +230,10 @@ namespace R2RDump methodNode.AppendChild(gcNode); Serialize(method.GcInfo, gcNode); - Serialize(new List(method.GcInfo.Transitions.Values), gcNode); + foreach (KeyValuePair transition in method.GcInfo.Transitions) + { + Serialize(transition, gcNode); + } } else { @@ -407,21 +410,29 @@ namespace R2RDump } break; case R2RSection.SectionType.READYTORUN_SECTION_RUNTIME_FUNCTIONS: - if (!_xml) + int rtfOffset = r2r.GetOffset(section.RelativeVirtualAddress); + int rtfEndOffset = rtfOffset + section.Size; + int rtfIndex = 0; + while (rtfOffset < rtfEndOffset) { - 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); + if (_xml) + { + AddXMLNode($"{rtfIndex}", $"0x{rva:X8}", contentsNode); + } + else { - uint rva = NativeReader.ReadUInt32(r2r.Image, ref rtfOffset); _writer.WriteLine($"{rtfIndex}: 0x{rva:X8}"); - rtfIndex++; } + rtfIndex++; } break; case R2RSection.SectionType.READYTORUN_SECTION_COMPILER_IDENTIFIER: - if (!_xml) + if(_xml) + { + AddXMLNode("CompileIdentifier", r2r.CompileIdentifier, contentsNode); + } + else { _writer.WriteLine(r2r.CompileIdentifier); } @@ -482,15 +493,20 @@ namespace R2RDump DumpBytes(r2r, importSection.AuxiliaryDataRVA, (uint)importSection.AuxiliaryData.Size, bytesNode); } } - if (!_xml) + foreach (R2RImportSection.ImportSectionEntry entry in importSection.Entries) { - foreach (R2RImportSection.ImportSectionEntry entry in importSection.Entries) + if (_xml) + { + Serialize(entry, contentsNode); + } + else { _writer.WriteLine(); _writer.WriteLine(entry.ToString()); } - _writer.WriteLine(); } + if (!_xml) + _writer.WriteLine(); } break; }