#include "./debug.hpp" #include "./log.hpp" #include #include #include /////////////////////////////////////////////////////////////////////////////// void breakpoint (void) { #if defined (__x86_64) || defined (__i386) __asm__ ("int $3;"); #else raise (SIGINT); #endif } /////////////////////////////////////////////////////////////////////////////// void prepare_debugger (void) { ; } //----------------------------------------------------------------------------- void await_debugger (void) { if (ptrace (PTRACE_TRACEME)) LOG_CRITICAL ("unable to wait for debugger"); } /////////////////////////////////////////////////////////////////////////////// #include void enable_fpe (void) { feenableexcept (FE_DIVBYZERO | FE_INVALID); } //----------------------------------------------------------------------------- void disable_fpe (void) { feenableexcept (0); } /////////////////////////////////////////////////////////////////////////////// void force_console (void) { if (!isatty (fileno (stdout))) { LOG_ERROR ("expected debugging under a console"); } }