You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
574 B
24 lines
574 B
/* CC0 (Public domain) - see LICENSE file for details */
|
|
#ifndef CCAN_BREAKPOINT_H
|
|
#define CCAN_BREAKPOINT_H
|
|
#include <ccan/compiler/compiler.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
#include <signal.h>
|
|
#include <stdbool.h>
|
|
|
|
void breakpoint_init(void) COLD;
|
|
extern bool breakpoint_initialized;
|
|
extern bool breakpoint_under_debug;
|
|
|
|
/**
|
|
* breakpoint - stop if running under the debugger.
|
|
*/
|
|
static inline void breakpoint(void)
|
|
{
|
|
if (!breakpoint_initialized)
|
|
breakpoint_init();
|
|
if (breakpoint_under_debug)
|
|
kill(getpid(), SIGTRAP);
|
|
}
|
|
#endif /* CCAN_BREAKPOINT_H */
|
|
|