|Subject:||breakpoints don't work for kernel debugging with qemu and gdb|
|Date:||Thu, 18 Feb 2021 18:21:12 +0900|
Thanks for the helps always..
Today I wanted to debug/analyze linux kernel on qemu and ran qemu but the breakpoints don’t seem to work.
When I type ‘cont’ it just goes with booting until it errors. (I wanted to see what happens near the error location, not sure I’ll be able to figure it out though.. )
The command I launched qemu was (just ignore the directories):
../build/aarch64-softmmu/qemu-system-aarch64 -M virt -cpu cortex-a72 -kernel ../../../LinuxDevDrv/linux-5.4.21/arch/arm64/boot/Image -initrd ../../../LinuxDevDrv/linux-5.4.21/testinitrd/myinitrd.img --append "root=/dev/ram init=/init" -m 2048M -nographic -s -S -singlestep
And the command I launched gdb-multiarch is
gdb-multiarch ../../../LinuxDevDrv/linux-5.4.21/vmlinux -x gdbsetup
file ‘gdbsetup’ contains
set architecture aarch64
set serial baud 115200
target remote :1234
I searched the internet and tried things.
For kernel build, CONFIG_DEBUG_INFO, CONFIG_DEBUG_KERNEL, CONFIG_MAGIC_SYSRQ, CONFIG_DEBUG_FS, CONFIG_HAVE_HW_BREAKPOINT, CONFIG_HAVE_MIXED_BREAKPOINTS_REGS were all set to ‘y’,
But CONFIG_MIXED_BREAKPOINTS_REGS was set to ‘no. (just because I couldn’t find the option location. It’s searched with MIXED_BREAKPOINTS but I don’t know the whereabout.). I also set CONFIG_KGDB to ‘y’.
I tried hbreak and softbreak(break). Gdb responds as if breakpoints are well set. But when I type ‘cont’ the virtual machine just boots without stopping at breakpoints.
Can anyone help me with this? Any advice will be appreciated.
|[Prev in Thread]||Current Thread||[Next in Thread]|