mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-15 22:05:24 -05:00
Print stack trace on assert() failure or when calling fatal_error()
Note: this uses the __sanitizer_print_stack_trace() function from the AddressSanitizer runtime, so it only works when AddressSanitizer is in use.
This commit is contained in:
parent
bcf46d9eab
commit
22f25a9e4f
23 changed files with 125 additions and 37 deletions
12
xmalloc.c
12
xmalloc.c
|
|
@ -1,21 +1,11 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <syslog.h>
|
||||
#include "xmalloc.h"
|
||||
|
||||
static NORETURN COLD void
|
||||
fatal_error(const char *msg, int err)
|
||||
{
|
||||
syslog(LOG_ERR, "%s: %s", msg, strerror(err));
|
||||
errno = err;
|
||||
perror(msg);
|
||||
abort();
|
||||
}
|
||||
#include "debug.h"
|
||||
|
||||
static void *
|
||||
check_alloc(void *alloc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue