Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision 98d6965d977b39416143b988d932952fb731637a)
+++ libcfa/src/exception.c	(revision 332bd3303d25cdb1960e2fe79243496df86ebe8b)
@@ -69,6 +69,6 @@
 
 
-// This macro should be the only thing that needs to change across machines.  Used in the personality function, way down
-// in termination.
+// This macro should be the only thing that needs to change across machines.
+// Used in the personality function, way down in termination.
 // struct _Unwind_Context * -> _Unwind_Reason_Code(*)(exception_t *)
 #define MATCHER_FROM_CONTEXT(ptr_to_context) \
@@ -102,6 +102,7 @@
 }
 
-// Do we control where exceptions get thrown even with concurency?  If not these are not quite thread safe, the cleanup
-// hook has to be added after the node is built but before it is made the top node.
+// Do we control where exceptions get thrown even with concurency?
+// If not these are not quite thread safe, the cleanup hook has to
+// be added after the node is built but before it is made the top node.
 
 void __cfaabi_ehm__try_resume_setup(struct __cfaabi_ehm__try_resume_node * node,
@@ -212,13 +213,14 @@
 	_Unwind_Reason_Code ret = _Unwind_RaiseException( &this_exception_storage );
 
-	// If we reach here it means something happened.  For resumption to work we need to find a way to return back to
-	// here.  Most of them will probably boil down to setting a global flag and making the phase 1 either stop or
-	// fail.  Causing an error on purpose may help avoiding unnecessary work but it might have some weird side
-	// effects.  If we just pretend no handler was found that would work but may be expensive for no reason since we
-	// will always search the whole stack.
+	// If we reach here it means something happened. For resumption to work we need to find a way
+	// to return back to here. Most of them will probably boil down to setting a global flag and
+	// making the phase 1 either stop or fail. Causing an error on purpose may help avoiding
+	// unnecessary work but it might have some weird side effects. If we just pretend no handler
+	// was found that would work but may be expensive for no reason since we will always search
+	// the whole stack.
 
 	if( ret == _URC_END_OF_STACK ) {
-		// No proper handler was found.  This can be handled in several way.  C++ calls std::terminate Here we
-		// force unwind the stack, basically raising a cancellation.
+		// No proper handler was found. This can be handled in many ways, C++ calls std::terminate.
+		// Here we force unwind the stack, basically raising a cancellation.
 		printf("Uncaught exception %p\n", &this_exception_storage);
 
@@ -228,5 +230,5 @@
 	}
 
-	// We did not simply reach the end of the stack without finding a handler.  Something wen't wrong
+	// We did not simply reach the end of the stack without finding a handler. This is an error.
 	printf("UNWIND ERROR %d after raise exception\n", ret);
 	abort();
@@ -254,7 +256,8 @@
 	abort();
 }
-#else
-// This is our personality routine.  For every stack frame anotated with ".cfi_personality 0x3,__gcfa_personality_v0".
-// This function will be called twice when unwinding.  Once in the search phased and once in the cleanup phase.
+#else // PIC
+// This is our personality routine. For every stack frame annotated with
+// ".cfi_personality 0x3,__gcfa_personality_v0" this function will be called twice when unwinding.
+//  Once in the search phase and once in the cleanup phase.
 _Unwind_Reason_Code __gcfa_personality_v0 (
 		int version, _Unwind_Action actions, unsigned long long exceptionClass,
@@ -264,5 +267,6 @@
 
 	//__cfaabi_dbg_print_safe("CFA: 0x%lx\n", _Unwind_GetCFA(context));
-	__cfaabi_dbg_print_safe("Personality function (%d, %x, %llu, %p, %p):", version, actions, exceptionClass, unwind_exception, context);
+	__cfaabi_dbg_print_safe("Personality function (%d, %x, %llu, %p, %p):",
+			version, actions, exceptionClass, unwind_exception, context);
 
 	// If we've reached the end of the stack then there is nothing much we can do...
@@ -291,5 +295,5 @@
 	// Get the instuction pointer and a reading pointer into the exception table
 	lsda_header_info lsd_info;
-	const unsigned char * cur_ptr = parse_lsda_header( context, lsd, &lsd_info);
+	const unsigned char * cur_ptr = parse_lsda_header(context, lsd, &lsd_info);
 	_Unwind_Ptr instruction_ptr = _Unwind_GetIP( context );
 
@@ -302,8 +306,8 @@
 
 		// Decode the common stuff we have in here
-		cur_ptr = read_encoded_value (0, lsd_info.call_site_encoding, cur_ptr, &callsite_start);
-		cur_ptr = read_encoded_value (0, lsd_info.call_site_encoding, cur_ptr, &callsite_len);
-		cur_ptr = read_encoded_value (0, lsd_info.call_site_encoding, cur_ptr, &callsite_landing_pad);
-		cur_ptr = read_uleb128 (cur_ptr, &callsite_action);
+		cur_ptr = read_encoded_value(0, lsd_info.call_site_encoding, cur_ptr, &callsite_start);
+		cur_ptr = read_encoded_value(0, lsd_info.call_site_encoding, cur_ptr, &callsite_len);
+		cur_ptr = read_encoded_value(0, lsd_info.call_site_encoding, cur_ptr, &callsite_landing_pad);
+		cur_ptr = read_uleb128(cur_ptr, &callsite_action);
 
 		// Have we reach the correct frame info yet?
@@ -316,10 +320,11 @@
 			void * ep = (void*)lsd_info.Start + callsite_start + callsite_len;
 			void * ip = (void*)instruction_ptr;
-			__cfaabi_dbg_print_safe("\nfound %p - %p (%p, %p, %p), looking for %p\n", bp, ep, ls, cs, cl, ip);
+			__cfaabi_dbg_print_safe("\nfound %p - %p (%p, %p, %p), looking for %p\n",
+					bp, ep, ls, cs, cl, ip);
 #endif // __CFA_DEBUG_PRINT__
 			continue;
 		}
 
-		// Have we gone too far
+		// Have we gone too far?
 		if( lsd_info.Start + callsite_start > instruction_ptr ) {
 			printf(" gone too far");
@@ -331,8 +336,8 @@
 			// Which phase are we in
 			if (actions & _UA_SEARCH_PHASE) {
-				// Search phase, this means we probably found a potential handler and must check if it is a match
-
-				// If we have arbitrarily decided that 0 means nothing to do and 1 means there is a potential handler
-				// This doesn't seem to conflict the gcc default behavior
+				// In search phase, these means we found a potential handler we must check.
+
+				// We have arbitrarily decided that 0 means nothing to do and 1 means there is
+				// a potential handler. This doesn't seem to conflict the gcc default behavior.
 				if (callsite_action != 0) {
 					// Now we want to run some code to see if the handler matches
@@ -351,9 +356,6 @@
 					// The current apprach uses one exception table entry per try block
 					_uleb128_t imatcher;
-					// Get the relative offset to the
-					cur_ptr = read_uleb128 (cur_ptr, &imatcher);
-
-					// Get a function pointer from the relative offset and call it
-					// _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher;
+					// Get the relative offset to the {...}?
+					cur_ptr = read_uleb128(cur_ptr, &imatcher);
 
 					_Unwind_Reason_Code (*matcher)(exception_t *) =
@@ -414,6 +416,6 @@
 }
 
-// Try statements are hoisted out see comments for details.  With this could probably be unique and simply linked from
-// libcfa but there is one problem left, see the exception table for details
+// Try statements are hoisted out see comments for details. While this could probably be unique
+// and simply linked from libcfa but there is one problem left, see the exception table for details
 __attribute__((noinline))
 void __cfaabi_ehm__try_terminate(void (*try_block)(),
@@ -428,7 +430,6 @@
 	// assembly works.
 
-	// Setup the personality routine
+	// Setup the personality routine and exception table.
 	asm volatile (".cfi_personality 0x3,__gcfa_personality_v0");
-	// Setup the exception table
 	asm volatile (".cfi_lsda 0x3, .LLSDACFA2");
 
@@ -442,5 +443,5 @@
 	asm volatile goto ("" : : : : CATCH );
 
-	// Normal return
+	// Normal return for when there is no throw.
 	return;
 
@@ -459,26 +460,33 @@
 }
 
-// Exception table data we need to generate.  While this is almost generic, the custom data refers to foo_try_match try
-// match, which is no way generic.  Some more works need to be done if we want to have a single call to the try routine.
+// Exception table data we need to generate. While this is almost generic, the custom data refers
+// to {*}try_terminate, which is no way generic. Some more works need to be done if we want to
+// have a single call to the try routine.
 
 #if defined( __i386 ) || defined( __x86_64 )
 asm (
-	//HEADER
+	// HEADER
 	".LFECFA1:\n"
 	"	.globl	__gcfa_personality_v0\n"
 	"	.section	.gcc_except_table,\"a\",@progbits\n"
-	".LLSDACFA2:\n"							//TABLE header
+	// TABLE HEADER (important field is the BODY length at the end)
+	".LLSDACFA2:\n"
 	"	.byte	0xff\n"
 	"	.byte	0xff\n"
 	"	.byte	0x1\n"
-	"	.uleb128 .LLSDACSECFA2-.LLSDACSBCFA2\n"		// BODY length
-	// Body uses language specific data and therefore could be modified arbitrarily
-	".LLSDACSBCFA2:\n"						// BODY start
-	"	.uleb128 .TRYSTART-__cfaabi_ehm__try_terminate\n"		// Handled area start  (relative to start of function)
-	"	.uleb128 .TRYEND-.TRYSTART\n"				// Handled area length
-	"	.uleb128 .CATCH-__cfaabi_ehm__try_terminate\n"				// Hanlder landing pad adress  (relative to start of function)
-	"	.uleb128 1\n"						// Action code, gcc seems to use always 0
-	".LLSDACSECFA2:\n"						// BODY end
-	"	.text\n"							// TABLE footer
+	"	.uleb128 .LLSDACSECFA2-.LLSDACSBCFA2\n"
+	// BODY (language specific data)
+	".LLSDACSBCFA2:\n"
+	//	Handled area start (relative to start of function)
+	"	.uleb128 .TRYSTART-__cfaabi_ehm__try_terminate\n"
+	//	Handled area length
+	"	.uleb128 .TRYEND-.TRYSTART\n"
+	//	Handler landing pad address (relative to start of function)
+	"	.uleb128 .CATCH-__cfaabi_ehm__try_terminate\n"
+	//	Action code, gcc seems to always use 0.
+	"	.uleb128 1\n"
+	// TABLE FOOTER
+	".LLSDACSECFA2:\n"
+	"	.text\n"
 	"	.size	__cfaabi_ehm__try_terminate, .-__cfaabi_ehm__try_terminate\n"
 	"	.ident	\"GCC: (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901\"\n"
@@ -486,3 +494,3 @@
 );
 #endif // __i386 || __x86_64
-#endif //PIC
+#endif // PIC
