Fix HelperMethodFrame::UpdateRegDisplay on x86#65589
Merged
jkotas merged 1 commit intodotnet:mainfrom Feb 19, 2022
Merged
Conversation
While running managed debugger tests with x86 runtime debug build, I was hiting an assert in MachineState::pRetAddress() method in a couple of tests. It turns out there was a bug in the HelperMethodFrame::UpdateRegDisplay introduced about 5 years ago that only happens in DAC. The m_MachState can be uninitialized when we enter the method and we were calling m_MachState.pRetAddr() before performing the initialization. This change fixes it.
Member
Author
|
cc: @hoyosjs |
hoyosjs
reviewed
Feb 18, 2022
|
|
||
| InsureInit(false, pUnwoundState); | ||
|
|
||
| pRD->PCTAddr = dac_cast<TADDR>(pUnwoundState->pRetAddr()); |
Member
There was a problem hiding this comment.
Do you know how this branch doesn't trigger the precondition? Sounds like this precondition is only valid in the HMF case for the in-proc unwinder and not for the DAC
Member
There was a problem hiding this comment.
Can contracts be ifdef to be only valid in not the dac? Like
#ifndef DACCESS_COMPILE
// InsureInit has been called
PRECONDITION(m_MachState.isValid());
#endif // DACCESS_COMPILE
Member
Author
There was a problem hiding this comment.
Contracts are not compiled for DAC at all (the contract macro definitions are empty for that case). See here:
runtime/src/coreclr/inc/contract.h
Lines 224 to 227 in 47259d1
hoyosjs
approved these changes
Feb 18, 2022
Member
hoyosjs
left a comment
There was a problem hiding this comment.
For the DAC, this looks like the correct fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While running managed debugger tests with x86 runtime debug build, I was
hiting an assert in
MachineState::pRetAddress()method in a couple oftests.
It turns out there was a bug in the
HelperMethodFrame::UpdateRegDisplayintroduced about 5 years ago that only happens in DAC. The
m_MachStatecan be uninitialized when we enter the method and we were calling
m_MachState.pRetAddr()before performing the initialization.This change fixes it.