Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-11-07 20:41:42 +0300
committerGitHub <noreply@github.com>2016-11-07 20:41:42 +0300
commitcb9c8599b93fa0baeb576cb4559d1c9e7e906d23 (patch)
tree568c4881443d418d083eadd8982ee3775a987b68 /src/Native/Runtime/windows
parentff66359c760c7781b19c18e3fbcf3cbe76a5ed07 (diff)
Unhandled exception handling on Unix (#2157)
- 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
Diffstat (limited to 'src/Native/Runtime/windows')
-rw-r--r--src/Native/Runtime/windows/CoffNativeCodeManager.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Native/Runtime/windows/CoffNativeCodeManager.cpp b/src/Native/Runtime/windows/CoffNativeCodeManager.cpp
index 79ac103b6..e15056ada 100644
--- a/src/Native/Runtime/windows/CoffNativeCodeManager.cpp
+++ b/src/Native/Runtime/windows/CoffNativeCodeManager.cpp
@@ -17,7 +17,7 @@
#include "CommonMacros.inl"
#define GCINFODECODER_NO_EE
-#include "coreclr\gcinfodecoder.cpp"
+#include "coreclr/gcinfodecoder.cpp"
#define UBF_FUNC_KIND_MASK 0x03
#define UBF_FUNC_KIND_ROOT 0x00
@@ -306,7 +306,7 @@ bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo,
CoffNativeMethodInfo * pNativeMethodInfo = (CoffNativeMethodInfo *)pMethodInfo;
size_t unwindDataBlobSize;
- PTR_VOID pUnwindDataBlob = GetUnwindDataBlob(m_moduleBase, pNativeMethodInfo->mainRuntimeFunction, &unwindDataBlobSize);
+ PTR_VOID pUnwindDataBlob = GetUnwindDataBlob(m_moduleBase, pNativeMethodInfo->runtimeFunction, &unwindDataBlobSize);
PTR_UInt8 p = dac_cast<PTR_UInt8>(pUnwindDataBlob) + unwindDataBlobSize;
@@ -314,6 +314,12 @@ bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo,
if ((unwindBlockFlags & UBF_FUNC_REVERSE_PINVOKE) != 0)
{
+ // Reverse PInvoke transition should on the main function body only
+ assert(pNativeMethodInfo->mainRuntimeFunction == pNativeMethodInfo->runtimeFunction);
+
+ if ((unwindBlockFlags & UBF_FUNC_HAS_EHINFO) != 0)
+ p += sizeof(int32_t);
+
GcInfoDecoder decoder(GCInfoToken(p), DECODE_REVERSE_PINVOKE_VAR);
// @TODO: CORERT: Encode reverse PInvoke frame slot in GCInfo: https://github.com/dotnet/corert/issues/2115
@@ -321,12 +327,11 @@ bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo,
// assert(slot != NO_REVERSE_PINVOKE_FRAME);
*ppPreviousTransitionFrame = (PTR_VOID)-1;
- }
- else
- {
- *ppPreviousTransitionFrame = NULL;
+ return true;
}
+ *ppPreviousTransitionFrame = NULL;
+
CONTEXT context;
KNONVOLATILE_CONTEXT_POINTERS contextPointers;
@@ -444,6 +449,7 @@ bool CoffNativeCodeManager::EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMet
}
*pMethodStartAddress = dac_cast<PTR_VOID>(m_moduleBase + pNativeMethodInfo->mainRuntimeFunction->BeginAddress);
+
pEnumState->pMethodStartAddress = dac_cast<PTR_UInt8>(*pMethodStartAddress);
pEnumState->pEHInfo = dac_cast<PTR_UInt8>(m_moduleBase + *dac_cast<PTR_Int32>(p));
pEnumState->uClause = 0;