2023-02-25 22:58:28 +08:00
|
|
|
#include "VTUtils.hpp"
|
|
|
|
|
2023-09-24 20:56:23 +08:00
|
|
|
#if defined(LIBCMO_OS_WIN32)
|
|
|
|
#include <intrin.h>
|
|
|
|
// disable annoy macro at the same time
|
|
|
|
#undef GetObject
|
|
|
|
#undef GetClassName
|
|
|
|
#undef LoadImage
|
|
|
|
#undef GetTempPath
|
|
|
|
#else
|
|
|
|
#include <signal.h>
|
|
|
|
#endif
|
|
|
|
|
2023-02-25 22:58:28 +08:00
|
|
|
namespace LibCmo {
|
2023-08-23 16:04:58 +08:00
|
|
|
|
2023-08-25 21:57:22 +08:00
|
|
|
void LibPanic(int line, const char* file, const char* errmsg) {
|
|
|
|
fprintf(stderr, "LIBCMO PANIC:%s (%s:L%d)\n",
|
|
|
|
errmsg ? errmsg : "", file, line);
|
|
|
|
std::abort();
|
|
|
|
}
|
|
|
|
|
2023-09-24 20:56:23 +08:00
|
|
|
void LibOrderDebugger() {
|
|
|
|
#if defined(LIBCMO_BUILD_DEBUG)
|
|
|
|
|
|
|
|
#if defined(LIBCMO_OS_WIN32)
|
|
|
|
// win32 debug break
|
|
|
|
__debugbreak();
|
|
|
|
#else
|
|
|
|
// generic debug break
|
|
|
|
raise(SIGTRAP);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-02-25 22:58:28 +08:00
|
|
|
}
|