Commit eaa2d123 authored by Vittorio Giovara's avatar Vittorio Giovara

log: Print a full backtrace along with error messages under Valgrind

Useful to understand where and in what execution state a certain message
is generated. It is enabled only when optimizations are disabled, since
function names are not printed otherwise.
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent bd5ad8b2
...@@ -317,6 +317,8 @@ Developer options (useful when working on Libav itself): ...@@ -317,6 +317,8 @@ Developer options (useful when working on Libav itself):
(group) and PROB the probability associated with (group) and PROB the probability associated with
NAME (default 0.5). NAME (default 0.5).
--random-seed=VALUE seed value for --enable/disable-random --random-seed=VALUE seed value for --enable/disable-random
--disable-valgrind-backtrace do not print a backtrace under Valgrind
(only applies to --disable-optimizations builds)
NOTE: Object files are built at the place where configure is launched. NOTE: Object files are built at the place where configure is launched.
EOF EOF
...@@ -1261,6 +1263,7 @@ CONFIG_LIST=" ...@@ -1261,6 +1263,7 @@ CONFIG_LIST="
pod2man pod2man
texi2html texi2html
thumb thumb
valgrind_backtrace
xmm_clobber_test xmm_clobber_test
" "
...@@ -1412,6 +1415,7 @@ HEADERS_LIST=" ...@@ -1412,6 +1415,7 @@ HEADERS_LIST="
sys_un_h sys_un_h
sys_videoio_h sys_videoio_h
unistd_h unistd_h
valgrind_valgrind_h
windows_h windows_h
winsock2_h winsock2_h
" "
...@@ -1743,6 +1747,7 @@ simd_align_16_if_any="altivec neon sse" ...@@ -1743,6 +1747,7 @@ simd_align_16_if_any="altivec neon sse"
log2_deps="!libc_msvcrt" log2_deps="!libc_msvcrt"
symver_if_any="symver_asm_label symver_gnu_asm" symver_if_any="symver_asm_label symver_gnu_asm"
valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
# threading support # threading support
atomics_gcc_if="sync_val_compare_and_swap" atomics_gcc_if="sync_val_compare_and_swap"
...@@ -2282,6 +2287,7 @@ enable optimizations ...@@ -2282,6 +2287,7 @@ enable optimizations
enable safe_bitstream_reader enable safe_bitstream_reader
enable static enable static
enable swscale_alpha enable swscale_alpha
enable valgrind_backtrace
# By default, enable only those hwaccels that have no external dependencies. # By default, enable only those hwaccels that have no external dependencies.
enable dxva2 vda vdpau enable dxva2 vda vdpau
...@@ -4164,6 +4170,7 @@ check_header sys/select.h ...@@ -4164,6 +4170,7 @@ check_header sys/select.h
check_header sys/time.h check_header sys/time.h
check_header sys/un.h check_header sys/un.h
check_header unistd.h check_header unistd.h
check_header valgrind/valgrind.h
check_header vdpau/vdpau.h check_header vdpau/vdpau.h
check_header vdpau/vdpau_x11.h check_header vdpau/vdpau_x11.h
check_header VideoDecodeAcceleration/VDADecoder.h check_header VideoDecodeAcceleration/VDADecoder.h
......
...@@ -40,6 +40,12 @@ ...@@ -40,6 +40,12 @@
#include "internal.h" #include "internal.h"
#include "log.h" #include "log.h"
#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
/* this is the log level at which valgrind will output a full backtrace */
#define BACKTRACE_LOGLEVEL AV_LOG_ERROR
#endif
static int av_log_level = AV_LOG_INFO; static int av_log_level = AV_LOG_INFO;
static int flags; static int flags;
...@@ -164,6 +170,11 @@ void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl) ...@@ -164,6 +170,11 @@ void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl)
} }
colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, line); colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, line);
av_strlcpy(prev, line, sizeof line); av_strlcpy(prev, line, sizeof line);
#if CONFIG_VALGRIND_BACKTRACE
if (level <= BACKTRACE_LOGLEVEL)
VALGRIND_PRINTF_BACKTRACE("");
#endif
} }
static void (*av_log_callback)(void*, int, const char*, va_list) = static void (*av_log_callback)(void*, int, const char*, va_list) =
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#define LIBAVUTIL_VERSION_MAJOR 54 #define LIBAVUTIL_VERSION_MAJOR 54
#define LIBAVUTIL_VERSION_MINOR 12 #define LIBAVUTIL_VERSION_MINOR 12
#define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_MICRO 1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \ LIBAVUTIL_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment