mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Read $LIBASOUND_DEBUG as integer
Read $LIBASOUND_DEBUG as integer, 1 = hw_params dump, 2 = assert.
This commit is contained in:
parent
cac370de25
commit
87ec7df91d
3 changed files with 10 additions and 6 deletions
10
NOTES
10
NOTES
|
|
@ -22,9 +22,13 @@ Verbose Error Messages
|
||||||
Since version 1.0.8, assert() for some non-fatal errors are removed
|
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,
|
and error messages are no longer shown to stderr as default. Instead,
|
||||||
the error messages appear only when the environment variable
|
the error messages appear only when the environment variable
|
||||||
LIBASOUND_DEBUG is set. When LIBASOUND_DEBUG=assert is set, the
|
LIBASOUND_DEBUG is set (to a non-empty value).
|
||||||
default error message handler calls assert() to catch with a
|
|
||||||
debugger.
|
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,
|
This feature is disabled when --with-debug=no is passed to configure,
|
||||||
i.e. no strict checking is done in alsa-lib.
|
i.e. no strict checking is done in alsa-lib.
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ static void snd_err_msg_default(const char *file, int line, const char *function
|
||||||
fprintf(stderr, ": %s", snd_strerror(err));
|
fprintf(stderr, ": %s", snd_strerror(err));
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
if (! strcmp(verbose, "assert"))
|
if (! strcmp(verbose, "assert") || atoi(verbose) > 1)
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#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,
|
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)
|
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");
|
const char *verbose = getenv("LIBASOUND_DEBUG");
|
||||||
snd_output_t *out;
|
snd_output_t *out;
|
||||||
|
|
||||||
if (! verbose || ! *verbose)
|
if (! verbose || ! *verbose || atoi(verbose) < 1)
|
||||||
return;
|
return;
|
||||||
if (snd_output_stdio_attach(&out, stderr, 0) < 0)
|
if (snd_output_stdio_attach(&out, stderr, 0) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue