- Timestamp:
- Dec 11, 2023, 1:05:50 PM (10 months ago)
- Branches:
- master
- Children:
- dab9fb93
- Parents:
- 81da3da4
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/exception.c
r81da3da4 r2554f24 55 55 } 56 56 57 struct __cfaehm_base_exception_t * __cfaehm_get_current_exception(void) { 58 return this_exception_context()->current_exception; 59 } 57 60 58 61 // RESUMPTION ================================================================ … … 309 312 struct _Unwind_Context * unwind_context) 310 313 { 311 312 314 //__cfadbg_print_safe(exception, "CFA: 0x%lx\n", _Unwind_GetCFA(context)); 313 315 __cfadbg_print_safe(exception, "Personality function (%d, %x, %llu, %p, %p):", … … 412 414 _Unwind_Word match_pos = 413 415 # if defined( __x86_64 ) 416 _Unwind_GetCFA(unwind_context); 417 # elif defined( __i386 ) 414 418 _Unwind_GetCFA(unwind_context) + 8; 415 # elif defined( __i386 )416 _Unwind_GetCFA(unwind_context) + 24;417 419 # elif defined( __ARM_ARCH ) 418 _Unwind_GetCFA(unwind_context) + 40;420 _Unwind_GetCFA(unwind_context) + 16; 419 421 # endif 420 422 int (*matcher)(exception_t *) = *(int(**)(exception_t *))match_pos; … … 480 482 // and simply linked from libcfa but there is one problem left, see the exception table for details 481 483 __attribute__((noinline)) 482 void __cfaehm_try_terminate(void (*try_block)(), 483 void (*catch_block)(int index, exception_t * except), 484 int __cfaehm_try_terminate(void (*try_block)(), 484 485 __attribute__((unused)) int (*match_block)(exception_t * except)) { 485 486 //! volatile int xy = 0; 486 //! printf("%p %p %p %p\n", &try_block, &catch_block, &match_block, &xy);487 //! printf("%p %p %p\n", &try_block, &match_block, &xy); 487 488 488 489 // Setup the personality routine and exception table. … … 508 509 509 510 // Normal return for when there is no throw. 510 return ;511 return 0; 511 512 512 513 // Exceptionnal path … … 519 520 asm volatile (".CATCH:"); 520 521 521 // Exception handler 522 // Note: Saving the exception context on the stack breaks termination exceptions. 523 catch_block( EXCEPT_TO_NODE( this_exception_context()->current_exception )->handler_index, 524 this_exception_context()->current_exception ); 522 return EXCEPT_TO_NODE( this_exception_context()->current_exception )->handler_index; 525 523 } 526 524 -
libcfa/src/exception.h
r81da3da4 r2554f24 43 43 extern struct __cfavir_type_info __cfatid_exception_t; 44 44 45 struct __cfaehm_base_exception_t * __cfaehm_get_current_exception(void); 45 46 46 47 void __cfaehm_cancel_stack(exception_t * except) __attribute__((noreturn)); … … 57 58 58 59 // Function catches termination exceptions. 59 void__cfaehm_try_terminate(60 int __cfaehm_try_terminate( 60 61 void (*try_block)(), 61 void (*catch_block)(int index, exception_t * except),62 62 int (*match_block)(exception_t * except)); 63 63
Note: See TracChangeset
for help on using the changeset viewer.