+static void
+_setcrashlogmessage(const char *fmt, ...) __attribute__((__format__(__printf__,1,2)))
+{
+ char *mess = NULL;
+ int res;
+ va_list ap;
+
+ va_start(ap, fmt);
+ res = vasprintf(&mess, fmt, ap);
+ va_end(ap);
+ if (res < 0)
+ mess = (char *)fmt; /* the format string is better than nothing */
+ CRSetCrashLogMessage(mess);
+}
+
+#define setcrashlogmessage(fmt, ...) _setcrashlogmessage("%s: %u: " fmt, __func__, __LINE__, ##__VA_ARGS__)
+
+#endif /* !TARGET_OS_IPHONE */
+