[SeaBIOS] [Question] Debug Seabios by GDB with Qemu

Kevin O'Connor kevin at koconnor.net
Thu Feb 8 03:39:40 CET 2018


On Mon, Feb 05, 2018 at 07:10:58PM +0800, Liu, Jing2 wrote:
> On 1/31/2018 10:46 AM, Kevin O'Connor wrote:
> > On Mon, Jan 29, 2018 at 02:18:45PM +0800, Liu, Jing2 wrote:
> > > Hello,
> > > 
> > > I am using Seabios for qemu startup, and interested in the debugging by GDB
> > > to see how the bios works.
> > > 
> > > Currently, I do it as https://www.seabios.org/Debugging said but met some
> > > problems so that couldn't move on. :(
> > > Could someone give some pointers on what I missed or have to do to enable
> > > the gdb debugging?
> > > 
> > > Note:
> > > Arch: x86_64 PC
> > > CONFIG_DEBUG_SERIAL is enabled.
> > > CONFIG_RELOCATE_INIT is disabled.
> > > 
> > > 1.  After Qemu starts, I run "gdb out/rom32seg.o" in another session, and do
> > > "target remote localhost:1234", it warns me that
> > > "Selected architecture i386 is not compatible with reported target
> > > architecture i386:x86_64". But I didn't find any 64bit rom.
> > 
> > I'm not sure why you choose out/rom32seg.o - to debug the 32bit code,
> > you want to use out/rom.o.
> 
> Thank you for your answer!
> But after I connect to qemu in the gdb session, and execute "run" OR "start"
> to start the rom.o, it both reports me a signal SIGKILL.

It works for me.  See log below.

-Kevin


====================================================

$ ../qemu/qemu-2.10.0/i386-softmmu/qemu-system-i386 -k en-us -snapshot -L test -chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios -m 512 -hda dos-drivec -s -S

====================================================

$ gdb out/rom.o
GNU gdb (GDB) Fedora 8.0.1-35.fc27
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from out/rom.o...done.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
(gdb) b startBoot
Breakpoint 1 at 0xf1d4d: file ./src/post.c, line 184.
(gdb) c
Continuing.

Breakpoint 1, startBoot () at ./src/post.c:184
184     {
(gdb) 




More information about the SeaBIOS mailing list