commit 225c779fa15a2e8fae89d0c28dcc853be5bd4df5 parent 7a60737dd07c8dba5288270f4dacea05f1e44ae4 Author: Michael Savage <mikejsavage@gmail.com> Date: Fri Mar 25 20:29:33 +0000 Print errno when assertions fail Diffstat:
intrinsics.h | | | 4 | ++++ |
diff --git a/intrinsics.h b/intrinsics.h @@ -4,6 +4,8 @@ #include <stdio.h> #include <stdlib.h> #include <stdint.h> +#include <string.h> +#include <errno.h> typedef int8_t s8; typedef int16_t s16; @@ -65,6 +67,8 @@ T abs( T x ) { inline void mike_assert( const bool predicate, const char * const message ) { if( !( predicate ) ) { puts( message ); + int err = errno; + printf( "errno(%d): %s\n", err, strerror( err ) ); print_backtrace(); __builtin_trap(); }