mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 11:12:45 +00:00 
			
		
		
		
	 0bfb7f9675
			
		
	
	
		0bfb7f9675
		
	
	
	
	
		
			
			It should be now the only user of it, and it is more logical to have it in `stdlib.h` than in `assert.h`
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			748 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			748 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;
 | |
| 
 | |
| void __assertion_failed(const char* msg)
 | |
| {
 | |
|     if (__heap_is_stable) {
 | |
|         dbgln("ASSERTION FAILED: {}", 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();
 | |
| }
 | |
| }
 |