aboutsummaryrefslogtreecommitdiff
path: root/libavutil/log.c
diff options
context:
space:
mode:
authorMichael Niedermayer2015-04-20 23:30:33 +0200
committerMichael Niedermayer2015-04-20 23:30:33 +0200
commit954b5e340e8ea930f13a9ff2f3a7cbf7ccb3d989 (patch)
treeb184fd13d3ec65d442863b6c979b8139e8a8ea88 /libavutil/log.c
parent1a41415b2adcc38d1de4b10ed2f97c2db2036c08 (diff)
parenteaa2d123f0a643664721593d248ece6bcd85f1e6 (diff)
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>
Diffstat (limited to 'libavutil/log.c')
-rw-r--r--libavutil/log.c11
1 files changed, 11 insertions, 0 deletions
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