Browse Source

Merge pull request #1987 from cshung/dev/andrewau/visualize-debug-bounds

#1886: Decorate the ready to run disassembly with DebugInfoBounds
pull/1994/head
Siegfried Pammer 5 years ago committed by GitHub
parent
commit
5a66770b2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj
  2. 15
      ILSpy.ReadyToRun/ReadyToRunLanguage.cs

4
ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj

@ -56,8 +56,8 @@ @@ -56,8 +56,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Iced" Version="1.4.0" />
<PackageReference Include="ILCompiler.Reflection.ReadyToRun" Version="1.0.6-alpha" />
<PackageReference Include="Iced" Version="1.6.0" />
<PackageReference Include="ILCompiler.Reflection.ReadyToRun" Version="1.0.7-alpha" />
</ItemGroup>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />

15
ILSpy.ReadyToRun/ReadyToRunLanguage.cs

@ -125,13 +125,24 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -125,13 +125,24 @@ namespace ICSharpCode.ILSpy.ReadyToRun
}
formatter.Options.DigitSeparator = "`";
formatter.Options.FirstOperandCharIndex = 10;
var tempOutput = new StringBuilderFormatterOutput();
var tempOutput = new StringOutput();
foreach (var instr in instructions) {
int byteBaseIndex = (int)(instr.IP - address);
foreach (var bound in runtimeFunction.DebugInfo.BoundsList) {
if (bound.NativeOffset == byteBaseIndex) {
if (bound.ILOffset == (uint)DebugInfoBoundsType.Prolog) {
WriteCommentLine(output, "Prolog");
} else if (bound.ILOffset == (uint)DebugInfoBoundsType.Epilog) {
WriteCommentLine(output, "Epilog");
} else {
WriteCommentLine(output, $"IL_{bound.ILOffset:x4}");
}
}
}
formatter.Format(instr, tempOutput);
output.Write(instr.IP.ToString("X16"));
output.Write(" ");
int instrLen = instr.ByteLength;
int instrLen = instr.Length;
for (int i = 0; i < instrLen; i++)
output.Write(codeBytes[byteBaseIndex + i].ToString("X2"));
int missingBytes = 10 - instrLen;

Loading…
Cancel
Save