This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] [SEH] Sync LSDA and handler between unw_proc_info_t and DISPATCHER_CONTEXT
ClosedPublic

Authored by mstorsjo on Apr 5 2023, 10:00 AM.

Details

Summary

For normal C++ unwinding, we get _dispContext initialized by the
prepopulated DISPATCHER_CONTEXT in _GCC_specific_handler, which
we set with __unw_seh_set_disp_ctx.

When doing force unwinding, we step and populate the unw_proc_info_t
struct _info with getInfoFromSEH, but when we execute the handler
via the __libunwind_seh_personality wrapper function, we execute
the handler set in DISPATCHER_CONTEXT.

Whenever updating these fields in either _info or _dispContext,
sync them to the other one too.

This fixes one aspect of the libcxxabi force_unwind*.pass.cpp tests on
x86_64.

Diff Detail

Event Timeline

mstorsjo created this revision.Apr 5 2023, 10:00 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 5 2023, 10:00 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a subscriber: pengfei. · View Herald Transcript
mstorsjo requested review of this revision.Apr 5 2023, 10:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 10:00 AM
cdavis5x accepted this revision.Apr 6 2023, 1:36 PM

How did I not catch this?? I could've sworn the tests all passed when I originally put this in...

How did I not catch this?? I could've sworn the tests all passed when I originally put this in...

FWIW, libunwind's tests don't really exercise the forced unwinding much, but libcxxabi has got much more tests for that.

phosek accepted this revision.Apr 8 2023, 2:48 PM
phosek added a subscriber: phosek.

LGTM

This revision is now accepted and ready to land.Apr 8 2023, 2:48 PM
This revision was landed with ongoing or failed builds.Apr 10 2023, 2:03 PM
This revision was automatically updated to reflect the committed changes.