Skip to contentSkip to conversation

Wiki DebuggingWithGDB

PATCH Felix Zielcke 2 participants 3 messages Jul 28, 2008 – Aug 2, 2008

lore
Share & tools
lore
#0 lore raw

(Probable Lubomir is subscribed but just in case sending the mail to him, he made originally the Wiki page and is hosting the patch.)

I just tried that GRUB in qemu debugging with GDB stuff. The Stuff on that Wiki page is a bit outdated.
I'm not that familiar with such things but maybe I can try to fix this myself.

Attached is the grub2-gdb.diff updated to current SVN version. I don't have any webspace to host it.
I have compiled grub2 with CFLAGS="-g3 -O0"

gdb shows:

GNU gdb 6.8-debian
[copyright stuff]
This GDB was configured as "x86_64-linux-gnu". 0x00008c1e in grub_console_getkey ()
Function "grub_dl_add" not defined. /home/fz/grub/grub2.svn/.gdbinit:78: Error in sourced command file:
No breakpoint number 0.
(gdb) bt

#0  0x00008c1e in grub_console_getkey ()
#1  0x81400006 in ?? ()
#2  0x02060000 in ?? ()
#3  0xff0080ff in ?? ()
#4  0x00000000 in ?? ()
main.c +3 -0
Index: kern/main.c
===================================================================
@@ -106,6 +106,9 @@
   grub_print_error ();
 }
 
+void
+main (void) __attribute__ ((alias("grub_main")));
+
 /* The main routine.  */
 void
 grub_main (void)
genmk.rb +7 -3
Index: genmk.rb
===================================================================
@@ -101,10 +101,11 @@
     mod_obj = mod_src.suffix('o')
     defsym = 'def-' + @name.suffix('lst')
     undsym = 'und-' + @name.suffix('lst')
+    exec = @name.suffix('elf')
     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,11 +113,14 @@
 MOSTLYCLEANFILES += #{deps_str}
 UNDSYMFILES += #{undsym}
 
-#{@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 $@
 
 #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
 	-rm -f $@
#1 lore raw
Quoted 7 lines · Felix Zielcke

(Probable Lubomir is subscribed but just in case sending the mail to him, he made originally the Wiki page and is hosting the patch.)

I just tried that GRUB in qemu debugging with GDB stuff. The Stuff on that Wiki page is a bit outdated.
I'm not that familiar with such things but maybe I can try to fix this myself.

ISTR he sent a patch that would merge GDB support into GRUB. Can't remember how did this end up, but you could check the list archives.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
#2 lore raw

Am Montag, den 28.07.2008, 14:44 +0200 schrieb Robert Millan:

Quoted 3 lines

ISTR he sent a patch that would merge GDB support into GRUB. Can't remember how did this end up, but you could check the list archives.

His patches on his new fedora site are still dated before the comments from Vesa JÃÃskelÃinen.

Here the links to the 2 recent threads about this topic on the webarchive:

http://lists.gnu.org/archive/html/grub-devel/2008-05/msg00000.html
http://lists.gnu.org/archive/html/grub-devel/2008-05/msg00051.html