diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-04-20 14:44:32 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-04-20 19:20:57 +0100 |
commit | eaa2d123f0a643664721593d248ece6bcd85f1e6 (patch) | |
tree | cb7919c22182b882d88421b8caa3808fd0e5567a /libavutil | |
parent | bd5ad8b23d0f7d469ca30d03deca879993eb0431 (diff) | |
download | ffmpeg-eaa2d123f0a643664721593d248ece6bcd85f1e6.tar.gz |
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: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/log.c | 11 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/libavutil/log.c b/libavutil/log.c index 7f2cb08597..37427efaf1 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; @@ -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); 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) = diff --git a/libavutil/version.h b/libavutil/version.h index eb2574ae81..9c45e0eed9 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -55,7 +55,7 @@ #define LIBAVUTIL_VERSION_MAJOR 54 #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, \ LIBAVUTIL_VERSION_MINOR, \ |