[cDAC] Add GetTargetInfo DacDbi API#130388
Draft
rcj1 wants to merge 1 commit into
Draft
Conversation
Introduces IDacDbiInterface::GetTargetInfo, which reports the target's processor architecture and OS family, along with the TargetInfo/TargetArchitecture/TargetOperatingSystem types. Includes the native DAC implementation and the managed cDAC implementation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the internal DacDbi surface area with a new IDacDbiInterface::GetTargetInfo API that returns a small TargetInfo struct describing the target’s processor architecture and OS “family”, with corresponding managed (cDAC) and native (DAC) implementations.
Changes:
- Adds
GetTargetInfoto the DacDbi COM interface (IDL + C++ interface header) and wires it into the native DAC implementation. - Adds managed definitions (
TargetInfo/TargetArchitecture/TargetOperatingSystem) and a managedDacDbiImpl.GetTargetInfoimplementation backed by theIRuntimeInfocontract. - Introduces DEBUG-only validation to compare cDAC vs legacy DAC results.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Adds managed GetTargetInfo signature plus managed Target* types. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements the managed GetTargetInfo method using IRuntimeInfo and DEBUG compares with legacy. |
| src/coreclr/inc/dacdbi.idl | Adds the TargetInfo struct and the new COM method to the IDL. |
| src/coreclr/debug/inc/dacdbiinterface.h | Adds native Target* enums/struct and the new vtable method. |
| src/coreclr/debug/daccess/dacdbiimpl.h | Declares DacDbiInterfaceImpl::GetTargetInfo. |
| src/coreclr/debug/daccess/dacdbiimpl.cpp | Implements the native GetTargetInfo method using TARGET_* defines. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 9
Comment on lines
+816
to
+817
| Wasm, | ||
| } |
| Unix, | ||
| } | ||
|
|
||
| public struct TargetInfo |
Comment on lines
+5621
to
+5623
|
|
||
| Contracts.IRuntimeInfo runtimeInfo = _target.Contracts.RuntimeInfo; | ||
|
|
| { | ||
| Contracts.RuntimeInfoArchitecture.X86 => TargetArchitecture.X86, | ||
| Contracts.RuntimeInfoArchitecture.X64 => TargetArchitecture.AMD64, | ||
| Contracts.RuntimeInfoArchitecture.Arm => TargetArchitecture.Arm, |
| Contracts.RuntimeInfoArchitecture.LoongArch64 => TargetArchitecture.LoongArch64, | ||
| Contracts.RuntimeInfoArchitecture.RiscV64 => TargetArchitecture.RiscV64, | ||
| Contracts.RuntimeInfoArchitecture.Wasm => TargetArchitecture.Wasm, | ||
| _ => TargetArchitecture.Unknown, |
| Contracts.RuntimeInfoOperatingSystem.Windows => TargetOperatingSystem.Windows, | ||
| Contracts.RuntimeInfoOperatingSystem.Unix => TargetOperatingSystem.Unix, | ||
| Contracts.RuntimeInfoOperatingSystem.Apple => TargetOperatingSystem.Unix, | ||
| _ => TargetOperatingSystem.Unknown, |
Comment on lines
+5614
to
+5616
| public int GetTargetInfo(TargetInfo* pTargetInfo) | ||
| { | ||
| int hr = HResults.S_OK; |
Comment on lines
+2215
to
+2216
| kArchWasm, | ||
| } TargetArchitecture; |
Comment on lines
+7414
to
+7416
| #elif defined(TARGET_WASM) | ||
| pTargetInfo->arch = kArchWasm; | ||
| #else |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
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.
Introduces IDacDbiInterface::GetTargetInfo, which reports the target's processor architecture and OS family, along with the TargetInfo/TargetArchitecture/TargetOperatingSystem types. Includes the native DAC implementation and the managed cDAC implementation.
Needed so that DBI can use this instead of
#ifdef TARGET_XXX.