How to trap crash or exit in Windows?
- Date: Fri, 14 Apr 2017 17:44:56 -0500
- From: Daniel Santos <daniel.santos@xxxxxxxxx>
- Subject: How to trap crash or exit in Windows?
I'm hacking expect to try to solve its "broken pipe" problem, but I haven't done any serious windows programming/debugging in over 10 years. I want to be able to set some type of "trap" after a fork (on the child) and then disable it before it calls execvp to catch any crashes or normal program exit in between those two points, how can I do this on Windows / Cygwin? Does sigaction work in Cygwin with SIGILL, SIGSEGV, et. al.? I haven't had an atexit function get called yet, so I'm hoping that means that I'm never getting a normal exit prior to calling exec (I should verify that). Also, is there a way I can use strace with Cygwin to narrow what spams? This acts like a race condition and sometimes I have to run for 5 or 10 minutes before it fails, so emitting more spam will likely lower the likelihood of failure.
One very interesting aspect of this is that if I run two separate make -kj1 check jobs (gcc's testsuite) then I can still get the failure, but never when just running a single make -kj1 job. Thus, one suspect is DLL base address, even though I have rebased the build tree. Is there a nifty way of catching or debugging fork/DLL base address conflicts? iiuc, the whole rebasing thing is so that every DLL has a unique (non-overlapping) base address so that when we fork, the DLLs are always loaded at the same address.
Using debug log spew, I traced the child "going away" to after calling an ioctl to set the terminal window size.
Thanks in advance! Daniel -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple