mirror of
https://github.com/intel/llvm.git
synced 2026-01-21 04:14:03 +08:00
[libunwind] [SEH] Clear DISPATCHER_CONTEXT when initializing a cursor
We only initialize a few fields in DISPATCHER_CONTEXT - don't leave the rest in an uninitialized state; make sure the whole struct is in a deterministic state. This makes nondeterministic failures deterministic, for some cases relating to forced unwinding on aarch64/arm (which requires filling in parsing of the xdata for finding the exception handler and LSDA). Differential Revision: https://reviews.llvm.org/D148660
This commit is contained in:
@@ -575,6 +575,7 @@ UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as)
|
||||
"UnwindCursor<> requires more alignment than unw_cursor_t");
|
||||
memset(&_info, 0, sizeof(_info));
|
||||
memset(&_histTable, 0, sizeof(_histTable));
|
||||
memset(&_dispContext, 0, sizeof(_dispContext));
|
||||
_dispContext.ContextRecord = &_msContext;
|
||||
_dispContext.HistoryTable = &_histTable;
|
||||
// Initialize MS context from ours.
|
||||
@@ -677,6 +678,7 @@ UnwindCursor<A, R>::UnwindCursor(CONTEXT *context, A &as)
|
||||
"UnwindCursor<> does not fit in unw_cursor_t");
|
||||
memset(&_info, 0, sizeof(_info));
|
||||
memset(&_histTable, 0, sizeof(_histTable));
|
||||
memset(&_dispContext, 0, sizeof(_dispContext));
|
||||
_dispContext.ContextRecord = &_msContext;
|
||||
_dispContext.HistoryTable = &_histTable;
|
||||
_msContext = *context;
|
||||
|
||||
Reference in New Issue
Block a user