HostSymbolProvider: implement IClrSymbolProvider.TryGetFieldOffset#5899
Open
max-charlamb wants to merge 1 commit into
Open
HostSymbolProvider: implement IClrSymbolProvider.TryGetFieldOffset#5899max-charlamb wants to merge 1 commit into
max-charlamb wants to merge 1 commit into
Conversation
Implements the new IClrSymbolProvider.TryGetFieldOffset method by resolving (typeName, fieldName) -> offset through the host's type system: IModuleSymbols.TryGetType -> IType.TryGetField -> IField.Offset (backed by the debugger, e.g. DbgEng over the loaded PDBs). moduleBase == 0 searches every loaded module; NativeAOT single-file images have one managed module, so the first hit is unambiguous. Used by the cDAC for NativeAOT, where managed type layout is not available through ECMA metadata at runtime but is present in the image's debug info. typeName is the name as it appears in the debug info (the ILC-mangled UDT name, e.g. S_P_CoreLib_System_Exception). Depends on the ClrMD change adding IClrSymbolProvider.TryGetFieldOffset; requires a Microsoft.Diagnostics.Runtime version bump (via dependency flow) before this compiles in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Implements IClrSymbolProvider.TryGetFieldOffset in HostSymbolProvider by routing (moduleBase, typeName, fieldName) -> offset through the host’s module-scoped symbol/type system (IModuleSymbols.TryGetType → IType.TryGetField → IField.Offset). This extends the existing “scope to moduleBase” behavior used for symbol-address lookup to field-offset lookup as well.
Changes:
- Extend
HostSymbolProviderto support field offset resolution scoped to a specific module base address. - Update the class summary to reflect the expanded responsibilities of the adapter.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
steveisok
approved these changes
Jun 25, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements
IClrSymbolProvider.TryGetFieldOffsetinHostSymbolProvider, resolving(typeName, fieldName) -> offsetthrough the host's type system:IModuleSymbols.TryGetType->IType.TryGetField->IField.Offset(backed by the debugger, e.g. DbgEng over the loaded PDBs). The lookup is scoped to the module atmoduleBase, mirroringTryGetSymbolAddress.Dependency
Depends on microsoft/clrmd#1488, which adds
IClrSymbolProvider.TryGetFieldOffset. This won't compile in CI until that ships andMicrosoft.Diagnostics.Runtimeis bumped via dependency flow. Opened as a draft; hold until the ClrMD bump lands.