Sebastian Lackner sebastian@fds-team.de writes:
Some versions of pthread indeed put internal structures at the top of the stack. To solve that, the current Staging patchset allocates threads with a dummy pthread, and then switches to the real stack, see: https://github.com/wine-compholio/wine-staging/blob/master/patches/ntdll-Thr... Unless there is something weird going on, thanks to the CFI annotations in wine_switch_to_stack() pthread should be able to unwind the stack correctly despite the stack switch inbetween. At least I have not found any problems so far ;)
For this specific stack switch, sure, but it can't unwind across Win32 code, which was the reason for the exit frame in the first place.
You are right that ignoring exit_frame might (under specific circumstances) run language handlers, but I'm not yet aware of a better way to deal with this. The only alternative would be to calculate it based on StackBase, but its also far from perfect.
I'd suggest to instead try to keep the initial stack around.