Skip to content

Adding GetJitHelperFunctionName cDAC API#126281

Merged
rcj1 merged 5 commits into
dotnet:mainfrom
rcj1:jithelpers
Mar 31, 2026
Merged

Adding GetJitHelperFunctionName cDAC API#126281
rcj1 merged 5 commits into
dotnet:mainfrom
rcj1:jithelpers

Conversation

@rcj1

@rcj1 rcj1 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor
  • Adding AuxiliarySymbols cDAC contract with TryGetAuxiliarySymbolName API
  • Looks up given IP in the set of code addresses that are patched at runtime (currently JIT write barriers); if match is found, return the human-friendly name
  • Used in GetJitHelperFunctionName API to return a human-readable string for these during disasm
  • Behavior change: Unmanaged symbols are resolved in fallback paths if present: https://github.com/dotnet/diagnostics/blob/3d151d818166737df8a248d1f7a14f958012ebd5/src/SOS/Strike/disasmX86.cpp#L436. However, we will not see human-readable names for other unmanaged JIT helpers if unmanaged symbols are not present. We had discussed this and decided it was fine.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new cDAC contract (AuxiliarySymbols) to resolve names for dynamically-located JIT helper functions (notably write barriers) and wires it into the legacy SOS DAC GetJitHelperFunctionName API.

Changes:

  • CoreCLR: export a global table/count of “interesting” JIT helper addresses + names and register write-barrier helpers into it.
  • DataContractReader: introduce the IAuxiliarySymbols contract + JitHelperInfo data type and register the factory in the contract registry.
  • Tests/docs: add unit tests for the new contract and a design doc for the contract.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/native/managed/cdac/tests/AuxiliarySymbolsTests.cs New unit tests covering basic address→name resolution for the contract.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader/CachingContractRegistry.cs Registers AuxiliarySymbolsFactory so the contract can be resolved from targets.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs Routes GetJitHelperFunctionName through the new contract and writes UTF-8 to the output buffer.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/OutputBufferHelpers.cs Adds a helper to copy UTF-8 strings into SOS DAC output buffers.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ISOSDacInterface.cs Updates the managed signature for GetJitHelperFunctionName.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/JitHelperInfo.cs New data reader for JitHelperInfo entries in the exported helper table.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/AuxiliarySymbols_1.cs Contract implementation that scans the exported helper table for a matching code pointer.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/AuxiliarySymbolsFactory.cs Factory that instantiates the v1 contract implementation.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Constants.cs Adds global names for the helper table pointer and count.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/DataType.cs Adds DataType.JitHelperInfo.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IAuxiliarySymbols.cs New public contract interface and default “throws” implementation struct.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/ContractRegistry.cs Exposes AuxiliarySymbols from the registry.
src/coreclr/vm/threads.cpp Records dynamically-copied write-barrier addresses and their names into the new “interesting helpers” table.
src/coreclr/vm/jitinterface.h Declares the new helper table/count and SetInterestingJitHelperFunction.
src/coreclr/vm/jitinterface.cpp Provides DAC-accessible storage for the helper table/count under DACCESS_COMPILE.
src/coreclr/vm/jithelpers.cpp Defines and populates the helper table/count and implements SetInterestingJitHelperFunction.
src/coreclr/vm/datadescriptor/datadescriptor.inc Adds the JitHelperInfo type + globals and declares the AuxiliarySymbols contract.
src/coreclr/inc/dacvars.h Adds DAC vars for the exported helper table/count.
docs/design/datacontracts/AuxiliarySymbols.md New design doc describing the contract, descriptors, globals, and algorithm.

Comment thread docs/design/datacontracts/AuxiliarySymbols.md
Comment thread docs/design/datacontracts/AuxiliarySymbols.md Outdated
Comment thread docs/design/datacontracts/AuxiliarySymbols.md Outdated
@max-charlamb

Copy link
Copy Markdown
Member

cDAC code looks good to me, do we have any testing that the helper names work end to end?

@rcj1

rcj1 commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

cDAC code looks good to me, do we have any testing that the helper names work end to end?

There are unit tests, and I have tested locally in windbg.

Comment thread src/coreclr/vm/jitinterface.h Outdated
Copilot AI review requested due to automatic review settings March 30, 2026 19:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Comment thread docs/design/datacontracts/AuxiliarySymbols.md

@noahfalk noahfalk 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 looks good to me assuming we complete the brittle-DAC side you were already following up on.

Copilot AI review requested due to automatic review settings March 30, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Comment thread src/coreclr/vm/jithelpers.cpp
Comment thread src/coreclr/debug/daccess/daccess.cpp
Comment thread docs/design/datacontracts/AuxiliarySymbols.md
@rcj1 rcj1 merged commit 9e9c885 into dotnet:main Mar 31, 2026
121 of 126 checks passed
@rcj1 rcj1 deleted the jithelpers branch March 31, 2026 06:41
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
Sign up for free to 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.

6 participants