[x86/Linux] Port 'TransitionFrame::UpdateRegDisplay'#8964
Conversation
|
\CC @seanshpark |
|
@janvorli Please take a look. |
| pRD->IsCallerSPValid = FALSE; | ||
|
|
||
| pRD->pCurrentContext->Eip = pRD->ControlPC; | ||
| pRD->pCurrentContext->Esp = GetSP(); |
There was a problem hiding this comment.
Why is the Eip read from the pRD and the Esp is not? It looks suspicious.
There was a problem hiding this comment.
It seems that stack walker recognizes the target frame using established frame address (unmodified Esp).
When I set pRD->pCurrentContext->Esp same as above, stack walker failed to recognize the target frame (which results in assertion failure).
There was a problem hiding this comment.
A have looked into how this should work in detail. The difference between the value returned by GetSP and the value set to pRD->Esp is that the pRD->Esp = GetSP() + cbStackPop. In other words, one represent the SP before pushing the stack arguments at the caller and the other SP after pushing them.
So the pRD->Esp should be set for WIN64EXCEPTIONS to the GetSP too. the pEsp and the pRD->pCurrentContext->Esp need to match.
And in fact, it happens later in the SyncRegDisplayToCurrentContext. So the lines 305 and 306 are not needed for WIN64EXCEPTIONS if you change the line 312 to
pRD->pCurrentContext->Eip = *PTR_PCODE(pRD->PCTAddr);Could you please make this change and change the lines 305 and 306 to be for !WIN64EXCEPTIONS only?
| pRD->IsCallerSPValid = FALSE; | ||
|
|
||
| pRD->pCurrentContext->Eip = pRD->ControlPC; | ||
| pRD->pCurrentContext->Esp = GetSP(); |
There was a problem hiding this comment.
A have looked into how this should work in detail. The difference between the value returned by GetSP and the value set to pRD->Esp is that the pRD->Esp = GetSP() + cbStackPop. In other words, one represent the SP before pushing the stack arguments at the caller and the other SP after pushing them.
So the pRD->Esp should be set for WIN64EXCEPTIONS to the GetSP too. the pEsp and the pRD->pCurrentContext->Esp need to match.
And in fact, it happens later in the SyncRegDisplayToCurrentContext. So the lines 305 and 306 are not needed for WIN64EXCEPTIONS if you change the line 312 to
pRD->pCurrentContext->Eip = *PTR_PCODE(pRD->PCTAddr);Could you please make this change and change the lines 305 and 306 to be for !WIN64EXCEPTIONS only?
…8964) * [x86/Linux] Port 'TransitionFrame::UpdateRegDisplay' * Use different ControlPC/Esp values for WIN64EXCEPTIONS Commit migrated from dotnet/coreclr@9743c40
This commit allows Core CLR to show "Unhandled Exception" message on x86/Linux.