configure.ac: Replace --enable-malloc-logging with a new runtime log level.

About why the new log level LOG_LVL_DEBUG_USB has the same value a
LOG_LVL_DEBUG_MALLOC, see the mailing list discussion starting here:
Replacing --enable-verbose-usb-comms in configure.ac
https://sourceforge.net/p/openocd/mailman/message/59215751/

Other minor fixes included here which are probably
not worth submmitting in separate patches:
- In error message "level must be between -3 and 4", increase 4 to 5.
- LOG_DEBUG_IO was passing LOG_LVL_DEBUG instead of LOG_LVL_DEBUG_IO.

Change-Id: I71440bbabe4785338c0a27562cc76fa1b7d54bf5
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9432
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
R. Diez
2026-02-02 18:00:49 +01:00
committed by Antonio Borneo
parent aaceff81f0
commit 129e9d3005
4 changed files with 37 additions and 39 deletions

View File

@@ -96,8 +96,8 @@ AC_CHECK_FUNCS([strnlen])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([usleep])
AC_CHECK_FUNCS([realpath])
AC_CHECK_FUNCS([mallinfo], [has_at_least_one_mallinfo=yes])
AC_CHECK_FUNCS([mallinfo2], [has_at_least_one_mallinfo=yes])
AC_CHECK_FUNCS([mallinfo])
AC_CHECK_FUNCS([mallinfo2])
# guess-rev.sh only exists in the repository, not in the released archives
AC_MSG_CHECKING([whether to build a release])
@@ -264,21 +264,6 @@ AS_IF([test "x$enable_gcov" = "xyes"], [
AC_DEFINE([USE_GCOV], [0], [0 to leave coverage collection disabled.])
])
debug_malloc=no
AC_ARG_ENABLE([malloc_logging],
AS_HELP_STRING([--enable-malloc-logging],
[Include free space in logging messages (requires malloc.h).]),
[debug_malloc=$enableval], [])
AC_MSG_CHECKING([whether to enable malloc free space logging]);
AC_MSG_RESULT([$debug_malloc])
AS_IF([test "x$debug_malloc" = "xyes"], [
AS_IF([test "x$has_at_least_one_mallinfo" != "xyes"], [
AC_MSG_ERROR([Option --enable-malloc-logging needs a libc with mallinfo or mallinfo2.])
])
AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
])
m4_define([AC_ARG_ADAPTERS], [
m4_foreach([adapter_driver], [$1],
[AC_ARG_ENABLE(ADAPTER_OPT([adapter_driver]),