From ced4f7351aa5aa9342c68876de3539f3c7225b3c Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 14 Feb 2013 15:03:33 +0000 Subject: [PATCH] base: break into the debugger on assertion failure if present. --- src/lol/base/assert.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lol/base/assert.h b/src/lol/base/assert.h index 3bc14bfa..7d84e63e 100644 --- a/src/lol/base/assert.h +++ b/src/lol/base/assert.h @@ -25,6 +25,15 @@ static inline void Abort() #endif } +/* FIXME: see http://stackoverflow.com/q/3596781/111461 for discussions + * on implementing __debugbreak() on POSIX systems. */ +static inline void DebugBreak() +{ +#if defined _WIN32 + __debugbreak(); +#endif +} + #define LOL_CALL(macro, args) macro args #define LOL_EVAL(a) a #define LOL_1ST(a, ...) a @@ -106,6 +115,7 @@ static inline void Abort() LOL_CALL(LOL_CAT(LOL_ERROR_, LOL_CALL(LOL_COUNT_TO_3, \ (__VA_ARGS__))), \ (__VA_ARGS__)); \ + DebugBreak(); \ Abort(); \ } #endif