How to enable MM debugging?
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.
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?
Thanks.
Quoted 7 lines · Stanislav Kholmanskikh
Hi!
Does anybody use MM debugging? If so, what is the recommended/working way of enabling it?
These steps do not work:
Quoted 8 lines
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.
Quoted 9 lines
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.
Quoted 27 lines · Andrei Borzenkov
Quoted 7 lines · Stanislav Kholmanskikh
Hi!
Does anybody use MM debugging? If so, what is the recommended/working way of enabling it?
These steps do not work:
Quoted 8 lines
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.
Quoted 7 lines
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'.
Quoted 7 lines
Quoted 2 lines
Am I missing something, or is it a bug?
Either patch grub to assign grub_mm_debug=1 in
grub-core/kern/mm.cor 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
grub-core/hello/hello.c +0 -0
@@ -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.
Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
29.11.2016 17:38, Stanislav Kholmanskikh пишет:
Quoted 60 lines · Andrei Borzenkov
Quoted 27 lines
Quoted 7 lines · Stanislav Kholmanskikh
Hi!
Does anybody use MM debugging? If so, what is the recommended/working way of enabling it?
These steps do not work:
Quoted 8 lines
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.
Quoted 7 lines
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'.Quoted 7 lines
Quoted 2 lines
Am I missing something, or is it a bug?
Either patch grub to assign grub_mm_debug=1 in
grub-core/kern/mm.cor 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.cgrub-core/hello/hello.c +3
-0@@ -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:
Quoted 8 lines
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 oncehello/hello.c:38: error: for each function it appears in.)whereas
include/grub/mm.his included.
You need to guard use of grub_mm_debug using the same #ifdef as in include/grub/mm.h or simply include your command under #ifdef MM_DEBUG in grub-core/kern/mm.c.
Quoted 9 lines
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.