-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix x64 data breakpoint handling after CORINFO_HELP_ARRADDR_ST inlining #127251
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5491,6 +5491,46 @@ AdjustContextForJITHelpers( | |||||||||||
| if (IsIPInMarkedJitHelper(ip)) | ||||||||||||
| { | ||||||||||||
| Thread::VirtualUnwindToFirstManagedCallFrame(pContext); | ||||||||||||
|
|
||||||||||||
| // After unwinding from the native write barrier to the first managed frame, check | ||||||||||||
| // whether that frame is a managed helper that itself called the write barrier and | ||||||||||||
| // keep unwinding until we reach user code. | ||||||||||||
| // | ||||||||||||
| // CastHelpers.StelemRef (CORINFO_HELP_ARRADDR_ST) and its callees StelemRef_Helper | ||||||||||||
| // and StelemRef_Helper_NoCacheLookup all call RuntimeHelpers.WriteBarrier. The call | ||||||||||||
| // chain can be up to 3 levels deep: | ||||||||||||
| // user -> StelemRef -> StelemRef_Helper -> StelemRef_Helper_NoCacheLookup -> WriteBarrier | ||||||||||||
| // | ||||||||||||
| // Prior to the change that inlined CORINFO_HELP_ARRADDR_ST, StelemRef tail-called | ||||||||||||
| // the write barrier so its frame was already destroyed and the unwind went directly | ||||||||||||
| // to user code. With a regular call, the StelemRef family frames remain on the stack. | ||||||||||||
| // | ||||||||||||
| // We identify these helpers by their MethodTable (CastHelpers class), which is stable | ||||||||||||
| // across tiered recompilation. | ||||||||||||
| static MethodTable* s_pCastHelpersMT = nullptr; | ||||||||||||
| while (true) | ||||||||||||
| { | ||||||||||||
|
Comment on lines
+5510
to
+5512
|
||||||||||||
| PCODE currentIP = GetIP(pContext); | ||||||||||||
| if (!ExecutionManager::IsManagedCode(currentIP)) | ||||||||||||
| break; | ||||||||||||
|
|
||||||||||||
| EECodeInfo codeInfo(currentIP); | ||||||||||||
| if (!codeInfo.IsValid()) | ||||||||||||
| break; | ||||||||||||
|
|
||||||||||||
| MethodDesc* pMD = codeInfo.GetMethodDesc(); | ||||||||||||
| if (pMD == nullptr) | ||||||||||||
| break; | ||||||||||||
|
|
||||||||||||
| if (s_pCastHelpersMT == nullptr) | ||||||||||||
| s_pCastHelpersMT = CoreLibBinder::GetExistingClass(CLASS__CASTHELPERS); | ||||||||||||
|
|
||||||||||||
|
Comment on lines
+5526
to
+5527
|
||||||||||||
| s_pCastHelpersMT = CoreLibBinder::GetExistingClass(CLASS__CASTHELPERS); | |
| s_pCastHelpersMT = CoreLibBinder::GetClassIfExist(CLASS__CASTHELPERS); | |
| if (s_pCastHelpersMT == nullptr) | |
| break; |
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.
The local caching is useless. CoreLibBinder has similar cache already.
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.
We have other helpers that have internal managed code between the user code and a write barrier. For example,
BulkMoveWithWriteBarrier. What is the invariant that the debugger expects here?This looks fragile to filter it here. Can this filtering be done in the higher-level debugger instead? The higher level debugger has a better idea what' a user code.