Commit f0845e61 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

core: add global variable to disable breakpoint

parent b96e1dca
......@@ -34,38 +34,50 @@
#define irt_assert(_expr) assert(_expr)
#endif
namespace irt {
static inline bool is_fatal_breakpoint = true;
}
#ifndef NDEBUG
#if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__) && \
__GNUC__ >= 2
#define irt_breakpoint() \
do { \
__asm__ __volatile__("int $03"); \
if (::irt::is_fatal_breakpoint) \
__asm__ __volatile__("int $03"); \
} while (0)
#elif (defined(_MSC_VER) || defined(__DMC__)) && defined(_M_IX86)
#define irt_breakpoint() \
do { \
__asm int 3h \
if (::irt::is_fatal_breakpoint) \
__asm int 3h \
} while (0)
#elif defined(_MSC_VER)
#define irt_breakpoint() \
do { \
__debugbreak(); \
if (::irt::is_fatal_breakpoint) \
__debugbreak(); \
} while (0)
#elif defined(__alpha__) && !defined(__osf__) && defined(__GNUC__) && \
__GNUC__ >= 2
#define irt_breakpoint() \
do { \
__asm__ __volatile__("bpt"); \
if (::irt::is_fatal_breakpoint) \
__asm__ __volatile__("bpt"); \
} while (0)
#elif defined(__APPLE__)
#define irt_breakpoint() \
do { \
__builtin_trap(); \
if (::irt::is_fatal_breakpoint) \
__builtin_trap(); \
} while (0)
#else /* !__i386__ && !__alpha__ */
#define irt_breakpoint() \
do { \
raise(SIGTRAP); \
if (::irt::is_fatal_breakpoint) \
raise(SIGTRAP); \
} while (0)
#endif /* __i386__ */
#else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment