summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAmy Yu <amycmyu@gmail.com>2018-06-21 18:31:22 -0700
committerAmy Yu <amycmyu@gmail.com>2018-06-26 15:04:10 -0700
commit5678ab7e406ba8040aff07cb9364c70ac6042d83 (patch)
tree7273c80b1f549bbf626398d678abba0089399414 /src/tools
parent3be7f69aec7164e9d2c13a01d52abaec277aeb46 (diff)
downloadcoreclr-5678ab7e406ba8040aff07cb9364c70ac6042d83.tar.gz
coreclr-5678ab7e406ba8040aff07cb9364c70ac6042d83.tar.bz2
coreclr-5678ab7e406ba8040aff07cb9364c70ac6042d83.zip
Xml serialize section contents and gcinfo transitions
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/r2rdump/GCInfo.cs3
-rw-r--r--src/tools/r2rdump/R2RDump.cs40
2 files changed, 30 insertions, 13 deletions
diff --git a/src/tools/r2rdump/GCInfo.cs b/src/tools/r2rdump/GCInfo.cs
index cf51c8b181..c423eabf2a 100644
--- a/src/tools/r2rdump/GCInfo.cs
+++ b/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<int, GcTransition> Transitions { get; }
+ public Dictionary<int, GcTransition> Transitions { get; set; }
public GcInfo() { }
diff --git a/src/tools/r2rdump/R2RDump.cs b/src/tools/r2rdump/R2RDump.cs
index 1e6ccf6b48..6606b49d2a 100644
--- a/src/tools/r2rdump/R2RDump.cs
+++ b/src/tools/r2rdump/R2RDump.cs
@@ -230,7 +230,10 @@ namespace R2RDump
methodNode.AppendChild(gcNode);
Serialize(method.GcInfo, gcNode);
- Serialize(new List<GcInfo.GcTransition>(method.GcInfo.Transitions.Values), gcNode);
+ foreach (KeyValuePair<int, GcInfo.GcTransition> 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;
}