## Question Once l input `run` in `gdb out/rom.o` command prompt, The progrem will crash with error `During startup program terminated with signal SIGSEGV, Segmentation fault.` ## Reproduce As what the website(https://www.seabios.org/Debugging) said, I add '-s -S' to the QEMU command line and start qemu-system-x86_64. And then, I open another terminal to run `gdb out/rom.o`. Once in gdb, after l input `target remote localhost:1234`, the gdb have warning(warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 && warning: Architecture rejected target-supplied description). I set a break point `b do_boot`, and input `run`. To my surprise, the gdb command prompt throws a error `During startup program terminated with signal SIGSEGV, Segmentation fault.`
``` The first terminal # /usr/bin/qemu-system-x86_64 \ -name guest=VM,debug-threads=on \ -bios /root/qemu/out/bios.bin \ -S -s\ -machine pc-i440fx-5.0,accel=kvm,usb=off,dump-guest-core=off \ -cpu Broadwell-IBRS,vmx=off \ -m size=2097152k,slots=64,maxmem=268435456k \ -overcommit mem-lock=off \ -smp 3,maxcpus=4,sockets=2,dies=1,cores=2,threads=1 \ -numa node,nodeid=0,cpus=0-1,cpus=3,mem=1365 \ -numa node,nodeid=1,cpus=2,mem=683 \ -uuid bee8da7f-b699-4f20-9e82-091e809b6e47 \ -no-user-config \ -nodefaults \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ -device pci-bridge,chassis_nr=1,id=pci.1,bus=pci.0,addr=0x3 \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.0,addr=0x4 \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device usb-ehci,id=usb1,bus=pci.0,addr=0x8 \ -device nec-usb-xhci,id=usb2,bus=pci.0,addr=0x9 \ -device ich9-usb-ehci1,id=usb3,bus=pci.0,addr=0xa.0x7 \ -device ich9-usb-uhci1,masterbus=usb3.0,firstport=0,bus=pci.0,multifunction=on,addr=0xa \ -device ich9-usb-uhci2,masterbus=usb3.0,firstport=2,bus=pci.0,addr=0xa.0x1 \ -device ich9-usb-uhci3,masterbus=usb3.0,firstport=4,bus=pci.0,addr=0xa.0x2 \ -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x7 \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0xb \ -device ide-cd,bus=ide.1,unit=1,id=ide0-1-1,bootindex=1 \ -device floppy,unit=0,id=fdc0-0-0 \ -blockdev '{"driver":"iscsi","portal":"{ip1}:{port1}","target":"{lun}","lun":1,"transport":"tcp","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"}' \ -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,device_id=drive-scsi0-0-0-0,drive=libvirt-2-format,id=scsi0-0-0-0,bootindex=2,write-cache=on \ -spice port=5903,addr=::0.0.0.0,image-compression=lz,streaming-video=all,seamless-migration=on \ -chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios ```
``` The Second Terminal # gdb out/rom.o GNU gdb (GDB) Red Hat Enterprise Linux 8.2-12.el8 Copyright (C) 2018 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 warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 warning: Architecture rejected target-supplied description Remote 'g' packet reply is too long (expected 312 bytes, got 608 bytes): 000000000000000000000000000000000000000000000000d206030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0ff0000000000000200000000f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000 (gdb) b do_boot Breakpoint 1 at 0xf0f31: file ./src/boot.c, line 975. (gdb) r Starting program: /root/qemu/out/rom.o During startup program terminated with signal SIGSEGV, Segmentation fault. (gdb) ```
## some env info ``` # cat /etc/redhat-release CentOS Linux release 8.2.2004 (Core) # uname -a Linux TOS-1048 4.18.0-167.el8.x86_64 #9 SMP Mon Jul 20 16:03:29 CST 2020 x86_64 x86_64 x86_64 GNU/Linux # gdb --version GNU gdb (GDB) Red Hat Enterprise Linux 8.2-12.el8 Copyright (C) 2018 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. # /usr/bin/qemu-system-x86_64 --version QEMU emulator version 5.0.0 Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers ```