mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-12 10:37:00 +00:00
Import Strong Logger & Config System
This commit is contained in:
parent
92d4e7a8d3
commit
014b236228
48 changed files with 3281 additions and 734 deletions
54
core/Base/Assert.cpp
Normal file
54
core/Base/Assert.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// Copyright 2025 Xenon Emulator Project. All rights reserved.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Logging/Backend.h"
|
||||
#include "Assert.h"
|
||||
#include "Arch.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define Crash() __debugbreak()
|
||||
#else
|
||||
#if defined(ARCH_X86_64)
|
||||
#define Crash() __asm__ __volatile__("int $3")
|
||||
#elif defined(ARCH_X86)
|
||||
#define Crash() __asm__ __volatile__("int $3")
|
||||
#elif defined(ARCH_AARCH64)
|
||||
#define Crash() __asm__ __volatile__("brk 0")
|
||||
#elif defined(ARCH_PPC)
|
||||
#include <signal.h>
|
||||
#ifdef SIGTRAP
|
||||
#define Crash() raise(SIGTRAP)
|
||||
#else
|
||||
#define Crash() raise(SIGABRT)
|
||||
#endif
|
||||
#else
|
||||
#define Crash() __builtin_trap()
|
||||
#endif
|
||||
#endif // _MSVC_VER
|
||||
|
||||
void throw_fail_impl() {
|
||||
::fflush(stdout);
|
||||
Crash();
|
||||
}
|
||||
|
||||
void assert_fail_impl() {
|
||||
printf("Assertion Failed!\n");
|
||||
throw_fail_impl();
|
||||
}
|
||||
|
||||
[[noreturn]] void unreachable_impl() {
|
||||
::fflush(stdout);
|
||||
Crash();
|
||||
throw std::runtime_error("Unreachable code");
|
||||
}
|
||||
|
||||
void assert_fail_debug_msg(const std::string& msg) {
|
||||
printf("Assertion Failed! %s\n", msg.c_str());
|
||||
assert_fail_impl();
|
||||
}
|
||||
|
||||
void throw_fail_debug_msg(const std::string& msg) {
|
||||
printf("Assertion Failed! %s\n", msg.c_str());
|
||||
throw_fail_impl();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue