Oh... The usage information was left behind :)

You might need to have most recent QEMU and GDB versions for most
challenging bugs :)...

1. Copy grub.gdb and gmodule.pl to your build directory.

2. Create image for QEMU (grub2.iso in my case).

3. Launch QEMU with GDB stub:

qemu -s -S -cdrom grub2.iso

4. Launch GDB

gdb -x grub.gdb

5. Load connect to QEMU

target remote localhost:1234

6. Load debug symbols for grub 2 kernel

load_kernel

7. Setup breakpoint in grub_main

break grub_main

8. Continue execution until there

c

9. Next time you are at grub_main

10. Delete grub_main breakpoint if it haunts you

del 1

; where 1 is being breakpoint number use 'info break' to see numbers if
you lost that.

11. Setup automatic symbol loading

break_load

12. Happy debugging!

If you want to debug boot code that can be done also... but its a bit
more tricky... and I leave that to another time :).

Tips for RM code debugging: 'set arch i8086' and 'x/10i ($cs<<4)+$eip'.

Thanks,
Vesa Jääskeläinen


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to