summaryrefslogtreecommitdiffhomepage
path: root/main/debug-break.cpp
blob: 72756f37ab345ee6ba310c56a1fa0b950208f97b (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();
#elif !defined __APPLE__
    if (ptrace(PTRACE_TRACEME, 0, 1, 0) == -1)
        ::raise(SIGUSR1);
#endif
}