Import signature parsing and general improvements in R2RDump (#19813)
authorTomáš Rylek <trylek@microsoft.com>
Fri, 7 Sep 2018 20:56:05 +0000 (22:56 +0200)
committerGitHub <noreply@github.com>
Fri, 7 Sep 2018 20:56:05 +0000 (22:56 +0200)
commit1d00a61b95ce280886c252360851945937b273b7
tree11c977ab4f82a098d1936e2ef5fa7180d292bfa8
parent6cabe95f9dec3162a7407deee3863809511e57be
Import signature parsing and general improvements in R2RDump (#19813)

* Import signature parsing and general improvements in R2RDump

GcInfo - fixed a bug where the machine architecture was stored in
the instance field later than it was used in the calculation of
SlotTable which subsequently ended up with the wrong register set
(ARM64 instead of AMD64).

GcTransition - changed register set selector to a switch as the
previous implementation was incorrect for AMD64.

UnwindInfo - bug fix: the 4-alignment padding should come before
the personality routine, not after it. I have also slightly
simplified the calculation of the padding size.

CoreDisTools - added support for annotating indirect calls with
symbol information for the import cells; fixed formatting of
short relative jumps and added some code comments.

DisassemblingTypeProvider - bumped up some visibilities and made
a few generalizations letting me use this helper in the general
signature parser.

R2RImportSection - replaced binary signature samples with the
actual parsed representation.

R2RReader - I removed special-casing for eager import signatures
that seems wrong - I don't see any equivalent code in the
CoreCLR runtime. Please let me know if anyone is aware of a reason
why this was put here in the first place.

TextDumper and elsewhere - I have removed all tabs from the
R2RDump tool output.

R2RConstants - I have merged the various CoreCLR and R2R constants
in this file - previously they were interspersed in multiple
classes - and I added a bunch of new stuff needed by the signature
parser.

R2RSignature - comprises the newly added R2R signature parser.

Thanks

Tomas

* Slight modification in signature formatting to make it easier to read

I have swapped the ordering of the signature content with the
signature name - based on analyzing actual disassembly produced
by the code I came to the conclusion that the parsed signature
is generally more important than the cell fixup type which is
often obvious just based on the code context.

Thanks

Tomas

* Add dump of unwind info and RVA translation for near jumps / calls

* Add code comment on GetInstruction return value per PR feedback
12 files changed:
src/tools/r2rdump/Amd64/GcInfo.cs
src/tools/r2rdump/Amd64/GcTransition.cs
src/tools/r2rdump/Amd64/UnwindInfo.cs
src/tools/r2rdump/CoreDisTools.cs
src/tools/r2rdump/DisassemblingTypeProvider.cs
src/tools/r2rdump/R2RConstants.cs [new file with mode: 0644]
src/tools/r2rdump/R2RDump.cs
src/tools/r2rdump/R2RImportSection.cs
src/tools/r2rdump/R2RMethod.cs
src/tools/r2rdump/R2RReader.cs
src/tools/r2rdump/R2RSignature.cs [new file with mode: 0644]
src/tools/r2rdump/TextDumper.cs