Skip to content

Add perfmap debug directory entry to crossgen2 output as needed - #58552

Merged
hoyosjs merged 5 commits into
dotnet:mainfrom
hoyosjs:juhoyosa/fix-r2rmap-guid
Sep 10, 2021
Merged

Add perfmap debug directory entry to crossgen2 output as needed#58552
hoyosjs merged 5 commits into
dotnet:mainfrom
hoyosjs:juhoyosa/fix-r2rmap-guid

Conversation

@hoyosjs

@hoyosjshoyosjs commented Sep 2, 2021

Copy link
Copy Markdown
Member

This change in general contains:

  • Only pass perfmap argument for Linux SPC. We were always passing it down (not all that important)
  • Add PerfMap Debug Directory Entry spec to the COFF spec for SRM.
  • Enhance CrossGen2 to emit PerfMap debug directory record. Tested that I can correlate entries as needed on Windows.
    For example the header in the perfmap is:
FFFFFFFF 00 6819a895-6568-e40a-b8dc-cc7f97c73524
FFFFFFFE 00 1
FFFFFFFD 00 Windows
FFFFFFFC 00 X64
FFFFFFFC 00 CoreRT

and the entries in the PE are:

--- PE FILE: E:\repos\runtime\artifacts\bin\coreclr\windows.x64.Debug\System.Private.CoreLib.dll ---
CodeView
System.Private.CoreLib.ni.pdb, Age = 1, 19c03592-b136-04bf-12f9-f1a7a2d1efc3
21
System.Private.CoreLib.r2rmap, Signature = 95 a8 19 68 68 65 0a e4 b8 dc cc 7f 97 c7 35 24, Version = 1
CodeView
E:\repos\runtime\artifacts\obj\coreclr\System.Private.CoreLib\x64\Debug\System.Private.CoreLib.pdb, Age = 1, 89aa3509-94b5-4f46-8f53-a0fab72a0639
Reproducible
  • Stop emitting an ni.pdb record when PDB is not requested (Linux scenario).

@hoyosjs

Copy link
Copy Markdown
MemberAuthor

@hoyosjs

Copy link
Copy Markdown
MemberAuthor

This is related to #58468 on main.

@trylek

Copy link
Copy Markdown
Member

In your snippet of the PerfMap file above,

FFFFFFFC 00 X64
FFFFFFFC 00 CoreRT

is the duplication of the key (-4) intentional?

@trylektrylek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly looks great to me, I believe I spotted a small copy & paste bug and I hope for feedback from Michal regarding the ABI but I guess you're the one who knows where this information is used. Thank you!

Comment threaddocs/design/specs/PE-COFF.md Outdated
Comment threadsrc/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs Outdated
Comment threadsrc/coreclr/tools/r2rdump/R2RDump.cs Outdated
Comment threadsrc/coreclr/tools/r2rdump/R2RDump.cs Outdated
Comment threadsrc/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs Outdated

@davidwrightondavidwrighton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not attempt to stabilize any constants in the typesystem proper. That is not the appopriate place for stable constants.

Comment threadsrc/coreclr/tools/Common/TypeSystem/Common/TargetArchitecture.cs Outdated
Comment threadsrc/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs Outdated
Comment threadsrc/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs Outdated
Comment threadsrc/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs Outdated
Comment threadsrc/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs Outdated
Comment threadsrc/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs Outdated
@hoyosjs
hoyosjsforce-pushed the juhoyosa/fix-r2rmap-guid branch from 6a06a60 to dc8d8f1CompareSeptember 9, 2021 05:31
@hoyosjs
hoyosjs marked this pull request as ready for review September 9, 2021 05:32
This is used to correlate PE's with their corresponding PerfMaps. For example the header in the perfmap could be:
```
FFFFFFFF 00 026D4D21B3EE3D93843FF7A964235822
FFFFFFFE 00 1
FFFFFFFD 00 1
FFFFFFFC 00 3
FFFFFFFB 00 1
```
And the PE will have the corresponding entries in the PE as:
```
PerfMap (Type 21):
System.Private.CoreLib.ni.r2rmap, Signature = 026d4d21b3ee3d93843ff7a964235822, Version = 1
```
@hoyosjs
hoyosjsforce-pushed the juhoyosa/fix-r2rmap-guid branch from dc8d8f1 to 7adb893CompareSeptember 10, 2021 07:10
@hoyosjs
hoyosjs merged commit 561f89a into dotnet:mainSep 10, 2021
@hoyosjs
hoyosjs deleted the juhoyosa/fix-r2rmap-guid branch September 10, 2021 20:19
@ghostghost locked as resolved and limited conversation to collaborators Oct 10, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@hoyosjs@trylek@davidwrighton@MichalStrehovsky