All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yoshinori K. Okuji" <okuji@enbug.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: grub_machine_set_prefix, --enable-mm-debug
Date: Wed, 26 Apr 2006 12:45:46 +0200	[thread overview]
Message-ID: <200604261245.46846.okuji@enbug.org> (raw)
In-Reply-To: <87irowodwb.fsf@xs4all.nl>

On Wednesday 26 April 2006 12:00, Marco Gerards wrote:
> How about using a macro as a wrapper.  So something like:
>
> #define grub_malloc(x)		\
>   {				\
>      grub_dprintf (...);	\
>      grub_malloc_int (...)	\
>   }
>
> In that case you can use the existing debugging framework we are all
> used to.

Clearly, I don't want to use grub_dprintf for two reasons:

- I need to print messages twice in some functions. If I use dprintf, it 
prefixes a filename and a line number every time. This is too annoying.

- The use of grub_dprintf requires the modification of an environment 
variable. So this affects the memory manager and the user environment. When 
the memory manager is buggy, I don't want such a side effect.

Frankly speaking, I tried grub_dprintf myself, and abandoned it, due to these 
problems. My problem was actually that I forgot to initialize a local 
variable before freeing it. When using grub_dprintf, by setting a variable, 
the stack was modified, then the fatal error disappeared as a side effect. 
This was extremely confusing. Compared with this, setting a global variable 
does not affect the memory status very much. So I will never go back to 
grub_dprintf for this purpose.

The idea of code sharing is usually very good, but not always good.

Okuji



  reply	other threads:[~2006-04-26 10:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1FYTpn-0003L4-RP@savannah.gnu.org>
2006-04-25 23:22 ` grub_machine_set_prefix, --enable-mm-debug Hollis Blanchard
2006-04-26  8:49   ` Yoshinori K. Okuji
2006-04-26  8:57     ` Marco Gerards
2006-04-26  9:22       ` Yoshinori K. Okuji
2006-04-26 10:00         ` Marco Gerards
2006-04-26 10:45           ` Yoshinori K. Okuji [this message]
2006-04-26  0:10 ` --enable-mm-debug breakage Hollis Blanchard
2006-04-26  2:06   ` Hollis Blanchard
2006-04-26  8:47   ` Yoshinori K. Okuji
2006-04-26 19:31     ` Yoshinori K. Okuji

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=200604261245.46846.okuji@enbug.org \
    --to=okuji@enbug.org \
    --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.