-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Adding GetJitHelperFunctionName cDAC API #126281
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
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,58 @@ | ||
| # Contract AuxiliarySymbols | ||
|
|
||
| This contract provides name resolution for helper functions whose executing code | ||
| resides at dynamically-determined addresses. | ||
|
|
||
| ## APIs of contract | ||
|
|
||
| ``` csharp | ||
| // Attempts to resolve a code address to a helper function name. | ||
| // Returns true if the address matches a known helper, with the name in symbolName. | ||
| // Returns false if the address does not match any known helper. | ||
| bool TryGetAuxiliarySymbolName(TargetPointer ip, out string symbolName); | ||
| ``` | ||
|
|
||
| ## Version 1 | ||
|
|
||
| Data descriptors used: | ||
| | Data Descriptor Name | Field | Meaning | | ||
| | --- | --- | --- | | ||
| | `AuxiliarySymbolInfo` | `Address` | Code pointer to the dynamically-located helper function | | ||
| | `AuxiliarySymbolInfo` | `Name` | Pointer to a null-terminated char string with the helper name | | ||
|
|
||
| Global variables used: | ||
| | Global Name | Type | Purpose | | ||
| | --- | --- | --- | | ||
| | `AuxiliarySymbols` | TargetPointer | Pointer to an array of `AuxiliarySymbolInfo` entries | | ||
| | `AuxiliarySymbolCount` | TargetPointer | Pointer to the count of populated entries in the array | | ||
|
|
||
|
rcj1 marked this conversation as resolved.
|
||
| Contracts used: none | ||
|
|
||
| ``` csharp | ||
| bool TryGetAuxiliarySymbolName(TargetPointer ip, out string? symbolName) | ||
| { | ||
| symbolName = null; | ||
|
|
||
| TargetCodePointer codePointer = CodePointerFromAddress(ip); | ||
|
|
||
| TargetPointer helperArray = target.ReadGlobalPointer("AuxiliarySymbols"); | ||
| uint count = target.Read<uint>(target.ReadGlobalPointer("AuxiliarySymbolCount")); | ||
|
|
||
| uint entrySize = /* AuxiliarySymbolInfo size */; | ||
|
|
||
| for (uint i = 0; i < count; i++) | ||
| { | ||
| TargetPointer entryAddr = helperArray + (i * entrySize); | ||
| TargetCodePointer address = target.ReadCodePointer(entryAddr + /* AuxiliarySymbolInfo::Address offset */); | ||
| TargetPointer namePointer = target.ReadPointer(entryAddr + /* AuxiliarySymbolInfo::Name offset */); | ||
|
|
||
| if (address == codePointer && namePointer != TargetPointer.Null) | ||
| { | ||
| symbolName = target.ReadUtf8String(namePointer); | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
rcj1 marked this conversation as resolved.
|
||
| ``` | ||
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
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
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
18 changes: 18 additions & 0 deletions
18
...cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IAuxiliarySymbols.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,18 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Microsoft.Diagnostics.DataContractReader.Contracts; | ||
|
|
||
| public interface IAuxiliarySymbols : IContract | ||
| { | ||
| static string IContract.Name { get; } = nameof(AuxiliarySymbols); | ||
| bool TryGetAuxiliarySymbolName(TargetPointer ip, [NotNullWhen(true)] out string? symbolName) => throw new NotImplementedException(); | ||
| } | ||
|
|
||
| public readonly struct AuxiliarySymbols : IAuxiliarySymbols | ||
| { | ||
| // Everything throws NotImplementedException | ||
| } |
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
16 changes: 16 additions & 0 deletions
16
...c/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/AuxiliarySymbolsFactory.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,16 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Microsoft.Diagnostics.DataContractReader.Contracts; | ||
|
|
||
| public sealed class AuxiliarySymbolsFactory : IContractFactory<IAuxiliarySymbols> | ||
| { | ||
| IAuxiliarySymbols IContractFactory<IAuxiliarySymbols>.CreateContract(Target target, int version) | ||
| { | ||
| return version switch | ||
| { | ||
| 1 => new AuxiliarySymbols_1(target), | ||
| _ => default(AuxiliarySymbols), | ||
| }; | ||
| } | ||
| } |
Oops, something went wrong.
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.