http://bugs.winehq.org/show_bug.cgi?id=27929
--- Comment #6 from camillo.lugaresi+wine@gmail.com 2011-07-28 23:04:07 CDT --- (In reply to comment #5)
(In reply to comment #4)
signal_init_process is called, and the disassembly looks right: it seems to be calling sigaction with the the correct pointer to segv_handler. However, segv_handler is not called when the signal is received. I'll keep investigating.
Actually, the signal handler is probably getting called, but gdb on OS X messes us the translation between mach exceptions (EXC_BAD_ACCESS in this case) and UNIX signals (SIGBUS), so it cannot be used to step into signal handlers.
Ok, the solution to this problem is to give gdb the obscure command "set dont-handle-bad-access 1" before running the program. This stops gdb from intercepting the Mach exception, allowing the normal translation into a UNIX signal to work, and then the signal handler is called.
This does not solve the crash, but at least should make it much easier to debug. After doing this and setting a breakpoint at the beginning of segv_handler, I was able to step through its assembly. It seems to be working correctly. Indeed, I can just give the "continue" command a few times, to go through the page faults, and eventually the program runs correctly!
In fact, I can set "handle SIGBUS nostop", delete the breakpoint, and the program runs correctly in gdb. Strange.