Detailed information on abort using macro and new __abort function

This commit is contained in:
Jeremy Soller
2023-03-09 20:19:27 -07:00
parent 04d2f296a9
commit 47bd55451f
5 changed files with 35 additions and 11 deletions
+4 -6
View File
@@ -5,7 +5,6 @@ use crate::{
header::{stdio, stdlib},
platform::types::*,
};
use core::fmt::Write;
#[no_mangle]
pub unsafe extern "C" fn __assert_fail(
@@ -18,14 +17,13 @@ pub unsafe extern "C" fn __assert_fail(
let file = CStr::from_ptr(file).to_str().unwrap();
let cond = CStr::from_ptr(cond).to_str().unwrap();
writeln!(
*stdio::stderr,
eprintln!(
"{}: {}:{}: Assertion `{}` failed.",
func,
file,
line,
cond
)
.unwrap();
stdlib::abort();
);
core::intrinsics::abort();
}