X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/5f4d86c1219d56604890d932a3152b3b5dd15b55..34e8f8296870d0e8695f90e1a54240a589d41312:/stdlib/abort-fbsd.c diff --git a/stdlib/abort-fbsd.c b/stdlib/abort-fbsd.c index ab7b12f..c2a98ec 100644 --- a/stdlib/abort-fbsd.c +++ b/stdlib/abort-fbsd.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/abort.c,v 1.9 2003/08/16 11:43:57 davidx #include "namespace.h" #include +#include #include #include #include @@ -47,6 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/abort.c,v 1.9 2003/08/16 11:43:57 davidx extern void (*__cleanup)(); extern void __abort(void) __dead2; +extern const char *__crashreporter_info__; #define TIMEOUT 10000 /* 10 milliseconds */ @@ -55,6 +57,8 @@ abort() { struct sigaction act; + if (!__crashreporter_info__) + __crashreporter_info__ = "abort() called"; /* * POSIX requires we flush stdio buffers on abort. * XXX ISO C requires that abort() be async-signal-safe. @@ -84,6 +88,8 @@ __abort() { struct sigaction act; + if (!__crashreporter_info__) + __crashreporter_info__ = "__abort() called"; act.sa_handler = SIG_DFL; act.sa_flags = 0; sigfillset(&act.sa_mask); @@ -94,3 +100,16 @@ __abort() usleep(TIMEOUT); /* give time for signal to happen */ __builtin_trap(); /* never exit normally */ } + +__private_extern__ void +abort_report_np(const char *fmt, ...) +{ + char *str; + va_list ap; + + va_start(ap, fmt); + vasprintf(&str, fmt, ap); + va_end(ap); + __crashreporter_info__ = str ? str : fmt; + abort(); +}