Replace EnumerateModulesInAssembly with combined GetModuleForAssembly; implement in cDAC#128294
Replace EnumerateModulesInAssembly with combined GetModuleForAssembly; implement in cDAC#128294Copilot wants to merge 6 commits into
Conversation
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR refactors the DAC/DBI module-per-assembly query by folding the “is loaded” check into IDacDbiInterface::GetModuleForAssembly, removing the now-dead EnumerateModulesInAssembly callback API, and implementing the updated APIs in the cDAC (Microsoft.Diagnostics.DataContractReader.Legacy) along with updating dump-based tests.
Changes:
- Extends
GetModuleForAssemblyto optionally return an “is module loaded” flag and removesEnumerateModulesInAssemblyfrom the DAC/DBI contract. - Updates right-side (RS) codepaths that prepopulate/enumerate modules to use the combined API.
- Implements the updated interface in cDAC and updates dump tests to validate the new signature/behavior.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiLoaderDumpTests.cs | Updates dump tests to call the new GetModuleForAssembly signature and validate the loaded flag on success. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Updates the managed COM projection to match the new vtable shape and removes the module-enumeration entry. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements the new GetModuleForAssembly (with loaded flag) and implements GetAssemblyFromModule in cDAC; removes legacy fallback for module enumeration. |
| src/coreclr/inc/dacdbi.idl | Updates the IDL contract: changes GetModuleForAssembly signature and removes EnumerateModulesInAssembly / its callback typedef. |
| src/coreclr/debug/inc/dacdbiinterface.h | Updates the native interface definition and removes the module enumeration API documentation/signature. |
| src/coreclr/debug/di/rspriv.h | Removes the RS module-enumeration callback declaration. |
| src/coreclr/debug/di/rsappdomain.cpp | Switches prepopulation logic to call GetModuleForAssembly and gate cache population on the loaded flag. |
| src/coreclr/debug/di/process.cpp | Rewrites shim module enumeration to use the combined GetModuleForAssembly + loaded flag logic. |
| src/coreclr/debug/daccess/dacdbiimpl.h | Updates the DAC implementation class declaration to the new GetModuleForAssembly signature and removes module enumeration. |
| src/coreclr/debug/daccess/dacdbiimpl.cpp | Implements the updated GetModuleForAssembly signature and removes the module enumeration implementation. |
Copilot's findings
- Files reviewed: 10/10 changed files
- Comments generated: 3
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
There was a problem hiding this comment.
Can this method be removed too? Given there is only a single module per assembly it seems overly complex. It seems like there is only a single usage in QueueFakeAssemblyAndModuleEvent
Given we are rewriting this method, maybe we can remove it and modify the call site.
| // vmAssembly - assembly to query | ||
| // pModule - required out parameter that receives the module | ||
| // pIsModuleLoaded - optional out parameter that receives whether the assembly/module is loaded | ||
| // | ||
| virtual HRESULT STDMETHODCALLTYPE GetModuleForAssembly(VMPTR_Assembly vmAssembly, OUT VMPTR_Module * pModule, OUT BOOL * pIsModuleLoaded) = 0; |
| CordbAssembly * pAssemblyInternal = static_cast<CordbAssembly *> (pAssembly); | ||
| VMPTR_Assembly vmAssembly = pAssemblyInternal->GetAssemblyPtr(); | ||
| VMPTR_Module vmModule = VMPTR_Module::NullPtr(); | ||
| static_cast<CordbProcess *>(m_pProcess)->GetDAC()->GetModuleForAssembly(vmAssembly, &vmModule, &isModuleLoaded); |
Uh oh!
There was an error while loading. Please reload this page.