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 print otherwise.
Signed-off-by: Vittorio Giovara <[email protected]> --- This version follows all Janne's suggestion, except for valgrind_backtrace_deps. Since the function is a static inline present since many versions, I do not foresee any problems in checking for the header only. Cheers, Vittorio configure | 7 +++++++ libavutil/log.c | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/configure b/configure index 3c38a8c..aee94f8 100755 --- a/configure +++ b/configure @@ -315,6 +315,8 @@ Developer options (useful when working on Libav itself): (group) and PROB the probability associated with NAME (default 0.5). --random-seed=VALUE seed value for --enable/disable-random + --disable-valgrind-backtrace do not print a backtrace under Valgrind + (needs --disable-optimizations) NOTE: Object files are built at the place where configure is launched. EOF @@ -1257,6 +1259,7 @@ CONFIG_LIST=" pod2man texi2html thumb + valgrind_backtrace xmm_clobber_test " @@ -1408,6 +1411,7 @@ HEADERS_LIST=" sys_un_h sys_videoio_h unistd_h + valgrind_valgrind_h windows_h winsock2_h " @@ -1737,6 +1741,7 @@ simd_align_16_if_any="altivec neon sse" log2_deps="!libc_msvcrt" symver_if_any="symver_asm_label symver_gnu_asm" +valgrind_backtrace_deps="!optimizations valgrind_valgrind_h" # threading support atomics_gcc_if="sync_val_compare_and_swap" @@ -2264,6 +2269,7 @@ enable optimizations enable safe_bitstream_reader enable static enable swscale_alpha +enable_weak valgrind_backtrace # By default, enable only those hwaccels that have no external dependencies. enable dxva2 vda vdpau @@ -4147,6 +4153,7 @@ check_header sys/select.h check_header sys/time.h check_header sys/un.h check_header unistd.h +check_header valgrind/valgrind.h check_header vdpau/vdpau.h check_header vdpau/vdpau_x11.h check_header VideoDecodeAcceleration/VDADecoder.h diff --git a/libavutil/log.c b/libavutil/log.c index d38e40b..c4b7f61 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -40,6 +40,12 @@ #include "internal.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 flags; @@ -161,6 +167,11 @@ void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl) } colored_fputs(av_clip(level >> 3, 0, 6), tint >> 8, line); av_strlcpy(prev, line, sizeof line); + +#ifdef CONFIG_VALGRIND_BACKTRACE + if (level <= BACKTRACE_LOGLEVEL) + VALGRIND_PRINTF_BACKTRACE(""); +#endif } static void (*av_log_callback)(void*, int, const char*, va_list) = -- 1.9.3 (Apple Git-50) _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
