Just-in-time Debugging
MSYS2 processes
To get just-in-time debugging of MSYS2 processes, use theerror_startMSYS environment variable setting:
exportMSYS="error_start:$(cygpath-w/usr/bin/gdb)"./crashy.exeNative Windows processes
MINGW gdb can be used as aWindows JIT debugger.This is documentedhere undersignal-event.
As Administrator:
regtooladd-w'/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug'regtoolset-w'/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug/Debugger'\"$(cygpath-w/mingw64/bin/gdb.exe)'" -ex "attach %ld" -ex "signal-event %ld" -ex "continue"'regtoolset-w'/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug/Auto'1regtooladd-W'/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug'regtoolset-W'/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug/Debugger'\"$(cygpath-w/mingw32/bin/gdb.exe)'" -ex "attach %ld" -ex "signal-event %ld" -ex "continue"'regtoolset-W'/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug/Auto'1Native Windows processes started from MSYS2
When a native process which was started (possibly indirectly) from an MSYS2 process (such asbash) crashes, it does not invokethe registered debugger (or Windows Error Reporting), unless theSetErrorModeSEM_NOGPFAULTERRORBOX flag was cleared in the meantime(SetErrorMode flags are inherited from a parent process by default). As ofmsys2-runtime3.2.0-2, it is possible to tell MSYS2 tocreate processes without inheriting its error mode flags by setting anMSYS environment variable setting:
exportMSYS=winjitdebugexecbash./crashy.exebash needs to be restarted, assuming you are starting processes frombash).