philsquared/Catch — Issue #73: Mingw32 can't start debugger (default is gdb) with -b
Author: colonelsammy
Created: 2012-02-22 16:48:58+00:00
State: open

This patch works for me on Mingw32 (havn't tried Mingw64 yet...)

diff --git a/include/internal/catch_debugger.hpp b/include/internal/catch_debugger.hpp
index 9986ecf..31d93a9 100644
--- a/include/internal/catch_debugger.hpp
+++ b/include/internal/catch_debugger.hpp
@@ -93,6 +93,14 @@
{
return IsDebuggerPresent() != 0;
}
+#elif defined(__MINGW32__)
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+ extern "C" __declspec(dllimport) void __stdcall DebugBreak();
+ #define BreakIntoDebugger() if (IsDebuggerPresent() ) { DebugBreak(); }
+ inline bool isDebuggerActive()
+ {
+ return IsDebuggerPresent() != 0;
+ }
#else
inline void BreakIntoDebugger(){}
inline bool isDebuggerActive() { return false; }