All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vesa Jääskeläinen" <chaac@nic.fi>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: qemu + gdb debugging...
Date: Sun, 22 Feb 2009 17:46:57 +0200	[thread overview]
Message-ID: <49A17371.8020009@nic.fi> (raw)
In-Reply-To: <49A1707A.2060208@nic.fi>

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



      reply	other threads:[~2009-02-22 15:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-22 15:34 qemu + gdb debugging Vesa Jääskeläinen
2009-02-22 15:46 ` Vesa Jääskeläinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49A17371.8020009@nic.fi \
    --to=chaac@nic.fi \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.