1 /* CC0 (Public domain) - see LICENSE file for details */ 2 #ifndef CCAN_BREAKPOINT_H 3 #define CCAN_BREAKPOINT_H 4 #include <ccan/compiler/compiler.h> 5 #include <sys/types.h> 6 #include <unistd.h> 7 #include <signal.h> 8 #include <stdbool.h> 9 10 void breakpoint_init(void) COLD; 11 extern bool breakpoint_initialized; 12 extern bool breakpoint_under_debug; 13 14 /** 15 * breakpoint - stop if running under the debugger. 16 */ breakpoint(void)17static inline void breakpoint(void) 18 { 19 if (!breakpoint_initialized) 20 breakpoint_init(); 21 if (breakpoint_under_debug) 22 kill(getpid(), SIGTRAP); 23 } 24 #endif /* CCAN_BREAKPOINT_H */ 25