[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] configure: Properly handle MM_DEBUG

From: Glenn Washburn
Subject: [PATCH] configure: Properly handle MM_DEBUG
Date: Tue, 25 Jan 2022 23:55:16 -0600

Define MM_DEBUG in config.h when --enable-mm-debug is passed to configure.
It was being defined in config-util.h which only gets used when building
GRUB utilities for the host side. The enabling of debugging for memory
management in include/grub/mm.h explicitly does not happen when compiling
for the GRUB utilities. So this debugging code effectively could never be
enabled. Note, that MM_DEBUG is defined in an #if directive because the
enabling of debugging checks if MM_DEBUG is defined, not what its value is.
So even if MM_DEBUG were defined to nothing, the debugging code would
still be enabled.

Signed-off-by: Glenn Washburn <>
I just got bit by this, and then remembered that Daniel A had something similar,
which inadvertently always enables MM_DEBUG. I believe this patch addresses
the concern that Daniel K had with that patch. Technically, the #undef is
unnecessary and I'm not opposed to taking it out.


---  | 6 ++++++ | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ b/
index 9e8f9911b..9063e8149 100644
--- a/
+++ b/
@@ -9,6 +9,12 @@
 #define HAVE_MEMMOVE 1
+#if @MM_DEBUG@
+#define MM_DEBUG @MM_DEBUG@
+#undef MM_DEBUG
 /* Define to 1 to enable disk cache statistics.  */
diff --git a/ b/
index 4f649edaf..263f02775 100644
--- a/
+++ b/
@@ -1511,9 +1511,11 @@ AC_ARG_ENABLE([mm-debug],
                              [include memory manager debugging]))
 if test x$enable_mm_debug = xyes; then
-    AC_DEFINE([MM_DEBUG], [1],
-            [Define to 1 if you enable memory manager debugging.])
+    MM_DEBUG=1
+    MM_DEBUG=0

reply via email to

[Prev in Thread] Current Thread [Next in Thread]