Ignore:
Timestamp:
Apr 27, 2020, 11:36:47 AM (20 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
c680a4b
Parents:
b25aafa
Message:

The requested addition of groups to debug printing. Tested in exception.c.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.c

    rb25aafa r851fd92  
    8383        struct exception_context_t * context = this_exception_context();
    8484
    85         __cfaabi_dbg_print_safe("Throwing resumption exception\n");
     85        __cfadbg_print_safe(exception, "Throwing resumption exception\n");
    8686
    8787        __attribute__((cleanup(reset_top_resume)))
     
    9696        }
    9797
    98         __cfaabi_dbg_print_safe("Unhandled exception\n");
     98        __cfadbg_print_safe(exception, "Unhandled exception\n");
    9999
    100100        // Fall back to termination:
     
    180180        struct exception_context_t * context = this_exception_context();
    181181
    182         __cfaabi_dbg_print_safe("Deleting Exception\n");
     182        __cfadbg_print_safe(exception, "Deleting Exception\n");
    183183
    184184        // Remove the exception from the list.
     
    218218                void * stop_param) {
    219219        // Verify actions follow the rules we expect.
    220         verify((actions & _UA_CLEANUP_PHASE) && actions & (_UA_FORCE_UNWIND));
     220        verify((actions & _UA_CLEANUP_PHASE) && (actions & _UA_FORCE_UNWIND));
    221221        verify(!(actions & (_UA_SEARCH_PHASE | _UA_HANDER_FRAME)));
    222222
     
    261261
    262262void __cfaehm_throw_terminate( exception_t * val ) {
    263         __cfaabi_dbg_print_safe("Throwing termination exception\n");
     263        __cfadbg_print_safe(exception, "Throwing termination exception\n");
    264264
    265265        __cfaehm_allocate_exception( val );
     
    268268
    269269void __cfaehm_rethrow_terminate(void) {
    270         __cfaabi_dbg_print_safe("Rethrowing termination exception\n");
     270        __cfadbg_print_safe(exception, "Rethrowing termination exception\n");
    271271
    272272        __cfaehm_begin_unwind();
     
    284284{
    285285
    286         //__cfaabi_dbg_print_safe("CFA: 0x%lx\n", _Unwind_GetCFA(context));
    287         __cfaabi_dbg_print_safe("Personality function (%d, %x, %llu, %p, %p):",
     286        //__cfadbg_print_safe(exception, "CFA: 0x%lx\n", _Unwind_GetCFA(context));
     287        __cfadbg_print_safe(exception, "Personality function (%d, %x, %llu, %p, %p):",
    288288                        version, actions, exception_class, unwind_exception, unwind_context);
    289289
     
    294294        if (actions & _UA_SEARCH_PHASE) {
    295295                verify(actions == _UA_SEARCH_PHASE);
    296                 __cfaabi_dbg_print_safe(" lookup phase");
     296                __cfadbg_print_safe(exception, " lookup phase");
    297297        // ... we are in clean-up phase.
    298298        } else {
    299299                verify(actions & _UA_CLEANUP_PHASE);
    300                 __cfaabi_dbg_print_safe(" cleanup phase");
     300                __cfadbg_print_safe(exception, " cleanup phase");
    301301                // We shouldn't be the handler frame during forced unwind.
    302302                if (actions & _UA_HANDLER_FRAME) {
    303303                        verify(!(actions & _UA_FORCE_UNWIND));
    304                         __cfaabi_dbg_print_safe(" (handler frame)");
     304                        __cfadbg_print_safe(exception, " (handler frame)");
    305305                } else if (actions & _UA_FORCE_UNWIND) {
    306                         __cfaabi_dbg_print_safe(" (force unwind)");
     306                        __cfadbg_print_safe(exception, " (force unwind)");
    307307                }
    308308        }
     
    345345                        void * ep = (void*)lsd_info.Start + callsite_start + callsite_len;
    346346                        void * ip = (void*)instruction_ptr;
    347                         __cfaabi_dbg_print_safe("\nfound %p - %p (%p, %p, %p), looking for %p\n",
     347                        __cfadbg_print_safe(exception, "\nfound %p - %p (%p, %p, %p), looking for %p\n",
    348348                                        bp, ep, ls, cs, cl, ip);
    349349#endif // __CFA_DEBUG_PRINT__
     
    360360                if ( 0 == callsite_landing_pad ) {
    361361                        // Nothing to do, move along
    362                         __cfaabi_dbg_print_safe(" no landing pad");
     362                        __cfadbg_print_safe(exception, " no landing pad");
    363363                } else if (actions & _UA_SEARCH_PHASE) {
    364364                        // In search phase, these means we found a potential handler we must check.
     
    398398                                // Based on the return value, check if we matched the exception
    399399                                if (ret == _URC_HANDLER_FOUND) {
    400                                         __cfaabi_dbg_print_safe(" handler found\n");
     400                                        __cfadbg_print_safe(exception, " handler found\n");
    401401                                } else {
    402                                         __cfaabi_dbg_print_safe(" no handler\n");
     402                                        __cfadbg_print_safe(exception, " no handler\n");
    403403                                }
    404404                                return ret;
     
    406406
    407407                        // This is only a cleanup handler, ignore it
    408                         __cfaabi_dbg_print_safe(" no action");
     408                        __cfadbg_print_safe(exception, " no action");
    409409                } else {
    410410                        // In clean-up phase, no destructors here but this could be the handler.
     
    428428                        _Unwind_SetIP( unwind_context, ((lsd_info.LPStart) + (callsite_landing_pad)) );
    429429
    430                         __cfaabi_dbg_print_safe(" action\n");
     430                        __cfadbg_print_safe(exception, " action\n");
    431431
    432432                        // Return have some action to run
     
    435435        }
    436436        // No handling found
    437         __cfaabi_dbg_print_safe(" table end reached\n");
     437        __cfadbg_print_safe(exception, " table end reached");
    438438
    439439        UNWIND:
    440         __cfaabi_dbg_print_safe(" unwind\n");
     440        __cfadbg_print_safe(exception, " unwind\n");
    441441
    442442        // Keep unwinding the stack
Note: See TracChangeset for help on using the changeset viewer.