From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cBjYr-00014B-3t for mharc-grub-devel@gnu.org; Tue, 29 Nov 2016 09:39:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBjYo-00012T-OM for grub-devel@gnu.org; Tue, 29 Nov 2016 09:39:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBjYk-0006uE-QJ for grub-devel@gnu.org; Tue, 29 Nov 2016 09:39:06 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:28803) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cBjYk-0006tp-GI for grub-devel@gnu.org; Tue, 29 Nov 2016 09:39:02 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uATEcxUH019110 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 29 Nov 2016 14:39:00 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id uATEcwOX003689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 29 Nov 2016 14:38:59 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id uATEcwIq010388 for ; Tue, 29 Nov 2016 14:38:58 GMT Received: from [10.162.81.122] (/10.162.81.122) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Nov 2016 14:38:57 +0000 Subject: Re: How to enable MM debugging? To: The development of GNU GRUB References: <583D880B.6070905@oracle.com> From: Stanislav Kholmanskikh Message-ID: <583D9300.6010000@oracle.com> 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 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 X-Source-IP: userv0022.oracle.com [156.151.31.74] Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by userp1040.oracle.com id uATEcxUH019110 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 156.151.31.81 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 14:39:08 -0000 On 11/29/2016 05:17 PM, Andrei Borzenkov wrote: > On Tue, Nov 29, 2016 at 4:52 PM, Stanislav Kholmanskikh > 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=3D1' in the grub's prompt. >> >=20 > This environment variable is not used. >=20 >> grub> set grub_mm_debug=3D1 >> grub> insmod ofnet >> grub> >> >> During initialization, ofnet calls grub_malloc(), so I expect some deb= ug >> messages to be printed on 'insmod ofnet'. >> >> Am I missing something, or is it a bug? >> >=20 > Either patch grub to assign grub_mm_debug=3D1 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 =3D 0; + return 0; } [stas@skholman-m7 grub]$ fails to build with: hello/hello.c: In function =91grub_cmd_hello=92: hello/hello.c:38: error: =91grub_mm_debug=92 undeclared (first use in thi= s function) hello/hello.c:38: error: (Each undeclared identifier is reported only onc= e 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. >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20