grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grub_machine_set_prefix, --enable-mm-debug


From: Yoshinori K. Okuji
Subject: Re: grub_machine_set_prefix, --enable-mm-debug
Date: Wed, 26 Apr 2006 12:45:46 +0200
User-agent: KMail/1.8.2

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 via email to

[Prev in Thread] Current Thread [Next in Thread]