Predator  [unstable] git snapshot
Macros | Variables
trap.h File Reference
#include <stdio.h>
#include <signal.h>

Go to the source code of this file.

Macros

#define _CL_BREAK   raise(SIGTRAP)
#define _CL_BREAK_MECH   "SIGTRAP"
#define CL_TRAP
 jump to debugger by default in case anything interesting happens
#define CL_BREAK_IF(cond)
 conditional variant of CL_TRAP, do nothing as long as cond is not satisfied

Variables

const char * GIT_SHA1
 defined in version.c to avoid rebuild of all modules on git-commit

Macro Definition Documentation

#define _CL_BREAK   raise(SIGTRAP)

Definition at line 32 of file trap.h.

#define _CL_BREAK_MECH   "SIGTRAP"

Definition at line 33 of file trap.h.

#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.

Referenced by SymPairSet< TKey, IREFLEXIVE >::add(), IntervalArena< TInt, TFld >::add(), SymPairMap< TKey, TVal >::add(), areValProtosEqual(), EntStore< TBaseEnt >::assignId(), BindingOff::BindingOff(), SymPairSet< TKey, IREFLEXIVE >::del(), IdMapper< TShapeIdx, INT_MIN, INT_MAX >::empty(), RefCounter::enter(), FldHandle::FldHandle(), EntStore< TBaseEnt >::getEntRO(), EntStore< TBaseEnt >::getEntRW(), headOffset(), IdMapper< TId, MIN, MAX >::insert(), IntervalArena< TInt, TFld >::intersects(), RefCounter::isShared(), nextPtrFromSeg(), CleanList< OpTemplate >::operator[](), prevPtrFromSeg(), IdMapper< TId, MIN, MAX >::query(), segHeadAt(), segIncreaseMinLength(), IdMapper< TShapeIdx, INT_MIN, INT_MAX >::size(), IntervalArena< TInt, TFld >::sub(), traverseLiveFields(), traverseProgramVarsGeneric(), traverseUniformBlocks(), and RefCounter::~RefCounter().

#define CL_TRAP
Value:
do { \
fprintf(stderr, "%s:%d: killing self by %s [SHA1 %s]\n", \
__FILE__, __LINE__, _CL_BREAK_MECH, GIT_SHA1); \
\
_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.

Variable Documentation

const char* GIT_SHA1

defined in version.c to avoid rebuild of all modules on git-commit