In the cygwin environment the linux command 'strace' is available. strace outputs all the OS <--> application interactions (in this case, application <--> cygwin <--> OS), and the specific system call or other operation that it is freezing on should be apparent.
To use strace you simply prepend the strace command before the command that launches the application you want to debug. For example if you are launching mysql from the cygwin terminal using the command mysql
, call it instead as strace mysql
.
If the output from running strace on the freezing programs isn't apparent, please post the output to pastebin or equivalent (don't try to add to your answer, it will be a huge amount of text).
The next step would be to run it with a debugger such as gdb, but in a case like this strace is usually sufficient.
Update
Apparently there is was a bug introduced in the cygwin port of strace in the last couple months; per a google search of 'cygwin strace seg fault'; I wasn't aware of that.
Since strace is the best tool for this job, try updating your cygwin installation to see if a fix was intentionally or inadvertently introduced. To update your cygwin installation, you use the following command sequence:
wget -NP /usr/local/bin/ http://cygwin.com/setup-x86_64.exe
chmod u+x /usr/local/bin/setup-x86_64.exe
/usr/local/bin/setup-x86_64.exe -n
Source
After updating, try again. If it still segfaults, things get a little messier as gdb is far less easy to use, and there are no real equivalents to strace available in the cygwin environment that I am currently aware of.
There is always the chance that the update will address your launching issues, and strace becomes a moot point (not a very big chance...)
Update 2
If the cygwin strace command segfaults after update, I think your best bet is to use a native windows user space debugger such as logger.exe. Installation information can be found here.
logger.exe is used in a similar way to strace, the problem being that you will now have cygwins translations of the programs system calls exposed, not the actual system calls. In other words, it will only be looking at the OS to cygwin interactions, and the specifics of the offending program may be obfuscated. However a hang or freeze can almost always be attributed to either a resource limitation or a unresponsive system call, and this method will expose that.
Since I'm offering this as an alternative to something (strace) that might still work after the update, I'm not going to go into great detail into the specific usage of it. Basically what you will do (post installation), is call cygwin from a windows command prompt prepended by the logger.exe program, just as I described strace. An interactive cygwin terminal will then open and you need to launch the program you are evaluating from that. An enormous amount of text (should) be output by the logger application describing what cygwin, and it's child process "your program", are doing. When a hang occurs, the specific system call or resource being waited on should be apparent. Again, if its not, post the full text of the logger output.
1I've had a similar issue where mintty hung on exit, but only when launched via shortcut (as opposed to launching from
chere
). The root cause was that mintty needed to be launched as an administrator. Updating my shortcuts to include the "Run as administrator" option fixed it for me. – Mr. Llama – 2018-04-23T16:44:31.947