Skip to content

Commit

Permalink
core: only generate backtraces if EXTRA_DEBUG is defined.
Browse files Browse the repository at this point in the history
This fixes build on systems that have no backtrace API in the
libc (e.g. BSDs).
  • Loading branch information
sobomax committed Oct 17, 2024
1 parent fc1aceb commit bd95d9e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions io_wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
#ifdef __OS_linux
#include <features.h> /* for GLIBC version testing */
#endif
#ifdef EXTRA_DEBUG
#include "lib/dbg/backtrace.h"
#endif

#ifndef FD_TYPE_DEFINED
typedef int fd_type;
Expand Down Expand Up @@ -732,13 +734,17 @@ inline static int io_watch_del(io_wait_h* h, int fd, int idx,
if (!(idx>=0 && idx<h->fd_no)) {
LM_CRIT("[%s] FD index check failed, idx=%d, max=%d"
" operating on %d\n",h->name, idx, h->fd_no, fd );
#ifdef EXTRA_DEBUG
log_backtrace();
#endif
rla_dump();
idx = -1;
} else if (h->fd_array[idx].fd!=fd) {
LM_CRIT("[%s] FD consistency check failed, idx=%d points to fd=%d,"
" but operating on %d\n",h->name, idx, h->fd_array[idx].fd, fd );
#ifdef EXTRA_DEBUG
log_backtrace();
#endif
rla_dump();
idx = -1;
}
Expand Down

0 comments on commit bd95d9e

Please sign in to comment.