#include <stdio.h>
#include <signal.h>
Go to the source code of this file.
|
const char * | GIT_SHA1 |
| defined in version.c to avoid rebuild of all modules on git-commit More...
|
|
#define _CL_BREAK raise(SIGTRAP) |
#define _CL_BREAK_MECH "SIGTRAP" |
#define CL_BREAK_IF |
( |
|
cond) | |
|
Value:do { \
if (!(cond)) \
break; \
\
fprintf(stderr, "%s:%d: conditional breakpoint fired: " \
"CL_BREAK_IF(%s)\n", __FILE__, __LINE__, #cond); \
\
CL_TRAP; \
} while (0)
conditional variant of CL_TRAP, do nothing as long as cond is not satisfied
- Attention
- the macro suffer from the same flaw as std::assert - the given expression is not evaluated at all unless you're running a debug build
- Note
- the macro has exactly opposite semantic than std::assert
-
for comfortable source code browsing, it's recommended to tweak your editor, in order to highlight CL_BREAK_IF as as keyword, as well as CL_TRAP
Definition at line 58 of file trap.h.
Value:do { \
fprintf(stderr, "%s:%d: killing self by %s [SHA1 %s]\n", \
\
_CL_BREAK; \
} while (0)
jump to debugger by default in case anything interesting happens
- Note
- this behavior may be subject for change in the future
-
for comfortable source code browsing, it's recommended to tweak your editor, in order to highlight CL_TRAP as as keyword, as well as CL_BREAK_IF
Definition at line 42 of file trap.h.
defined in version.c to avoid rebuild of all modules on git-commit