From: Takashi Iwai Date: Wed, 20 Apr 2005 14:26:49 +0000 (+0000) Subject: Read $LIBASOUND_DEBUG as integer X-Git-Tag: v1.0.9rc3~5 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=87ec7df91dd5bf71f406c0947346145211fe45e5;p=alsa-lib.git Read $LIBASOUND_DEBUG as integer Read $LIBASOUND_DEBUG as integer, 1 = hw_params dump, 2 = assert. --- diff --git a/NOTES b/NOTES index 9a862ae5..5c0e0103 100644 --- a/NOTES +++ b/NOTES @@ -22,9 +22,13 @@ Verbose Error Messages Since version 1.0.8, assert() for some non-fatal errors are removed and error messages are no longer shown to stderr as default. Instead, the error messages appear only when the environment variable -LIBASOUND_DEBUG is set. When LIBASOUND_DEBUG=assert is set, the -default error message handler calls assert() to catch with a -debugger. +LIBASOUND_DEBUG is set (to a non-empty value). + +When LIBASOUND_DEBUG=1 is set, the errors in hw_params configuration +will be dumped to stderr. Note that this will show even the non-fatal +errors of plug layer (trial-and-error of parameters). +When LIBASOUND_DEBUG=2 is set, the default error message handler calls +assert() to catch with a debugger, in addition to parameter debugging. This feature is disabled when --with-debug=no is passed to configure, i.e. no strict checking is done in alsa-lib. diff --git a/src/error.c b/src/error.c index 30beb331..542504c2 100644 --- a/src/error.c +++ b/src/error.c @@ -135,7 +135,7 @@ static void snd_err_msg_default(const char *file, int line, const char *function fprintf(stderr, ": %s", snd_strerror(err)); putc('\n', stderr); va_end(arg); - if (! strcmp(verbose, "assert")) + if (! strcmp(verbose, "assert") || atoi(verbose) > 1) assert(0); } diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index 8078ab95..f868699f 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -23,7 +23,7 @@ #ifndef NDEBUG /* - * dump hw_params when $LIBASOUND_DEBUG is set + * dump hw_params when $LIBASOUND_DEBUG is set to >= 1 */ static void dump_hw_params(snd_pcm_hw_params_t *params, const char *type, snd_pcm_hw_param_t var, unsigned int val, int err) @@ -31,7 +31,7 @@ static void dump_hw_params(snd_pcm_hw_params_t *params, const char *type, const char *verbose = getenv("LIBASOUND_DEBUG"); snd_output_t *out; - if (! verbose || ! *verbose) + if (! verbose || ! *verbose || atoi(verbose) < 1) return; if (snd_output_stdio_attach(&out, stderr, 0) < 0) return;