[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to enable MM debugging?
From: |
Stanislav Kholmanskikh |
Subject: |
Re: How to enable MM debugging? |
Date: |
Tue, 29 Nov 2016 17:38:56 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 11/29/2016 05:17 PM, Andrei Borzenkov wrote:
> On Tue, Nov 29, 2016 at 4:52 PM, Stanislav Kholmanskikh
> <address@hidden> 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:
address@hidden 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;
}
address@hidden 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
> address@hidden
> https://lists.gnu.org/mailman/listinfo/grub-devel
>