Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JlXCI-0006rk-TZ for mharc-grub-devel@gnu.org; Mon, 14 Apr 2008 18:30:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JlXCH-0006rV-Dk for grub-devel@gnu.org; Mon, 14 Apr 2008 18:30:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JlXCG-0006rD-TH for grub-devel@gnu.org; Mon, 14 Apr 2008 18:30:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JlXCG-0006rA-PU for grub-devel@gnu.org; Mon, 14 Apr 2008 18:30:44 -0400 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JlXCG-0000ZI-IW for grub-devel@gnu.org; Mon, 14 Apr 2008 18:30:44 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m3EMUhMg019147 for ; Mon, 14 Apr 2008 18:30:43 -0400 Received: from pobox.stuttgart.redhat.com (pobox.stuttgart.redhat.com [172.16.2.10]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m3EMUh7m025875 for ; Mon, 14 Apr 2008 18:30:43 -0400 Received: from [10.34.1.17] (gopher.brq.redhat.com [10.34.1.17]) by pobox.stuttgart.redhat.com (8.13.1/8.13.1) with ESMTP id m3EMUekX032617 for ; Mon, 14 Apr 2008 18:30:42 -0400 From: Lubomir Kundrak To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="=-7k8mfRDf8mmP6dYRxoGf" Organization: Red Hat Inc. Date: Tue, 15 Apr 2008 00:30:40 +0200 Message-Id: <1208212240.3971.48.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-3.fc8) X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: [PATCH] Make gdb debugging a bit less painful 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: Mon, 14 Apr 2008 22:30:45 -0000 --=-7k8mfRDf8mmP6dYRxoGf Content-Type: text/plain Content-Transfer-Encoding: 7bit These are pretty self-explainable. I think I tried to sumbit these changes with the serial debugging patch year and some months ago and I was told to sign the copyright assignment. I have already done that now. :) 2008-04-15 Lubomir Kundrak * kern/main.c (grub_main) [!GRUB_UTIL]: Alias grub_main to main, so that gdb is able to find stack top. * genmk.rb: replace strip with objcopy, so unstripped files are left untouched for debugging purposes. -- Lubomir Kundrak (Red Hat Security Response Team) --=-7k8mfRDf8mmP6dYRxoGf Content-Disposition: attachment; filename=grub-1.95-debuginfo.patch Content-Type: text/x-patch; name=grub-1.95-debuginfo.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit diff -rup grub-1.95.orig/kern/main.c grub-1.95/kern/main.c --- grub-1.95.orig/kern/main.c 2007-01-29 15:31:36.000000000 +0100 +++ grub-1.95/kern/main.c 2007-01-30 18:29:55.000000000 +0100 @@ -106,6 +106,14 @@ grub_load_normal_mode (void) grub_errno = GRUB_ERR_NONE; } +#ifndef GRUB_UTIL +/* + * Let GDB find the stack top + */ +void +main (void) __attribute__ ((alias("grub_main"))); +#endif + /* The main routine. */ void grub_main (void) --- grub-1.95.cvs20071119.orig/genmk.rb 2007-11-27 10:58:52.000000000 +0100 +++ grub-1.95.cvs20071119/genmk.rb 2007-11-27 11:17:58.000000000 +0100 @@ -101,10 +101,11 @@ mod_obj = mod_src.suffix('o') defsym = 'def-' + @name.suffix('lst') undsym = 'und-' + @name.suffix('lst') + exec = @name.suffix('exec') mod_name = File.basename(@name, '.mod') symbolic_name = mod_name.sub(/\.[^\.]*$/, '') - "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym} + "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym} #{exec} ifneq ($(#{prefix}_EXPORTS),no) CLEANFILES += #{defsym} DEFSYMFILES += #{defsym} @@ -112,10 +113,13 @@ MOSTLYCLEANFILES += #{deps_str} UNDSYMFILES += #{undsym} -#{@name}: #{pre_obj} #{mod_obj} +#{@name}: #{exec} + -rm -f $@ + $(OBJCOPY) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment -R .note.gnu.build-id $^ $@ + +#{exec}: #{pre_obj} #{mod_obj} -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^ - $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment -R .note.gnu.build-id $@ #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@ --=-7k8mfRDf8mmP6dYRxoGf--