Libunwind: patched phase1 end of stack detection.

This commit is contained in:
pca006132 2020-06-30 17:13:24 +08:00
parent f82ffe8cf2
commit d915211264
1 changed files with 6 additions and 0 deletions

View File

@ -446,6 +446,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
// from scratch thus achieving the same effect. // from scratch thus achieving the same effect.
__unw_init_local(cursor, uc); __unw_init_local(cursor, uc);
uintptr_t prev_sp = 0;
// Walk each frame looking for a place to stop. // Walk each frame looking for a place to stop.
for (bool handlerNotFound = true; handlerNotFound;) { for (bool handlerNotFound = true; handlerNotFound;) {
@ -458,6 +459,11 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
uintptr_t cur_sp = _Unwind_GetGR((_Unwind_Context*)cursor, 13);
if (cur_sp == prev_sp) {
return _URC_END_OF_STACK;
}
prev_sp = cur_sp;
// When tracing, print state information. // When tracing, print state information.
if (_LIBUNWIND_TRACING_UNWINDING) { if (_LIBUNWIND_TRACING_UNWINDING) {