-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding write capabilities and SetOtherNotificationFlags cDAC API #118141
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
Conversation
rcj1
commented
Jul 28, 2025
- This PR implements the Write and WriteBuffer methods to write an arbitrary value/buffer respsectively to the data target in the cDAC.
- Added a unit test to test writing.
- Implemented SetOtherNotificationFlags cDAC API which requires writing.
* implementing SetOtherNotificationFlags cDAC API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements write capabilities and the SetOtherNotificationFlags cDAC API by adding write methods to the data contract reader framework and implementing a specific notification flags API that requires write access.
Key changes:
- Added Write and WriteBuffer methods to the Target abstraction and ContractDescriptorTarget implementation
- Implemented SetOtherNotificationFlags cDAC API with proper validation and write functionality
- Enhanced mock testing infrastructure to support write operations
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Target.cs | Added abstract Write and WriteBuffer method declarations to the Target base class |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader/ContractDescriptorTarget.cs | Implemented write methods, added WriteToTargetDelegate, and refactored to use DataTargetDelegates |
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.IXCLRDataProcess.cs | Implemented SetOtherNotificationFlags method with validation and write operations |
src/native/managed/cdac/mscordaccore_universal/Legacy/ISOSDacInterface.cs | Added CLRDataOtherNotifyFlag enum for notification flag constants |
src/native/managed/cdac/mscordaccore_universal/Entrypoints.cs | Updated entry points to accept and use write delegate function pointers |
src/coreclr/debug/daccess/cdac.cpp | Added WriteToTargetCallback function and updated initialization call |
src/native/managed/cdac/inc/cdac_reader.h | Updated function signature to include write_to_target parameter |
src/native/managed/cdac/tests/MockMemorySpace.cs | Added WriteContext class with WriteToTarget implementation for testing |
src/native/managed/cdac/tests/ContractDescriptor/ContractDescriptorBuilder.cs | Updated to use both read and write contexts for target creation |
src/native/managed/cdac/tests/ContractDescriptor/TargetTests.cs | Added WriteValue test to verify write functionality |
src/native/managed/cdac/tests/TestPlaceholderTarget.cs | Added WriteBuffer and Write method stubs that throw NotImplementedException |
src/tools/StressLogAnalyzer/src/Program.cs | Added write delegate that throws NotImplementedException for read-only tool |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader/ContractDescriptorTarget.cs
Outdated
Show resolved
Hide resolved
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.IXCLRDataProcess.cs
Outdated
Show resolved
Hide resolved
src/native/managed/cdac/tests/ContractDescriptor/TargetTests.cs
Outdated
Show resolved
Hide resolved
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
Co-authored-by: Copilot <[email protected]>
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.IXCLRDataProcess.cs
Outdated
Show resolved
Hide resolved
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.IXCLRDataProcess.cs
Show resolved
Hide resolved
src/native/managed/cdac/tests/ContractDescriptor/ContractDescriptorBuilder.cs
Outdated
Show resolved
Hide resolved
Have you tested this API on a dump (where the write should fail)? We should verify that the failure happens in a handeled and expected way. |
I'm working on it |
The cDAC behavior matches that of the DAC; Windbg allows writes to dumps, while dotnet-dump does not (quiet failure from the end user's perspective). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple of comments, but generally looks good to me