From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYhWr-0001pj-1D for mharc-grub-devel@gnu.org; Wed, 26 Apr 2006 06:45:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYhWp-0001pQ-LA for grub-devel@gnu.org; Wed, 26 Apr 2006 06:45:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYhWo-0001pD-3i for grub-devel@gnu.org; Wed, 26 Apr 2006 06:45:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYhWo-0001pA-07 for grub-devel@gnu.org; Wed, 26 Apr 2006 06:45:50 -0400 Received: from [212.85.152.101] (helo=kotoba.storever.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYhZT-000398-00 for grub-devel@gnu.org; Wed, 26 Apr 2006 06:48:35 -0400 Received: from kotoba.oasis.nexedi.com (kotoba.oasis.nexedi.com [212.85.152.101]) by kotoba.storever.com (Postfix) with ESMTP id 896D73C822E39 for ; Wed, 26 Apr 2006 14:05:06 +0200 (CEST) Received: from [??1] (localhost [127.0.0.1]) by kotoba.storever.com (Postfix) with ESMTP id A5B0A3C822E38 for ; Wed, 26 Apr 2006 14:05:05 +0200 (CEST) From: "Yoshinori K. Okuji" Organization: enbug.org To: The development of GRUB 2 Date: Wed, 26 Apr 2006 12:45:46 +0200 User-Agent: KMail/1.8.2 References: <200604261122.03442.okuji@enbug.org> <87irowodwb.fsf@xs4all.nl> In-Reply-To: <87irowodwb.fsf@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604261245.46846.okuji@enbug.org> X-Bogosity: No, tests=bogofilter, spamicity=0.491731, version=0.17.2 Subject: Re: grub_machine_set_prefix, --enable-mm-debug X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2006 10:45:51 -0000 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