#include "namespace.h"
#include <signal.h>
+#include <stdarg.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
extern void (*__cleanup)();
extern void __abort(void) __dead2;
+extern const char *__crashreporter_info__;
#define TIMEOUT 10000 /* 10 milliseconds */
{
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.
{
struct sigaction act;
+ if (!__crashreporter_info__)
+ __crashreporter_info__ = "__abort() called";
act.sa_handler = SIG_DFL;
act.sa_flags = 0;
sigfillset(&act.sa_mask);
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();
+}