On 2015-03-09 01:33:48 +0000, Vittorio Giovara wrote:
> 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. It is possible to disable this
> feature entirely or choose the log level between error and warning.
> 
> Signed-off-by: Vittorio Giovara <[email protected]>
> ---
> Now without the boolean logic typo.
> Vittorio
> 
>  configure       | 19 ++++++++++++++++++-
>  libavutil/log.c |  9 +++++++++
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 5f38858..8789d13 100755
> --- a/configure
> +++ b/configure
> @@ -269,6 +269,9 @@ Advanced options (experts only):
>                             (faster, but may crash)
>    --enable-memalign-hack   emulate memalign, interferes with memory debuggers
>    --enable-sram            allow use of on-chip SRAM
> +  --disable-valgrind-backtrace do not print a backtrace under Valgrind
> +  --backtrace-loglevel=LEVEL set log level when printing a log backtrace 
> under
> +                           Valgrind [error] (error/warning/none)

I don't think it's useful to make the log level a configure constant.  
It's clearly a developer option and just editing the source makes more 
sense than reconfiguring the source. this just bloats configure.

>  
>  Optimization options (experts only):
>    --disable-asm            disable all assembly optimizations
> @@ -1617,6 +1620,7 @@ CMDLINE_SELECT="
>      $HAVE_LIST_CMDLINE
>      $THREADS_LIST
>      asm
> +    valgrind_backtrace
>      cross_compile
>      debug
>      extra_warnings
> @@ -1642,6 +1646,7 @@ CMDLINE_SET="
>      ar
>      arch
>      as
> +    backtrace_loglevel
>      build_suffix
>      cc
>      cpu
> @@ -2218,7 +2223,7 @@ pod2man_deps="doc"
>  texi2html_deps="doc"
>  
>  # default parameters
> -
> +backtrace_loglevel="error"
>  logfile="config.log"
>  
>  # installation paths
> @@ -3777,6 +3782,9 @@ die_license_disabled version3 libvo_amrwbenc
>  enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
>  
>  disabled optimizations || check_cflags -fomit-frame-pointer
> +disabled optimizations &&
> +    { check_func_headers valgrind/valgrind.h VALGRIND_PRINTF_BACKTRACE &&
> +      enable_weak valgrind_backtrace; }

please check for valgrind/valgrind.h and VALGRIND_PRINTF_BACKTRACE 
seperately

valgrind_backtrace should depend on "!optimizations 
VALGRIND_PRINTF_BACKTRACE"

that means please add following line to configure: 
valgrind_backtrace_deps="!optimizations VALGRIND_PRINTF_BACKTRACE"

if it depends on frame pointers we probably should make thatr explicit

>  enable_weak_pic() {
>      disabled pic && return
> @@ -4828,6 +4836,15 @@ EOF
>  test -n "$malloc_prefix" &&
>      echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
>  
> +if enabled valgrind_backtrace; then
> +    case $backtrace_loglevel in
> +        "error")   backtrace_loglevel=AV_LOG_ERROR  ;;
> +        "warning") backtrace_loglevel=AV_LOG_WARNING;;
> +        *)         backtrace_loglevel=AV_LOG_QUIET  ;;
> +    esac
> +    echo "#define BACKTRACE_LOGLEVEL $backtrace_loglevel" >>$TMPH
> +fi
> +
>  if enabled yasm; then
>      append config_files $TMPASM
>      printf '' >$TMPASM
> diff --git a/libavutil/log.c b/libavutil/log.c
> index d38e40b..a92d0d0 100644
> --- a/libavutil/log.c
> +++ b/libavutil/log.c
> @@ -40,6 +40,10 @@
>  #include "internal.h"
>  #include "log.h"
>  
> +#ifdef BACKTRACE_LOGLEVEL

#if HAVE_VALGRIND_VALGRIND_H

> +#include <valgrind/valgrind.h>
> +#endif
> +
>  static int av_log_level = AV_LOG_INFO;
>  static int flags;
>  
> @@ -161,6 +165,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 BACKTRACE_LOGLEVEL

#if CONFIG_VALGRIND_BACKTRACE

> +    if (level <= BACKTRACE_LOGLEVEL)
> +        VALGRIND_PRINTF_BACKTRACE("");
> +#endif
>  }


Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to