From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LbGXu-0002V3-66 for mharc-grub-devel@gnu.org; Sun, 22 Feb 2009 10:47:10 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LbGXs-0002UV-IK for grub-devel@gnu.org; Sun, 22 Feb 2009 10:47:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LbGXr-0002TU-6Z for grub-devel@gnu.org; Sun, 22 Feb 2009 10:47:08 -0500 Received: from [199.232.76.173] (port=33682 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LbGXq-0002TN-UB for grub-devel@gnu.org; Sun, 22 Feb 2009 10:47:06 -0500 Received: from mta-out.inet.fi ([195.156.147.13]:35509 helo=kirsi2.inet.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LbGXq-0004KE-3C for grub-devel@gnu.org; Sun, 22 Feb 2009 10:47:06 -0500 Received: from [192.168.1.102] (84.248.105.254) by kirsi2.inet.fi (8.5.014) id 48FC5B89056244E9 for grub-devel@gnu.org; Sun, 22 Feb 2009 17:47:05 +0200 Message-ID: <49A17371.8020009@nic.fi> Date: Sun, 22 Feb 2009 17:46:57 +0200 From: =?UTF-8?B?VmVzYSBKw6TDpHNrZWzDpGluZW4=?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: The development of GRUB 2 References: <49A1707A.2060208@nic.fi> In-Reply-To: <49A1707A.2060208@nic.fi> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: Quoted-Printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: qemu + gdb debugging... 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: Sun, 22 Feb 2009 15:47:08 -0000 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=C3=A4=C3=A4skel=C3=A4inen