Added _debugBreak() macro.

This commit is contained in:
Patrick 2023-11-01 16:41:03 +01:00
parent cff5879572
commit 522e6534bf

View File

@ -4,8 +4,10 @@
#if !defined(MIJIN_UTIL_OS_HPP_INCLUDED) #if !defined(MIJIN_UTIL_OS_HPP_INCLUDED)
#define MIJIN_UTIL_OS_HPP_INCLUDED 1 #define MIJIN_UTIL_OS_HPP_INCLUDED 1
#include <csignal>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include "../detect.hpp"
namespace mijin namespace mijin
{ {
@ -42,4 +44,16 @@ void setCurrentThreadName(const char* threadName) noexcept;
} // namespace mijin } // namespace mijin
#if MIJIN_TARGET_OS == MIJIN_OS_LINUX || MIJIN_TARGET_OS == MIJIN_OS_OSX
#if !defined(SIGTRAP)
static constexpr int SIGTRAP = 5;
#endif
#define _debugBreak() (void) std::raise(SIGTRAP)
#elif MIJIN_TARGET_OS == MIJIN_OS_WINDOWS
extern "C" __declspec(dllimport) void __stdcall DebugBreak();
#define _debugBreak() DebugBreak()
#else
#define _debugBreak() ((void)0)
#endif
#endif // !defined(MIJIN_UTIL_OS_HPP_INCLUDED) #endif // !defined(MIJIN_UTIL_OS_HPP_INCLUDED)