Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Conversation

@jkotas
Copy link
Member

@jkotas jkotas commented Nov 7, 2016

  • Reduced differences between the unwind info, gc info and eh info encodings between Windows and Unix.
  • Miscellaneous tweaks to get unhandled exceptions fail with gracefully with error message and abort with this change

- Reduced differences between the unwind info, gc info and eh info encodings between Windows and Unix.
- Miscellaneous tweaks to get unhandled exceptions fail with gracefully with error message and abort with this change
@jkotas
Copy link
Member Author

jkotas commented Nov 7, 2016

@janvorli PTLA

@christianscheuer
Copy link
Contributor

christianscheuer commented Nov 7, 2016

@jkotas SO nice that you are already working on this :)
FWIW I just tested this on my real-world OSX app. Before this change, on latest master bits, an exception inside of a managed->unmanaged->managed block went into the infinite loop mentioned in #1867. Now it fails with a Segmentation Fault: 11. Not sure what is happening though.

Stacktrace from lldb from the Segmentation Fault:

 frame #0: 0x000000010005eb73 src`UnixNativeCodeManager::GetFramePointer(MethodInfo*, REGDISPLAY*) + 19
    frame #1: 0x000000010001e39b src`StackFrameIterator::CalculateCurrentMethodState() + 187
    frame #2: 0x000000010001ed21 src`RhpSfiNext + 113
    frame #3: 0x0000000100065350 src`System_Private_CoreLib_System_Runtime_EH__DispatchEx + 296
    frame #4: 0x0000000100062ee2 src`RhThrowEx + 82
    frame #5: 0x000000010005f1b7 src`RhpThrowEx + 148

@jkotas
Copy link
Member Author

jkotas commented Nov 7, 2016

Segmentation Fault: 11. Not sure what is happening though.

This is problem with libunwind on Mac - it does not return pointers where registers were stored. @janvorli Do you have thoughts on the approach we want to take to fix it?

@janvorli
Copy link
Member

janvorli commented Nov 7, 2016

@jkotas can we use the same approach we used for CoreCLR and pin the objects referred to by registers?

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jkotas
Copy link
Member Author

jkotas commented Nov 7, 2016

the same approach we used for CoreCLR and pin the objects referred to by registers?

This crash is in EH, so it has nothing to do pinning. We may be able to use the same approach, but the EH needs to be fixed to be compatible with it.

@janvorli
Copy link
Member

janvorli commented Nov 7, 2016

@jkotas ah, I've thought you meant the general approach. As for fixing this issue in EH, we could add the frame pointer value to the REGDISPLAY for OSX, set it in the UnwindCursorToRegDisplay and make the REGDISPLAY::GetFP return that.
Obviously, we still need to solve the problem for all the other registers in GC. Maybe we could put the whole PAL_LIMITED_CONTEXT into the REGDISPLAY for OSX and let all the register pointers in it point to those. Then after adding the pinning it should work, I think.

@jkotas
Copy link
Member Author

jkotas commented Nov 7, 2016

Or bite the bullet and have a local (limited) DWARF unwinder that does what we need. We can copy the one from mono. I have doubts that what we will be able to get a good perf out of the current scheme: There is too much of copying of large contexts; a lot of pinning (it is different from CoreCLR where we have this problem in the left FCall frames only); redundant unwind info lookups (once to find the LSDA, and second time to do the actual lookup), ... .

@jkotas jkotas merged commit cb9c859 into dotnet:master Nov 7, 2016
@jkotas jkotas deleted the unhandled-exceptions branch November 12, 2016 02:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants