diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/r2rdump/R2RDump.cs | 7 | ||||
-rw-r--r-- | src/tools/r2rdump/R2RReader.cs | 24 | ||||
-rw-r--r-- | src/tools/r2rdump/README.md | 6 |
3 files changed, 15 insertions, 22 deletions
diff --git a/src/tools/r2rdump/R2RDump.cs b/src/tools/r2rdump/R2RDump.cs index c374050597..e83931c2ad 100644 --- a/src/tools/r2rdump/R2RDump.cs +++ b/src/tools/r2rdump/R2RDump.cs @@ -403,16 +403,13 @@ namespace R2RDump 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."); } } diff --git a/src/tools/r2rdump/R2RReader.cs b/src/tools/r2rdump/R2RReader.cs index d6b39a9cbb..2a6c410eaa 100644 --- a/src/tools/r2rdump/R2RReader.cs +++ b/src/tools/r2rdump/R2RReader.cs @@ -174,22 +174,18 @@ namespace R2RDump } } - 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> diff --git a/src/tools/r2rdump/README.md b/src/tools/r2rdump/README.md index 5f022aa5d4..d83b68dfdd 100644 --- a/src/tools/r2rdump/README.md +++ b/src/tools/r2rdump/README.md @@ -107,10 +107,10 @@ In x64/Arm/Arm64, GcTransitions are grouped into chunks where each chunk covers * 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) |