Recently, I began to debug Linux kernel 5.18.10 with QEMU(qemu-system-x86_64)
and gdb. From Linux Inside, I know that the BIOS of QEMU would load kernel code
to 0x10000 when QEMU was startup, and the first instruction that QEMU would
execute in the Linux kernel is in 0x10200. So I set a breakpoint on 0x10200.
While after a continue command was sent to gdb, it received the message of
"Program received signal SIGTRAP, Trace/breakpoint trap." and then EIP was set
to 0x0. So I can't debug Linux's early booting progress.
Can someone help me figure it out?
Words below are my actions and output in QEMU and gdb.
1. run QEMU:
3. set breakpoint on 0x10200:
4. continue on gdb:
and gdb. From Linux Inside, I know that the BIOS of QEMU would load kernel code
to 0x10000 when QEMU was startup, and the first instruction that QEMU would
execute in the Linux kernel is in 0x10200. So I set a breakpoint on 0x10200.
While after a continue command was sent to gdb, it received the message of
"Program received signal SIGTRAP, Trace/breakpoint trap." and then EIP was set
to 0x0. So I can't debug Linux's early booting progress.
Can someone help me figure it out?
Words below are my actions and output in QEMU and gdb.
1. run QEMU:
qemu-system-x86_64 -kernel ./arch/x86_64/boot/bzImage \2. run gdb:
-device virtio-serial \
-chardev pty,id=virtiocon0 -device virtconsole\
-drive file=core-image-minimal-qemux86.ext4,if=virtio,format=ra\
--append "root=/dev/vda loglevel=15 console=tt\
-nographic \
-m 256 -s -S
gdb /home/wt/gitrepo/linux/vmlinux
3. set breakpoint on 0x10200:
// output of gdb
(gdb) b *0x10200
Breakpoint 1 at 0x10200
4. continue on gdb:
// output of QEMU
SeaBIOS (version 1.15.0-1)
iPXE (https://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+0FF8B2A0+0FECB2A0
Booting from ROM..
// output of gdb
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000000000000000 in fixed_percpu_data ()
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000000000000000 in fixed_percpu_data ()
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies