Conditionally calltrace in abort(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2013-01-06 16:52:00 +01:00
parent f6371bfcec
commit 6b790a3184
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,9 @@
*******************************************************************************/
#include <sys/stat.h>
#include <calltrace.h>
#include <stdlib.h>
#if defined(SORTIX_KERNEL)
@ -38,6 +41,11 @@ extern "C" void abort(void)
extern "C" void abort(void)
{
struct stat st;
if ( getenv("LIBC_DEBUG_CALLTRACE") || stat("/etc/calltrace", &st) == 0 )
calltrace();
if ( getenv("LIBC_DEBUG_LOOP") || stat("/etc/calltrace_loop", &st) == 0 )
while ( true );
// TODO: Send SIGABRT instead!
_Exit(128 + 6);
}