All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: How to enable MM debugging?
Date: Tue, 29 Nov 2016 17:38:56 +0300	[thread overview]
Message-ID: <583D9300.6010000@oracle.com> (raw)
In-Reply-To: <CAA91j0UKTdEUR2RYPN77e5DKkteP7gH425eGF8R65Fm84xH+Vw@mail.gmail.com>



On 11/29/2016 05:17 PM, Andrei Borzenkov wrote:
> On Tue, Nov 29, 2016 at 4:52 PM, Stanislav Kholmanskikh
> <stanislav.kholmanskikh@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
> 


  reply	other threads:[~2016-11-29 14:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 13:52 How to enable MM debugging? Stanislav Kholmanskikh
2016-11-29 14:17 ` Andrei Borzenkov
2016-11-29 14:38   ` Stanislav Kholmanskikh [this message]
2016-11-29 17:11     ` Andrei Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=583D9300.6010000@oracle.com \
    --to=stanislav.kholmanskikh@oracle.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.