Reputation: 21
We have a system that's a mix of Cygwin and non-Cygwin programs, all of which run under a Cygwin bash session.
One of the non-Cygwin executables is periodically crashing, and I'm trying to enable post-mortem debugging using windbg as outlined here.
I wrote a test program that deliberately crashes. After following the steps in the above page, windbg opens up automatically when the test program crashes -exactly what I'm looking for. However, if I run the test program from Cygwin's bash, bash prints a "Segmentation fault" error message and windbg does not open.
Is there a way to get windbg to open up upon a non-Cygwin program, that was launched from a Cygwin bash shell, crashing?
P.S.: All of our non-Cygwin programs are C programs compiled with MS Visual Studio.
Upvotes: 2
Views: 117
Reputation: 2373
Cygwin may be installing an unhandled exception filter which allows it to handle the crash and thus print "Segmentation fault". This prevents the just-in-time debugger from launching since the exception was indeed handled by Cygwin. I don't know if you can disable that. To get a memory dump you could use procdump to create memory dumps for all first chance exceptions. The final first chance exception memory dump would most likely correspond to the one that caused Cygwin to display "Segmentation fault".
Run your program, then from a Windows command prompt run:
procdump -e1 <PID|Process Name>
If your program crashes before you have a chance to run procdump, try running procdump first with the -w
option so that it will wait for your program to start. Then run your program.
Make sure to specify the '1' with the 'e', otherwise you won't get first chance exceptions.
You can get procdump from Microsoft at: https://technet.microsoft.com/en-us/sysinternals/dd996900.aspx
Upvotes: 0