Loading...
--- libmalloc/libmalloc-374.40.6/src/printf.h
+++ libmalloc/libmalloc-792.41.1/src/printf.h
@@ -21,10 +21,21 @@
* @APPLE_LICENSE_HEADER_END@
*/
-#define MALLOC_REPORT_NOLOG 0x10
-#define MALLOC_REPORT_NOPREFIX 0x20
-#define MALLOC_REPORT_CRASH 0x40
-#define MALLOC_REPORT_DEBUG 0x80
+#include <stdarg.h>
+#include <stdint.h>
+
+#include <malloc/_ptrcheck.h>
+__ptrcheck_abi_assume_single()
+
+#define MALLOC_REPORT_NOLOG 0x010
+#define MALLOC_REPORT_NOPREFIX 0x020
+#define MALLOC_REPORT_CRASH 0x040
+#define MALLOC_REPORT_DEBUG 0x080
+#define MALLOC_REPORT_BACKTRACE 0x100
+#define MALLOC_REPORT_NOWRITE 0x200
+
+#define MALLOC_REPORT_LOG_ONLY \
+ (MALLOC_REPORT_NOPREFIX | MALLOC_REPORT_NOWRITE)
// Most internal logging should use malloc_report() or malloc_vreport(). The
// flags argument should be a combination of the MALLOC_REPORT_xxx values and
@@ -43,6 +54,10 @@
// MALLOC_REPORT_CRASH:
// Same as MALLOC_REPORTDEBUG, but crashes after writing the report
// message.
+// MALLOC_REPORT_BACKTRACE:
+// Append a UUID+offset backtrace to the report text.
+// MALLOC_REPORT_NOWRITE:
+// Does not send the text to malloc_debug_file.
//
// In addition, if MALLOC_REPORT_CRASH or MALLOC_REPORTDEBUG are specified, this
// function will sleep for an hour or send a SIGSTOP signal to the process if
@@ -51,30 +66,33 @@
// happening. In the case of MALLOC_REPORT_CRASH, the crash occurs after all of
// the other actions have completed.
MALLOC_NOEXPORT MALLOC_NOINLINE void
-malloc_report(uint32_t flags, const char *fmt, ...) __printflike(2,3);
+malloc_report(uint32_t flags, const char * __null_terminated fmt, ...) __printflike(2,3);
// Like malloc_report(), but does not send the text to _simple_asl_log() and
// does not write the program name, pid and thread identifier before the report
// text. Equivalent to malloc_report(MALLOC_REPORT_NOLOG|MALLOC_REPORT_NO_PREFIX)
MALLOC_NOEXPORT MALLOC_NOINLINE void
-malloc_report_simple(const char *fmt, ...) __printflike(1,2);
+malloc_report_simple(const char * __null_terminated fmt, ...) __printflike(1,2);
// Like malloc_report(), but precedes the output message with prefix_msg
// as a format string using prefix_arg as a single substition parameter,
// allows the length of time to sleep while reporting an error to be
// specified and passes the arguments to the fmt parameter in a va_list.
MALLOC_NOEXPORT MALLOC_NOINLINE void
-malloc_vreport(uint32_t flags, unsigned sleep_time, const char *prefix_msg,
- const void *prefix_arg, const char *fmt, va_list ap);
+malloc_vreport(uint32_t flags, unsigned sleep_time, const char * __null_terminated prefix_msg,
+ const void *prefix_arg, const char * __null_terminated fmt, va_list ap) __printflike(5,0);
// Higher-level functions used by zone implementations to report errors.
MALLOC_NOEXPORT MALLOC_NOINLINE void
-malloc_zone_error(uint32_t flags, bool is_corruption, const char *fmt, ...) __printflike(3,4);
+malloc_zone_error(uint32_t flags, bool is_corruption, const char * __null_terminated fmt, ...) __printflike(3,4);
MALLOC_NOEXPORT MALLOC_NOINLINE void
-malloc_zone_check_fail(const char *msg, const char *fmt, ...) __printflike(2,3);
+malloc_zone_check_fail(const char * __null_terminated msg, const char * __null_terminated fmt, ...) __printflike(2,3);
// Configures where malloc logging goes based on environment variables. By
// default, goes to stderr if it's a tty, and is otherwise dropped.
MALLOC_NOEXPORT void
malloc_print_configure(bool restricted);
+
+MALLOC_NOEXPORT unsigned
+_malloc_default_debug_sleep_time(void);