Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KQNlX-0003kZ-Is for mharc-grub-devel@gnu.org; Tue, 05 Aug 2008 10:43:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQNlV-0003iV-Qj for grub-devel@gnu.org; Tue, 05 Aug 2008 10:43:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQNlU-0003gM-6U for grub-devel@gnu.org; Tue, 05 Aug 2008 10:43:57 -0400 Received: from [199.232.76.173] (port=37098 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQNlT-0003fl-Kl for grub-devel@gnu.org; Tue, 05 Aug 2008 10:43:55 -0400 Received: from gateway10.websitewelcome.com ([67.18.10.8]:48949) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KQNlS-0000Dl-Om for grub-devel@gnu.org; Tue, 05 Aug 2008 10:43:55 -0400 Received: (qmail 6728 invoked from network); 5 Aug 2008 14:50:49 -0000 Received: from gator297.hostgator.com (74.53.228.114) by gateway10.websitewelcome.com with SMTP; 5 Aug 2008 14:50:49 -0000 Received: from c-67-185-142-228.hsd1.wa.comcast.net ([67.185.142.228]:43889 helo=localhost) by gator297.hostgator.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1KQNlN-0006Zb-It for grub-devel@gnu.org; Tue, 05 Aug 2008 09:43:49 -0500 Date: Tue, 5 Aug 2008 07:42:29 -0700 From: Colin D Bennett To: grub-devel@gnu.org Message-ID: <20080805074229.3e5862c5@gibibit.com> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/dX8uIfiaCAOm_=MZIcBtSnj"; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator297.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - gibibit.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: [PATCH][RFC] gdb support in GRUB build system 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: Tue, 05 Aug 2008 14:43:58 -0000 --Sig_/dX8uIfiaCAOm_=MZIcBtSnj Content-Type: multipart/mixed; boundary="MP_/WbjhLpolESSetH=sBuKwPcz" --MP_/WbjhLpolESSetH=sBuKwPcz Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I following the GRUB 2 gdb debugging instructions this week and I was successful in using QEMU and gdb to debug GRUB. I wondered if we could make this a bit easier -- primarily by making GRUB's build system generate the '.elf' files with full symbol info without requiring a patch. Attached is a patch against GRUB 2 trunk (this is the one from the GRUB 2 debugging guide, just fixed to apply on the latest GRUB sources). We could make it a 'configure' option like '--enable-debug' or something, but it seems like minimal overhead to generate the .elf files for gdb in addition to "real" GRUB files. Let me know what you all think. Thanks! Regards, Colin --MP_/WbjhLpolESSetH=sBuKwPcz Content-Type: text/x-patch; name=grub-gdb.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=grub-gdb.patch =3D=3D=3D modified file 'genmk.rb' --- genmk.rb 2008-07-28 21:35:40 +0000 +++ genmk.rb 2008-08-05 14:36:06 +0000 @@ -101,10 +101,11 @@ mod_obj =3D mod_src.suffix('o') defsym =3D 'def-' + @name.suffix('lst') undsym =3D 'und-' + @name.suffix('lst') + exec =3D @name.suffix('elf') mod_name =3D File.basename(@name, '.mod') symbolic_name =3D mod_name.sub(/\.[^\.]*$/, '') =20 - "CLEANFILES +=3D #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str}= #{undsym} + "CLEANFILES +=3D #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str}= #{undsym} #{exec} ifneq ($(#{prefix}_EXPORTS),no) CLEANFILES +=3D #{defsym} DEFSYMFILES +=3D #{defsym} @@ -112,11 +113,14 @@ MOSTLYCLEANFILES +=3D #{deps_str} UNDSYMFILES +=3D #{undsym} =20 -#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF) +#{@name}: #{exec} + -rm -f $@ + $(OBJCOPY) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R= .comment $^ $@ + +#{exec}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF) -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl= ,-r,-d -o $@ #{pre_obj} #{mod_obj} if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@;= exit 1); fi - $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_= init -K _grub_mod_fini -R .note -R .comment $@ =20 #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@ =3D=3D=3D modified file 'kern/main.c' --- kern/main.c 2008-08-04 21:54:06 +0000 +++ kern/main.c 2008-08-05 14:36:06 +0000 @@ -122,6 +122,9 @@ grub_print_error (); } =20 +void +main (void) __attribute__ ((alias("grub_main"))); + /* The main routine. */ void grub_main (void) --MP_/WbjhLpolESSetH=sBuKwPcz-- --Sig_/dX8uIfiaCAOm_=MZIcBtSnj Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkiYZtwACgkQokx8fzcGbYfa6ACeJOjlLtV425CIeNCKf6lEoQcR 50wAn2aSuXE6Ds7oYgj1MMl0XwDx1N7U =dFMC -----END PGP SIGNATURE----- --Sig_/dX8uIfiaCAOm_=MZIcBtSnj--