summaryrefslogtreecommitdiff
path: root/src/vm/frames.h
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-03-13 16:06:46 +0100
committerJan Vorlicek <janvorli@microsoft.com>2015-03-13 16:25:37 +0100
commit86fab083b53c46fc7cd07fc6d4747465c4257245 (patch)
tree5c5fb23ae0c0f36be866890a91c953f7c1451c9c /src/vm/frames.h
parent6ccf4e2a5db4a8804f113b6958da43bd571c4848 (diff)
downloadcoreclr-86fab083b53c46fc7cd07fc6d4747465c4257245.tar.gz
coreclr-86fab083b53c46fc7cd07fc6d4747465c4257245.tar.bz2
coreclr-86fab083b53c46fc7cd07fc6d4747465c4257245.zip
Fix managed exception unwinding through CallDescrWorkerInternal
This change fixes issue with exception unwinding in the case when the unwinding passed through a frame of the CallDescrWorkerInternal function. This function had personality routine on it, but a windows style personality routine was specified. The windows one has a completely different signature, so the code was crashing. When looking into that, I've found that even if I have implemented a proper Unix style personality routine, it cannot work the same way on Linux as it used to work on Windows. This personality routine's goal is to pop Frames from the Frame list in the current thread so that all frames upto the frame handling the exception are popped. There are two problems on Linux. First, unlike on Windows, the personality routine is not passed the RSP of the frame handling the exception in an official way. Although it can be extracted from the private_2 member of the exception object during the 2nd pass, it is an implementation detail that we cannot rely on. Moreover, even if we used that, it would still not be the right frame in all cases due to the fact that we implement exception filters by catching and rethrowing and so the frame we would get would be the frame of a filtering catch in case there was one. My solution to this problem is to add destructor to the Frame type and let it pop the frame being destroyed if it is still in the list in the current thread. That way the native code unwinding automatically takes care of popping the frames. As an additional changes, I've added handling of the case when the Thread::VirtualUnwindToFirstManagedCallFrame walks out of stack, fixed a stack alignment issue in the recently added StartUnwindingNativeFrames function and a cosmetic change in the UnwindManagedExceptionPass1.
Diffstat (limited to 'src/vm/frames.h')
-rw-r--r--src/vm/frames.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vm/frames.h b/src/vm/frames.h
index 05a7a175f6..3b08f62a6f 100644
--- a/src/vm/frames.h
+++ b/src/vm/frames.h
@@ -418,6 +418,10 @@ class Frame : public FrameBase
public:
+#ifdef FEATURE_PAL
+ virtual ~Frame();
+#endif // FEATURE_PAL
+
//------------------------------------------------------------------------
// Special characteristics of a frame
//------------------------------------------------------------------------