diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-20 23:30:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-20 23:30:33 +0200 |
commit | 954b5e340e8ea930f13a9ff2f3a7cbf7ccb3d989 (patch) | |
tree | b184fd13d3ec65d442863b6c979b8139e8a8ea88 | |
parent | 1a41415b2adcc38d1de4b10ed2f97c2db2036c08 (diff) | |
parent | eaa2d123f0a643664721593d248ece6bcd85f1e6 (diff) | |
download | ffmpeg-954b5e340e8ea930f13a9ff2f3a7cbf7ccb3d989.tar.gz |
Merge commit 'eaa2d123f0a643664721593d248ece6bcd85f1e6'
* commit 'eaa2d123f0a643664721593d248ece6bcd85f1e6':
log: Print a full backtrace along with error messages under Valgrind
Conflicts:
libavutil/log.c
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rwxr-xr-x | configure | 7 | ||||
-rw-r--r-- | libavutil/log.c | 11 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
3 files changed, 19 insertions, 1 deletions
@@ -395,6 +395,8 @@ Developer options (useful when working on FFmpeg 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 + (only applies to --disable-optimizations builds) NOTE: Object files are built at the place where configure is launched. EOF @@ -1512,6 +1514,7 @@ CONFIG_LIST=" pod2man raise_major thumb + valgrind_backtrace xmm_clobber_test " @@ -1686,6 +1689,7 @@ HEADERS_LIST=" termios_h udplite_h unistd_h + valgrind_valgrind_h windows_h winsock2_h " @@ -2068,6 +2072,7 @@ simd_align_16_if_any="altivec neon sse" # system capabilities symver_if_any="symver_asm_label symver_gnu_asm" +valgrind_backtrace_deps="!optimizations valgrind_valgrind_h" # threading support atomics_gcc_if_any="sync_val_compare_and_swap atomic_compare_exchange" @@ -2796,6 +2801,7 @@ enable runtime_cpudetect enable safe_bitstream_reader enable static enable swscale_alpha +enable valgrind_backtrace sws_max_filter_size_default=256 set_default sws_max_filter_size @@ -4933,6 +4939,7 @@ check_header sys/time.h check_header sys/un.h check_header termios.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 b256d07624..b2bc65cd8b 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -47,6 +47,12 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; #define LINE_SZ 1024 +#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; @@ -334,6 +340,11 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, part[2].str); sanitize(part[3].str); colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, part[3].str); + +#if CONFIG_VALGRIND_BACKTRACE + if (level <= BACKTRACE_LOGLEVEL) + VALGRIND_PRINTF_BACKTRACE(""); +#endif end: av_bprint_finalize(part+3, NULL); #if HAVE_PTHREADS diff --git a/libavutil/version.h b/libavutil/version.h index ec3f586ead..18a22952e0 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -57,7 +57,7 @@ #define LIBAVUTIL_VERSION_MAJOR 54 #define LIBAVUTIL_VERSION_MINOR 23 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ |