-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add perfmap debug directory entry to crossgen2 output as needed #58552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5be412c
Only pass perfmap argument for Linux
hoyosjs 42fc682
Enhance CrossGen2 to emit PerfMap debug directory entry
hoyosjs de38fc0
Emit headers for debug directory entries from the nodes themselves.
hoyosjs 72a5289
Add PerfMap Debug Directory Entry spec
hoyosjs 7adb893
Extend perfmap and r2r documentation
hoyosjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Ready to run PerfMap format | ||
|
|
||
| Traditionally in .NET symbols have been described using PDBs. These are used to map IL to source lines for code that the JIT will compile. The JIT usually emits the data that can then map from IL to a native address for symbolication purposes. | ||
|
|
||
| Ready to run, however, avoids this IL to native code translation at runtime. For this reason, tools that emit R2R images often need to emit auxiliary artifacts to facilitate the mapping between source and native addresses. The Ready to Run PerfMap format describes such one map - where any method in the source code is associated with a region within the R2R image. That way any region from such image that gets executed can be linked back to a method at the source level. This facilitates tasks like stack symbolication for performance oriented investigations, although it is not appropriate to aid in tasks such as debugging at the source line level. | ||
|
|
||
| ## Version 1 | ||
|
|
||
| R2R PerfMaps of version 1 are usually found in files with the extension `.ni.r2rmap`. It's a plain text UTF-8 format where each entry is on a separate line. Each entry is composed of a triplet: an offset relative to the beginning of the image, a length, and a name. The file is laid out in the following as follows. | ||
|
|
||
| ### Header | ||
|
|
||
| The header leads the file and is composed by special entries. Each entry contains a 4 byte integer token in place of an RVA signifying the type of information in the entry, a length that is always 0, and the entry data. The entries are emitted in the following order. | ||
|
|
||
| | Token | Description | | ||
| |:-----------|-----------------------------------------------------------------------| | ||
| | 0xFFFFFFFF | A 16 byte sequence representing a signature to correlate the perfmap with the r2r image. | | ||
| | 0xFFFFFFFE | The version of the perfmap being emitted as a unsigned 4 byte integer. | | ||
| | 0xFFFFFFFD | An unsigned 4 byte unsigned integer representing the OS the image targets. See [enumerables section](#enumerables-used-in-headers) | | ||
| | 0xFFFFFFFC | An unsigned 4 byte unsigned integer representing the architecture the image targets. See [enumerables section](#enumerables-used-in-headers) | | ||
| | 0xFFFFFFFB | An unsigned 4 byte unsigned integer representing the ABI of the image. See [enumerables section](#enumerables-used-in-headers) | | ||
|
|
||
| These entries contain information about the compilation that can be useful to tools and identifiers that can be used to correlate a perfmap with an image as described in ["Ready to Run format - debug directory entries"](./readytorun-format.md#additions-to-the-debug-directory). | ||
|
|
||
|
|
||
| ### Content | ||
|
|
||
| Each entry is a triplet - the relative address of a method with respect to the image start as an unsigned 4 byte integer, the number of bytes used by the native code represented by an unsigned 2 byte integer, and the name of the method. There's one entry per line after the header, and a method can appear more than once since if may have gone through cold/hot path splitting. | ||
|
|
||
| ## Enumerables used in headers. | ||
|
|
||
| ``` | ||
| PerfMapArchitectureToken | ||
| Unknown = 0, | ||
| ARM = 1, | ||
| ARM64 = 2, | ||
| X64 = 3, | ||
| X86 = 4, | ||
| ``` | ||
|
|
||
| ``` | ||
| PerfMapOSToken | ||
| Unknown = 0, | ||
| Windows = 1, | ||
| Linux = 2, | ||
| OSX = 3, | ||
| FreeBSD = 4, | ||
| NetBSD = 5, | ||
| SunOS = 6, | ||
| ``` | ||
|
|
||
| ``` | ||
| PerfMapAbiToken | ||
| Unknown = 0, | ||
| Default = 1, | ||
| Armel = 2, | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/coreclr/tools/aot/ILCompiler.Diagnostics/ReadyToRunDiagnosticsConstants.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Internal.ReadyToRunDiagnosticsConstants; | ||
|
|
||
| public enum PerfMapPseudoRVAToken : uint | ||
| { | ||
| OutputSignature = 0xFFFFFFFF, | ||
| FormatVersion = 0xFFFFFFFE, | ||
| TargetOS = 0xFFFFFFFD, | ||
| TargetArchitecture = 0xFFFFFFFC, | ||
| TargetABI = 0xFFFFFFFB, | ||
| } | ||
|
|
||
| public enum PerfMapArchitectureToken : uint | ||
| { | ||
| Unknown = 0, | ||
| ARM = 1, | ||
| ARM64 = 2, | ||
| X64 = 3, | ||
| X86 = 4, | ||
| } | ||
|
|
||
| public enum PerfMapOSToken : uint | ||
| { | ||
| Unknown = 0, | ||
| Windows = 1, | ||
| Linux = 2, | ||
| OSX = 3, | ||
| FreeBSD = 4, | ||
| NetBSD = 5, | ||
| SunOS = 6, | ||
| } | ||
|
|
||
| public enum PerfMapAbiToken : uint | ||
| { | ||
| Unknown = 0, | ||
| Default = 1, | ||
| Armel = 2, | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.