summaryrefslogtreecommitdiffhomepage
path: root/main/debug-break.cpp
blob: 218dbe411e337e19e47c34c1e3333b7fbf8428a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "floormat/main.hpp"
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/ptrace.h>
#include <signal.h>
#endif

void floormat::floormat_main::debug_break()
{
#ifdef _WIN32
    if (IsDebuggerPresent()) [[unlikely]]
        DebugBreak();
#else
    if (ptrace(PTRACE_TRACEME, 0, 1, 0) == -1)
        ::raise(SIGUSR1);
#endif
}