/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include #include #include extern "C" { extern bool __stdio_is_initialized; #ifdef DEBUG void __assertion_failed(const char* msg) { dbgln("USERSPACE({}) ASSERTION FAILED: {}", getpid(), msg); if (__stdio_is_initialized) warnln("ASSERTION FAILED: {}", msg); Syscall::SC_set_coredump_metadata_params params { { "assertion", strlen("assertion") }, { msg, strlen(msg) }, }; syscall(SC_set_coredump_metadata, ¶ms); abort(); } #endif } void _abort() { asm volatile("ud2"); __builtin_unreachable(); }