Changes in libcfa/src/exception.c [979df46:851fd92]
- File:
-
- 1 edited
-
libcfa/src/exception.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/exception.c
r979df46 r851fd92 121 121 122 122 123 // MEMORY MANAGEMENT ========================================================= 123 // TERMINATION =============================================================== 124 125 // MEMORY MANAGEMENT (still for integers) 126 // May have to move to cfa for constructors and destructors (references). 124 127 125 128 // How to clean up an exception in various situations. … … 200 203 } 201 204 202 // CANCELLATION ============================================================== 205 // If this isn't a rethrow (*except==0), delete the provided exception. 206 void __cfaehm_cleanup_terminate( void * except ) { 207 if ( *(void**)except ) __cfaehm_delete_exception( *(exception_t **)except ); 208 } 203 209 204 210 // Function needed by force unwind … … 222 228 } 223 229 224 // Cancel the current stack, prefroming approprate clean-up and messaging.225 void __cfaehm_cancel_stack( exception_t * exception ) {226 // TODO: Detect current stack and pick a particular stop-function.227 _Unwind_Reason_Code ret;228 ret = _Unwind_ForcedUnwind( &this_exception_storage, _Stop_Fn, (void*)0x22 );229 printf("UNWIND ERROR %d after force unwind\n", ret);230 abort();231 }232 233 234 // TERMINATION ===============================================================235 236 // If this isn't a rethrow (*except==0), delete the provided exception.237 void __cfaehm_cleanup_terminate( void * except ) {238 if ( *(void**)except ) __cfaehm_delete_exception( *(exception_t **)except );239 }240 241 230 // The exception that is being thrown must already be stored. 242 231 static __attribute__((noreturn)) void __cfaehm_begin_unwind(void) { … … 256 245 // the whole stack. 257 246 258 // No handler found, go to the default operation.259 // Currently this will always be a cancellation.260 247 if ( ret == _URC_END_OF_STACK ) { 261 __cfadbg_print_safe(exception, "Uncaught exception %p\n", &this_exception_storage); 262 263 __cfaehm_cancel_stack(this_exception_context()->current_exception); 248 // No proper handler was found. This can be handled in many ways, C++ calls std::terminate. 249 // Here we force unwind the stack, basically raising a cancellation. 250 printf("Uncaught exception %p\n", &this_exception_storage); 251 252 ret = _Unwind_ForcedUnwind( &this_exception_storage, _Stop_Fn, (void*)0x22 ); 253 printf("UNWIND ERROR %d after force unwind\n", ret); 254 abort(); 264 255 } 265 256
Note:
See TracChangeset
for help on using the changeset viewer.