Changeset 8ad5752 for libcfa/src/exception.c
- Timestamp:
- May 21, 2020, 12:22:33 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 66ba544
- Parents:
- 918b90c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/exception.c
r918b90c r8ad5752 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : T ue May 19 14:17:00 202013 // Update Count : 1912 // Last Modified On : Thr May 21 12:18:00 2020 13 // Update Count : 20 14 14 // 15 15 … … 237 237 } 238 238 239 static void __cfaehm_cleanup_default( exception_t ** except ) { 240 __cfaehm_delete_exception( *except ); 241 *except = NULL; 242 } 243 239 244 // The exception that is being thrown must already be stored. 240 245 static void __cfaehm_begin_unwind(void(*defaultHandler)(exception_t *)) { 241 if ( ! this_exception_context()->current_exception ) { 246 struct exception_context_t * context = this_exception_context(); 247 struct _Unwind_Exception * storage = &this_exception_storage; 248 if ( NULL == context->current_exception ) { 242 249 printf("UNWIND ERROR missing exception in begin unwind\n"); 243 250 abort(); … … 245 252 246 253 // Call stdlibc to raise the exception 247 _Unwind_Reason_Code ret = _Unwind_RaiseException( &this_exception_storage ); 254 __cfadbg_print_safe(exception, "Begin unwinding (storage &p, context %p)\n", storage, context); 255 _Unwind_Reason_Code ret = _Unwind_RaiseException( storage ); 248 256 249 257 // If we reach here it means something happened. For resumption to work we need to find a way … … 254 262 // the whole stack. 255 263 264 // We did not simply reach the end of the stack without finding a handler. This is an error. 265 if ( ret != _URC_END_OF_STACK ) { 266 printf("UNWIND ERROR %d after raise exception\n", ret); 267 abort(); 268 } 269 256 270 // No handler found, go to the default operation. 257 if ( ret == _URC_END_OF_STACK ) { 258 __cfadbg_print_safe(exception, "Uncaught exception %p\n", &this_exception_storage); 259 260 defaultHandler( this_exception_context()->current_exception ); 261 } 262 263 // We did not simply reach the end of the stack without finding a handler. This is an error. 264 printf("UNWIND ERROR %d after raise exception\n", ret); 265 abort(); 271 __cfadbg_print_safe(exception, "Uncaught exception %p\n", storage); 272 273 __attribute__((cleanup(__cfaehm_cleanup_default))) 274 exception_t * exception = context->current_exception; 275 defaultHandler( exception ); 266 276 } 267 277
Note: See TracChangeset
for help on using the changeset viewer.