All of lore.kernel.org
 help / color / mirror / Atom feed
* Debugging GRUB2 with GDB and QEMU
@ 2006-05-12 13:20 Lubomir Kundrak
  2006-05-13  4:38 ` Yoshinori K. Okuji
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Lubomir Kundrak @ 2006-05-12 13:20 UTC (permalink / raw)
  To: grub-devel

I wrote some GDB macros that might be helpful for people
that want to debug GRUB 2 modules with QEMU. [1]

[1] http://NetBSD.sk/~lkundrak/misc/grub2-gdb/

The file genmk.rb.diff is a patch to makefile-generator
script, that makes the build system leave output files with
debugging information. Of course, one has have ruby interpreter
to regenerate the makefiles and compile GRUB with -g
afterwards.

Second file is .gdbinit, the GDB initialization file.  It is
commented, so there is no need to describe it here. It basically
passes the information extracted from list headed by grub_dl_head to
the perl script, gmodule.pl, and loads its output. It also
sets a breakpoint whose command list contains macro for loading
proper symbol file each time a module is loaded. (I know the work
could be done without the help of a Perl script, but it would
be far more complicated, I guess)

Another note worth mentioning is that you'll probably want
to add aliases for some functions, so that all gdb facilities
will work correctly. You will at least want to define the symbol
'main' for backtraces to stop at the right place. Some facilities
also want the function 'malloc' to be defined. So, you'll
probably have to add something like

.globl main
main = codestart

to assembly language sources or

malloc() __attribute__ ((alias("grub_malloc")));

to C files.

I hope this will be useful to at least some of you. Best regards!
Lubo.

-- 
  o	Lubomir Kundrak
 *O*	<lkundrak@skosi.org>, http://skosi.org/~lkundrak/
 (_)	SKOSI -- Slovak OpenSource Initiative



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-05-19 11:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-12 13:20 Debugging GRUB2 with GDB and QEMU Lubomir Kundrak
2006-05-13  4:38 ` Yoshinori K. Okuji
2006-05-18 12:27   ` Lubomir Kundrak
2006-05-18 13:35     ` Hollis Blanchard
2006-05-19 10:16       ` Lubomir Kundrak
2006-05-19 11:25     ` Yoshinori K. Okuji
2006-05-13  5:28 ` RE : " Eric Salomé
2006-05-13 18:45 ` devShadow
2006-05-14 14:01   ` Lubomir Kundrak
2006-05-17 21:15     ` David Johnson
2006-05-13 22:16 ` RE : " Eric Salomé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.