On 19.04.2016 07:11, Alexandre Julliard wrote:
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.
This was one of my initial approaches, but first of all its very hacky, and moreover that alone is not sufficient. The 64-bit version of MSYS2 will try to reuse the existing stack at one point, and memset()s a specific amount of memory at the top for its internal use as thread local storage. Depending on the exact memory layout, this might corrupt pthread or wine internal structures like debug_info... ;)