Changeset 142930b for libcfa/src


Ignore:
Timestamp:
Dec 13, 2023, 4:45:21 PM (11 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
21ad568
Parents:
3e49c477
Message:

A harder revert of exception changes, hopefully it will get the tests working.

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.c

    r3e49c477 r142930b  
    5555}
    5656
    57 struct __cfaehm_base_exception_t * __cfaehm_get_current_exception(void) {
    58         return this_exception_context()->current_exception;
    59 }
    6057
    6158// RESUMPTION ================================================================
     
    312309                struct _Unwind_Context * unwind_context)
    313310{
    314         //__cfadbg_print_safe(exception, "CFA: 0x%lx\n", _Unwind_GetCFA(context));
     311        //! __cfadbg_print_safe(exception, "CFA: 0x%lx\n", _Unwind_GetCFA(unwind_context));
    315312        __cfadbg_print_safe(exception, "Personality function (%d, %x, %llu, %p, %p):",
    316313                        version, actions, exception_class, unwind_exception, unwind_context);
     
    482479// and simply linked from libcfa but there is one problem left, see the exception table for details
    483480__attribute__((noinline))
    484 int __cfaehm_try_terminate(void (*try_block)(),
    485                 __attribute__((unused)) void (*catch_block)(int index, exception_t * except),
     481void __cfaehm_try_terminate(void (*try_block)(),
     482                void (*catch_block)(int index, exception_t * except),
    486483                __attribute__((unused)) int (*match_block)(exception_t * except)) {
    487484        //! volatile int xy = 0;
    488         //! printf("%p %p %p\n", &try_block, &match_block, &xy);
     485        //! printf("%p %p %p %p\n", &try_block, &catch_block, &match_block, &xy);
    489486
    490487        // Setup the personality routine and exception table.
     
    510507
    511508        // Normal return for when there is no throw.
    512         return 0;
     509        return;
    513510
    514511        // Exceptionnal path
     
    521518        asm volatile (".CATCH:");
    522519
    523         return EXCEPT_TO_NODE( this_exception_context()->current_exception )->handler_index;
     520        // Exception handler
     521        // Note: Saving the exception context on the stack breaks termination exceptions.
     522        catch_block( EXCEPT_TO_NODE( this_exception_context()->current_exception )->handler_index,
     523                     this_exception_context()->current_exception );
    524524}
    525525
  • libcfa/src/exception.h

    r3e49c477 r142930b  
    4343extern struct __cfavir_type_info __cfatid_exception_t;
    4444
    45 struct __cfaehm_base_exception_t * __cfaehm_get_current_exception(void);
    4645
    4746void __cfaehm_cancel_stack(exception_t * except) __attribute__((noreturn));
     
    5857
    5958// Function catches termination exceptions.
    60 int __cfaehm_try_terminate(
     59void __cfaehm_try_terminate(
    6160        void (*try_block)(),
    6261        void (*catch_block)(int index, exception_t * except),
Note: See TracChangeset for help on using the changeset viewer.