mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
1682f0b760
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
40 lines
818 B
C++
40 lines
818 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/Format.h>
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/internals.h>
|
|
#include <syscall.h>
|
|
#include <unistd.h>
|
|
|
|
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();
|
|
}
|