summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorZach Montoya <zamont@microsoft.com>2018-08-20 14:08:41 -0700
committerGitHub <noreply@github.com>2018-08-20 14:08:41 -0700
commitab8023d9e2d70072d0017191eacca449c4e1c33b (patch)
tree83aa6dba14773466bea6fbd007a7e821d59ac7b9 /src/tools
parentba9598ee52cb8da554255ccd09945d2baae4aecb (diff)
downloadcoreclr-ab8023d9e2d70072d0017191eacca449c4e1c33b.tar.gz
coreclr-ab8023d9e2d70072d0017191eacca449c4e1c33b.tar.bz2
coreclr-ab8023d9e2d70072d0017191eacca449c4e1c33b.zip
Update Microsoft.NETCore.CoreDisTools to version 1.0.1-prerelease-00005 (#19520)
* Update Microsoft.NETCore.CoreDisTools to version 1.0.1-prerelease-00005. Temporarily add a direct reference to the win-x64 and win-x86 runtime packages * Change Microsoft.NETCore.CoreDisTools package references to the identity package. Improve formatting of R2RDump.csproj properties. * Add an ArgumentException to explain the currently faulty behavior where disassembling an R2R image whose architecture is different than the coredistools.dll architecture. * Add Issue #19564 to the R2RDump.cs Disassembler comment
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/r2rdump/R2RDump.cs14
-rw-r--r--src/tools/r2rdump/R2RDump.csproj22
-rw-r--r--src/tools/r2rdump/R2RReader.cs18
3 files changed, 41 insertions, 13 deletions
diff --git a/src/tools/r2rdump/R2RDump.cs b/src/tools/r2rdump/R2RDump.cs
index 6fa93b8fe9..1beeaf6a40 100644
--- a/src/tools/r2rdump/R2RDump.cs
+++ b/src/tools/r2rdump/R2RDump.cs
@@ -114,8 +114,6 @@ namespace R2RDump
_sectionContents = true;
}
- _disasm = false; // TODO: this requires the coredistools nuget package with the most recent changes
-
return argSyntax;
}
@@ -405,7 +403,17 @@ namespace R2RDump
if (_disasm)
{
- disassembler = new Disassembler(r2r.Image, r2r.Machine);
+ // 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())
+ {
+ 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()}");
+ }
}
if (_xml)
diff --git a/src/tools/r2rdump/R2RDump.csproj b/src/tools/r2rdump/R2RDump.csproj
index b0ad5a3a8c..026e4a5ee9 100644
--- a/src/tools/r2rdump/R2RDump.csproj
+++ b/src/tools/r2rdump/R2RDump.csproj
@@ -1,5 +1,5 @@
-<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>R2RDump</AssemblyName>
@@ -7,18 +7,20 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyKey>Open</AssemblyKey>
- <IsDotNetFrameworkProductAssembly>true</IsDotNetFrameworkProductAssembly>
- <TargetFramework>netcoreapp2.0</TargetFramework>
- <RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
- <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
- <CLSCompliant>false</CLSCompliant>
- <NoWarn>8002,NU1701</NoWarn>
+ <AssemblyKey>Open</AssemblyKey>
+ <IsDotNetFrameworkProductAssembly>true</IsDotNetFrameworkProductAssembly>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
+ <RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
+ <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
+ <CLSCompliant>false</CLSCompliant>
+ <NoWarn>8002,NU1701</NoWarn>
+ <RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
</PropertyGroup>
+
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.CoreDisTools">
- <Version>1.0.1-prerelease-00003</Version>
+ <Version>1.0.1-prerelease-00005</Version>
</PackageReference>
<PackageReference Include="System.CommandLine">
<Version>0.1.0-e160119-1</Version>
diff --git a/src/tools/r2rdump/R2RReader.cs b/src/tools/r2rdump/R2RReader.cs
index f0177cf5bd..fedc68ea37 100644
--- a/src/tools/r2rdump/R2RReader.cs
+++ b/src/tools/r2rdump/R2RReader.cs
@@ -174,6 +174,24 @@ namespace R2RDump
}
}
+ public bool InputArchitectureMatchesDisassemblerArchitecture()
+ {
+ 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;
+ }
+ }
+
/// <summary>
/// Each runtime function entry has 3 fields for Amd64 machines (StartAddress, EndAddress, UnwindRVA), otherwise 2 fields (StartAddress, UnwindRVA)
/// </summary>