/* Output an error message to stderr, and exit. STR is printed with the failure message. */ static void __heap_check_failure (struct heap *heap, struct heap_free_area *fa, const char *str, char *fmt, ...) { va_list val; if (str) fprintf (stderr, "\nHEAP CHECK FAILURE %s: ", str); else fprintf (stderr, "\nHEAP CHECK FAILURE: "); va_start (val, fmt); vfprintf (stderr, fmt, val); va_end (val); putc ('\n', stderr); #ifdef MALLOC_DEBUGGING __malloc_debug_set_indent (0); __malloc_debug_printf (1, "heap dump:"); #endif __heap_dump_freelist (heap); exit (22); }
/* Output a text representation of HEAP to stderr, labelling it with STR. */ void __heap_dump (struct heap_free_area *heap, const char *str) { static smallint recursed; if (! recursed) { __heap_check (heap, str); recursed = 1; __malloc_debug_printf (1, "%s: heap @0x%lx:", str, (long)heap); __heap_dump_freelist (heap); __malloc_debug_indent (-1); recursed = 0; } }
/* Output a text representation of HEAP to stderr, labelling it with STR. */ void __heap_dump (struct heap *heap, const char *str) { static int recursed = 0; if (! recursed) { __heap_check (heap, str); recursed = 1; #ifdef MALLOC_DEBUGGING __malloc_debug_printf (1, "%s: heap @0x%lx:", str, (long)heap); #endif __heap_dump_freelist (heap); #ifdef MALLOC_DEBUGGING __malloc_debug_indent (-1); #endif recursed = 0; } }
/* Output an error message to stderr, and exit. STR is printed with the failure message. */ static void attribute_noreturn __heap_check_failure (struct heap_free_area *heap, struct heap_free_area *fa, const char *str, char *fmt, ...) { va_list val; if (str) fprintf (stderr, "\nHEAP CHECK FAILURE %s: ", str); else fprintf (stderr, "\nHEAP CHECK FAILURE: "); va_start (val, fmt); vfprintf (stderr, fmt, val); va_end (val); fprintf (stderr, "\n"); __malloc_debug_set_indent (0); __malloc_debug_printf (1, "heap dump:"); __heap_dump_freelist (heap); _exit (22); }