if (_disasm)
{
- // TODO: Fix R2RDump issue where an x64 R2R image cannot be dissassembled with the x86 CoreDisTools
- // For the short term, we want to error out with a decent message explaining the unexpected error
- // Issue #19564: https://github.com/dotnet/coreclr/issues/19564
- if (r2r.InputArchitectureMatchesDisassemblerArchitecture())
+ if (r2r.InputArchitectureSupported() && r2r.DisassemblerArchitectureSupported())
{
disassembler = new Disassembler(r2r.Image, r2r.Machine);
}
else
{
- throw new ArgumentException($"The architecture of input file {filename} is {r2r.Machine.ToString()} and does not match the architecture of the disassembler tools {System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString()}");
+ throw new ArgumentException($"The architecture of input file {filename} ({r2r.Machine.ToString()}) or the architecture of the disassembler tools ({System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString()}) is not supported.");
}
}
}
}
- public bool InputArchitectureMatchesDisassemblerArchitecture()
+ public bool InputArchitectureSupported()
+ {
+ return Machine != Machine.ArmThumb2; // CoreDisTools often fails to decode when disassembling ARM images (see https://github.com/dotnet/coreclr/issues/19637)
+ }
+
+ // TODO: Fix R2RDump issue where an R2R image cannot be dissassembled with the x86 CoreDisTools
+ // For the short term, we want to error out with a decent message explaining the unexpected error
+ // Issue #19564: https://github.com/dotnet/coreclr/issues/19564
+ public bool DisassemblerArchitectureSupported()
{
System.Runtime.InteropServices.Architecture val = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture;
- switch (Machine)
- {
- case Machine.Amd64:
- return val == System.Runtime.InteropServices.Architecture.X64;
- case Machine.I386:
- return val == System.Runtime.InteropServices.Architecture.X86;
- case Machine.Arm64:
- return val == System.Runtime.InteropServices.Architecture.Arm64;
- case Machine.ArmThumb2:
- return val == System.Runtime.InteropServices.Architecture.Arm;
- default:
- return false;
- }
+ return val != System.Runtime.InteropServices.Architecture.X86;
}
/// <summary>
* Support R2RDump on ARM and ARM64 (https://github.com/dotnet/coreclr/issues/19089)
-* Fix issue with invalid machine type in COFF header (https://github.com/dotnet/coreclr/issues/19592)
-
* Parse R2RSections: READYTORUN_SECTION_EXCEPTION_INFO, READYTORUN_SECTION_DEBUG_INFO, READYTORUN_SECTION_DELAYLOAD_METHODCALL_THUNKS, READYTORUN_SECTION_INLINING_INFO, READYTORUN_SECTION_PROFILEDATA_INFO (https://github.com/dotnet/coreclr/issues/19616)
* Reenable R2RDumpTests after making it less fragile
-* Fix issue with disasm on Arm (https://github.com/dotnet/coreclr/issues/19637)
+* Fix issues with disasm on Arm (https://github.com/dotnet/coreclr/issues/19637) and disasm using x86 coredistools (https://github.com/dotnet/coreclr/issues/19564)
+
+* Test R2RDump on more test cases to make sure it runs reliably and verify that the output is accurate (list of failing inputs: https://github.com/dotnet/coreclr/issues/19642)