-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix data breakpoint issues #46763
Fix data breakpoint issues #46763
Conversation
Tagging subscribers to this area: @tommcdon Issue DetailsCurrently being tested Fixes #46644 /cc @chuckries
|
The alternative design would to have runtime/src/coreclr/debug/ee/controller.cpp Lines 2708 to 2716 in 09a1e77
I felt this PR might be easier to get through servicing for .NET 5. In my mind it is slightly simpler. |
For patching .NET 5 this looks like a good fix that minimizes the change in behavior from what we have right now. I'm hoping in the longer term fix for .NET 6 we could be a little more aggresive and avoid ever creating/queueing the DebuggerDataBreakpoint controller during the GC. It looks like the current fix is counting on us never going down the JIT write barrier path while the GC is running. Certainly I'd be very surprised if we called the JIT helper from within the GC but it feels more satisfying if long term we didn't have to rely on that kind of assumption. |
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.
LGTM!
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.
Thanks for the fix!
As for the JIT write barrier case, we would run the patch until we left the write barrier. Then we would switch to
As I wrote the alternative design description, I wondered whether it might actually be simpler. I plan to amend this change to
I am going to draft the more direct approach too. I think it might be simple enough to get through servicing. |
src/coreclr/debug/ee/controller.cpp
Outdated
|
||
// Don't queue this object to send an event | ||
return false; | ||
} |
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.
I reverted this change to ignore a DebuggerDataBreakpoint controller when we were in GC. The new change ignores the Data Breakpoint if the data breakpoint is hit during GC suspend (the controller isn't created).
If I left this code, the Data Breakpoint would also be ignored if we entered GC while stepping to find a debug safe point.
So the one risk is somehow we hit a data breakpoint and then enter GC suspend w/o first handling the GC breakpoint.
This comment refers to commit 105d3d4
{ | ||
event.DisposeHandle.fStrong = FALSE; | ||
} | ||
event.DisposeHandle.handleType = m_handleType; |
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.
@hoyosjs FYI, I should have had more curiosity when you asked about deleting pinned handles. It turns out the implementation layers needed fixes (even though ICorDebug didn't).
{ | ||
hr = pProcess->GetDAC()->IsModuleMapped(m_vmModule, isMapped); | ||
} | ||
PUBLIC_API_END(hr); | ||
EX_CATCH_HRESULT(hr); | ||
|
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.
@hoyosjs This is @chuckries proposed fix to CordbModule::IsMappedLayout
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.
No opposition but it was unclear how this fix relates to the data breakpoints issue? I think we should either clarify how it is connected in comments/commit text or fix it in a separate non-servicing PR.
@noahfalk @cshung This changed quite a bit since the last review. Can you take a look again. I plan to take this to servicing. @chuckries Initial testing for this is complete. Let me know if there is more to do. I would like to be sure this is the last change required before merging and backporting to .NET 5. |
Looks good in terms of the controller logic. As long as Chuck doesn't find any issues with the GC notification being used this looks fine ( I don't think this was the code path - I expect that to have been the out of proc notifications). As for the other fix, I'm not sure where the InternalApiHolder reference was coming from, so that's a bit surprising... but if that's true the fix looks fine. |
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.
This looks good to me. Despite being a bit larger the new factoring is easier to reason about being correct and it looks usable as-is for the .NET 6 fix.
We should clarify how that IsMappedLayout change connects or separate it if it isn't essential. Thanks!
{ | ||
hr = pProcess->GetDAC()->IsModuleMapped(m_vmModule, isMapped); | ||
} | ||
PUBLIC_API_END(hr); | ||
EX_CATCH_HRESULT(hr); | ||
|
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.
No opposition but it was unclear how this fix relates to the data breakpoints issue? I think we should either clarify how it is connected in comments/commit text or fix it in a separate non-servicing PR.
I'll clarify it in the servicing PR. It is an orthogonal fix, but w/o it it is impossible to test and verify this PR as VS crashes and restarts because of a debugger assert. While strictly not required for servicing (and may not even make the servicing bar) all testing was done with this patch. The VS team would like the PR as it makes using debug & checked .NET runtime builds possible with VS. If you really think we shouldn't include this in the servicing PR, I can pull it. |
Currently being tested
Fixes #46644
/cc @chuckries