Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66632e8

Browse files
committed
[libunwind] [SEH] Handle ExceptionContinueExecution in forced unwinding
This fixes the libcxxabi test force_unwind3.pass.cpp when run on native Windows. When unwinding past the main thread function into the system functions that brought up the thread, we can hit functions whose personality functions return ExceptionContinueExecution (instead of the regular ExceptionContinueSearch). Interpret this as a signal to stop the unwind. Curiously, in this case, it does return ExceptionContinueSearch if running within a debugger. Differential Revision: https://reviews.llvm.org/D147739
1 parent 87ca040 commit 66632e8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

libunwind/src/Unwind-seh.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ __libunwind_seh_personality(int version, _Unwind_Action state,
217217
disp_ctx->ContextRecord,
218218
disp_ctx);
219219
switch (ms_act) {
220+
case ExceptionContinueExecution: return _URC_END_OF_STACK;
220221
case ExceptionContinueSearch: return _URC_CONTINUE_UNWIND;
221222
case 4 /*ExceptionExecuteHandler*/:
222223
return phase2 ? _URC_INSTALL_CONTEXT : _URC_HANDLER_FOUND;
@@ -304,6 +305,12 @@ unwind_phase2_forced(unw_context_t *uc,
304305
// We may get control back if landing pad calls _Unwind_Resume().
305306
__unw_resume(&cursor2);
306307
break;
308+
case _URC_END_OF_STACK:
309+
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
310+
"personality returned "
311+
"_URC_END_OF_STACK",
312+
(void *)exception_object);
313+
break;
307314
default:
308315
// Personality routine returned an unknown result code.
309316
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
@@ -312,6 +319,8 @@ unwind_phase2_forced(unw_context_t *uc,
312319
(void *)exception_object, personalityResult);
313320
return _URC_FATAL_PHASE2_ERROR;
314321
}
322+
if (personalityResult == _URC_END_OF_STACK)
323+
break;
315324
}
316325
}
317326

0 commit comments

Comments
 (0)