- Timestamp:
- Dec 18, 2023, 12:24:06 PM (15 months ago)
- Branches:
- master
- Children:
- 9fba8e6
- Parents:
- 5546eee4
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified libcfa/src/exception.c ¶
r5546eee4 rb7898ac 55 55 } 56 56 57 struct __cfaehm_base_exception_t * __cfaehm_get_current_termination(void) { 58 return this_exception_context()->current_exception; 59 } 60 57 61 58 62 // RESUMPTION ================================================================ … … 309 313 struct _Unwind_Context * unwind_context) 310 314 { 311 //! __cfadbg_print_safe(exception, "CFA: 0x%lx\n",_Unwind_GetCFA(unwind_context));315 __cfadbg_print_safe(exception, "CFA: 0x%p\n", (void*)_Unwind_GetCFA(unwind_context)); 312 316 __cfadbg_print_safe(exception, "Personality function (%d, %x, %llu, %p, %p):", 313 317 version, actions, exception_class, unwind_exception, unwind_context); … … 411 415 _Unwind_Word match_pos = 412 416 # if defined( __x86_64 ) 413 _Unwind_GetCFA(unwind_context) + 8;417 _Unwind_GetCFA(unwind_context); 414 418 # elif defined( __i386 ) 415 _Unwind_GetCFA(unwind_context) + 24;419 _Unwind_GetCFA(unwind_context) + 20; 416 420 # elif defined( __ARM_ARCH ) 417 _Unwind_GetCFA(unwind_context) + 40;421 _Unwind_GetCFA(unwind_context) + 16; 418 422 # endif 423 //! printf("match_pos: %p\n", (void*)match_pos); 424 //! fflush(stdout); 419 425 int (*matcher)(exception_t *) = *(int(**)(exception_t *))match_pos; 420 426 … … 479 485 // and simply linked from libcfa but there is one problem left, see the exception table for details 480 486 __attribute__((noinline)) 481 void __cfaehm_try_terminate(void (*try_block)(), 482 void (*catch_block)(int index, exception_t * except), 487 int __cfaehm_try_terminate(void (*try_block)(), 483 488 __attribute__((unused)) int (*match_block)(exception_t * except)) { 484 489 //! volatile int xy = 0; 485 //! printf("%p %p %p %p\n", &try_block, &catch_block, &match_block, &xy); 490 //! printf("%p %p %p\n", &try_block, &match_block, &xy); 491 //! fflush(stdout); 486 492 487 493 // Setup the personality routine and exception table. … … 507 513 508 514 // Normal return for when there is no throw. 509 return ;515 return 0; 510 516 511 517 // Exceptionnal path … … 518 524 asm volatile (".CATCH:"); 519 525 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 ); 526 return EXCEPT_TO_NODE( this_exception_context()->current_exception )->handler_index; 524 527 } 525 528 -
TabularUnified libcfa/src/exception.h ¶
r5546eee4 rb7898ac 44 44 45 45 46 struct __cfaehm_base_exception_t * __cfaehm_get_current_termination(void); 47 48 46 49 void __cfaehm_cancel_stack(exception_t * except) __attribute__((noreturn)); 47 50 … … 57 60 58 61 // Function catches termination exceptions. 59 void__cfaehm_try_terminate(62 int __cfaehm_try_terminate( 60 63 void (*try_block)(), 61 void (*catch_block)(int index, exception_t * except),62 64 int (*match_block)(exception_t * except)); 63 65
Note: See TracChangeset
for help on using the changeset viewer.