Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision 72828a879c343c05cb0d9db2a75953a0a4cab927)
+++ libcfa/src/exception.c	(revision a201f7be946266cdaec33f64c570c9888610240e)
@@ -10,6 +10,6 @@
 // Created On       : Mon Jun 26 15:13:00 2017
 // Last Modified By : Andrew Beach
-// Last Modified On : Mon Apr 06 14:40:00 2020
-// Update Count     : 15
+// Last Modified On : Wed Apr 08 15:45:00 2020
+// Update Count     : 16
 //
 
@@ -28,4 +28,5 @@
 #include <unwind.h>
 #include <bits/debug.hfa>
+#include "stdhdr/assert.h"
 
 // FIX ME: temporary hack to keep ARM build working
@@ -216,8 +217,13 @@
 		struct _Unwind_Context * unwind_context,
 		void * stop_param) {
-	if ( actions & _UA_END_OF_STACK  ) exit(1);
-	if ( actions & _UA_CLEANUP_PHASE ) return _URC_NO_REASON;
-
-	return _URC_FATAL_PHASE2_ERROR;
+	// Verify actions follow the rules we expect.
+	verify((actions & _UA_CLEANUP_PHASE) && actions & (_UA_FORCE_UNWIND));
+	verify(!(actions & (_UA_SEARCH_PHASE | _UA_HANDER_FRAME)));
+
+	if ( actions & _UA_END_OF_STACK ) {
+		exit(1);
+	} else {
+		return _URC_NO_REASON;
+	}
 }
 
@@ -282,17 +288,22 @@
 			version, actions, exception_class, unwind_exception, unwind_context);
 
-	// If we've reached the end of the stack then there is nothing much we can do...
-	if (actions & _UA_END_OF_STACK) return _URC_END_OF_STACK;
-
+	// Verify that actions follow the rules we expect.
+	// This function should never be called at the end of the stack.
+	verify(!(actions & _UA_END_OF_STACK));
+	// Either only the search phase flag is set or...
 	if (actions & _UA_SEARCH_PHASE) {
+		verify(actions == _UA_SEARCH_PHASE);
 		__cfaabi_dbg_print_safe(" lookup phase");
-	}
-	else if (actions & _UA_CLEANUP_PHASE) {
+	// ... we are in clean-up phase.
+	} else {
+		verify(actions & _UA_CLEANUP_PHASE);
 		__cfaabi_dbg_print_safe(" cleanup phase");
-	}
-	// Just in case, probably can't actually happen
-	else {
-		printf(" error\n");
-		return _URC_FATAL_PHASE1_ERROR;
+		// We shouldn't be the handler frame during forced unwind.
+		if (actions & _UA_HANDLER_FRAME) {
+			verify(!(actions & _UA_FORCE_UNWIND));
+			__cfaabi_dbg_print_safe(" (handler frame)");
+		} else if (actions & _UA_FORCE_UNWIND) {
+			__cfaabi_dbg_print_safe(" (force unwind)");
+		}
 	}
 
@@ -396,5 +407,5 @@
 			// This is only a cleanup handler, ignore it
 			__cfaabi_dbg_print_safe(" no action");
-		} else if (actions & _UA_CLEANUP_PHASE) {
+		} else {
 			// In clean-up phase, no destructors here but this could be the handler.
 
