On 11/29/2016 05:17 PM, Andrei Borzenkov wrote: > On Tue, Nov 29, 2016 at 4:52 PM, Stanislav Kholmanskikh > <stanislav.kholmansk...@oracle.com> wrote: >> Hi! >> >> Does anybody use MM debugging? If so, what is the recommended/working >> way of enabling it? >> >> These steps do not work: >> >> 1. Run ./configure with '--enable-mm-debug'. It reports: >> >> With memory debugging: Yes >> >> 2. Then build and install the binaries, and install the boot loader >> >> 3. Then set 'grub_mm_debug=1' in the grub's prompt. >> > > This environment variable is not used. > >> grub> set grub_mm_debug=1 >> grub> insmod ofnet >> grub> >> >> During initialization, ofnet calls grub_malloc(), so I expect some debug >> messages to be printed on 'insmod ofnet'. >> >> Am I missing something, or is it a bug? >> > > Either patch grub to assign grub_mm_debug=1 in grub-core/kern/mm.c or > create simple command to do it at run-time. The latter may be > considered for inclusion, although honestly I am not sure how > particular useful mm debugging is.
No, it doesn't help. Look: stas@skholman-m7 grub]$ git diff grub-core/hello/hello.c diff --git a/grub-core/hello/hello.c b/grub-core/hello/hello.c index 456b7c3..c61bab8 100644 --- a/grub-core/hello/hello.c +++ b/grub-core/hello/hello.c @@ -34,6 +34,9 @@ grub_cmd_hello (grub_extcmd_context_t ctxt __attribute__ ((unused)), char **args __attribute__ ((unused))) { grub_printf ("%s\n", _("Hello World")); + + grub_mm_debug = 0; + return 0; } [stas@skholman-m7 grub]$ fails to build with: hello/hello.c: In function ‘grub_cmd_hello’: hello/hello.c:38: error: ‘grub_mm_debug’ undeclared (first use in this function) hello/hello.c:38: error: (Each undeclared identifier is reported only once hello/hello.c:38: error: for each function it appears in.) whereas include/grub/mm.h is included. As for why I need this. I'm working on http://lists.gnu.org/archive/html/grub-devel/2016-11/msg00124.html in particular on that piece of code which is to free card memory on module unload. And I'm considering enabling MM debugging as an additional option to verify that I call grub_free() for all the required buffers. > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel