Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.c

    rd119d613 rba70330  
    209209                void * stop_param) {
    210210        // Verify actions follow the rules we expect.
    211         verify(actions & _UA_CLEANUP_PHASE);
    212         verify(actions & _UA_FORCE_UNWIND);
    213         verify(!(actions & _UA_SEARCH_PHASE));
    214         verify(!(actions & _UA_HANDLER_FRAME));
     211        verify((actions & _UA_CLEANUP_PHASE) && (actions & _UA_FORCE_UNWIND));
     212        verify(!(actions & (_UA_SEARCH_PHASE | _UA_HANDLER_FRAME)));
    215213
    216214        if ( actions & _UA_END_OF_STACK ) {
    217                 abort();
     215                exit(1);
    218216        } else {
    219217                return _URC_NO_REASON;
     
    221219}
    222220
    223 __attribute__((weak)) _Unwind_Reason_Code
    224 __cfaehm_cancellation_unwind( struct _Unwind_Exception * exception ) {
    225         return _Unwind_ForcedUnwind( exception, _Stop_Fn, (void*)0x22 );
    226 }
     221static struct _Unwind_Exception cancel_exception_storage;
    227222
    228223// Cancel the current stack, prefroming approprate clean-up and messaging.
    229224void __cfaehm_cancel_stack( exception_t * exception ) {
    230         __cfaehm_allocate_exception( exception );
    231 
    232         struct exception_context_t * context = this_exception_context();
    233         struct __cfaehm_node * node = EXCEPT_TO_NODE(context->current_exception);
    234 
    235         // Preform clean-up of any extra active exceptions.
    236         while ( node->next ) {
    237                 struct __cfaehm_node * to_free = node->next;
    238                 node->next = to_free->next;
    239                 exception_t * except = NODE_TO_EXCEPT( to_free );
    240                 except->virtual_table->free( except );
    241             free( to_free );
    242         }
    243 
     225        // TODO: Detect current stack and pick a particular stop-function.
    244226        _Unwind_Reason_Code ret;
    245         ret = __cfaehm_cancellation_unwind( &node->unwind_exception );
     227        ret = _Unwind_ForcedUnwind( &cancel_exception_storage, _Stop_Fn, (void*)0x22 );
    246228        printf("UNWIND ERROR %d after force unwind\n", ret);
    247229        abort();
Note: See TracChangeset for help on using the changeset viewer.