PROTECTED _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exception_object) { struct _Unwind_Context context; unw_context_t uc; if (exception_object->private_1) { int ret; /* ANDROID support update. */ int destroy_map = 1; unw_map_local_create (); if (_Unwind_InitContext (&context, &uc) < 0) ret = _URC_FATAL_PHASE2_ERROR; else ret = _Unwind_Phase2 (exception_object, &context, &destroy_map); if (destroy_map) unw_map_local_destroy (); return ret; /* End ANDROID support. */ } else return _Unwind_RaiseException (exception_object); }
PROTECTED void _Unwind_Resume (struct _Unwind_Exception *exception_object) { struct _Unwind_Context context; unw_context_t uc; if (_Unwind_InitContext (&context, &uc) < 0) abort (); Debug (1, "(exception_object=%p private_2=%lx)\n", exception_object, exception_object->private_2); _Unwind_Phase2 (exception_object, &context); abort (); }
PROTECTED void _Unwind_Resume (struct _Unwind_Exception *exception_object) { struct _Unwind_Context context; unw_context_t uc; /* ANDROID support update. */ int destroy_map = 1; unw_map_local_create (); if (_Unwind_InitContext (&context, &uc) < 0) { unw_map_local_destroy (); abort (); } _Unwind_Phase2 (exception_object, &context, &destroy_map); if (destroy_map) unw_map_local_destroy (); /* End ANDROID support. */ abort (); }
PROTECTED _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *exception_object) { uint64_t exception_class = exception_object->exception_class; _Unwind_Personality_Fn personality; struct _Unwind_Context context; _Unwind_Reason_Code reason; unw_proc_info_t pi; unw_context_t uc; unw_word_t ip; int ret; if (_Unwind_InitContext (&context, &uc) < 0) return _URC_FATAL_PHASE1_ERROR; Debug (1, "(exception_object=%p)\n", exception_object); /* Phase 1 (search phase) */ while (1) { if ((ret = unw_step (&context.cursor)) <= 0) { if (ret == 0) { Debug (1, "no handler found\n"); return _URC_END_OF_STACK; } else return _URC_FATAL_PHASE1_ERROR; } if (unw_get_proc_info (&context.cursor, &pi) < 0) return _URC_FATAL_PHASE1_ERROR; personality = (_Unwind_Personality_Fn) (uintptr_t) pi.handler; if (personality) { reason = (*personality) (_U_VERSION, _UA_SEARCH_PHASE, exception_class, exception_object, &context); if (reason != _URC_CONTINUE_UNWIND) { if (reason == _URC_HANDLER_FOUND) break; else { Debug (1, "personality returned %d\n", reason); return _URC_FATAL_PHASE1_ERROR; } } } } /* Exceptions are associated with IP-ranges. If a given exception is handled at a particular IP, it will _always_ be handled at that IP. If this weren't true, we'd have to track the tuple (IP,SP,BSP) to uniquely identify the stack frame that's handling the exception. */ if (unw_get_reg (&context.cursor, UNW_REG_IP, &ip) < 0) return _URC_FATAL_PHASE1_ERROR; exception_object->private_1 = 0; /* clear "stop" pointer */ exception_object->private_2 = ip; /* save frame marker */ Debug (1, "found handler for IP=%lx; entering cleanup phase\n", (long) ip); /* Reset the cursor to the first frame: */ if (unw_init_local (&context.cursor, &uc) < 0) return _URC_FATAL_PHASE1_ERROR; return _Unwind_Phase2 (exception_object, &context); }