Ignore:
Timestamp:
Jun 2, 2017, 1:10:26 PM (5 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
93684eb
Parents:
acd738aa
Message:

The try exception handler function is now generic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/working/exception/impl/except.c

    racd738aa r6b72040  
    44
    55#include "lsda.h"
     6
     7// This macro should be the only thing that needs to change across machines.
     8// struct _Unwind_Context * -> _Unwind_Reason_Code(*)()
     9#define MATCHER_FROM_CONTEXT(ptr_to_context) \
     10        (*(_Unwind_Reason_Code(**)())(_Unwind_GetCFA(ptr_to_context) + 8))
     11
    612
    713//Global which defines the current exception
     
    1723                     struct _Unwind_Exception* unwind_exception, struct _Unwind_Context* context)
    1824{
     25        printf("CFA: 0x%lx\n", _Unwind_GetCFA(context));
     26
    1927        //DEBUG
    2028        printf("Personality function (%d, %x, %llu, %p, %p):", version, actions, exceptionClass, unwind_exception, context);
     
    111119
    112120                                        //Get a function pointer from the relative offset and call it
    113                                         _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher;                                     
     121                                        // _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher;                                   
     122
     123                                        _Unwind_Reason_Code (*matcher)() =
     124                                                MATCHER_FROM_CONTEXT(context);
    114125                                        _Unwind_Reason_Code ret = matcher();
    115126
Note: See TracChangeset for help on using the changeset viewer.