gdb不会在断点startup_32处停止

时间:2018-12-13 11:20:26

标签: linux-kernel gdb

使用qemu和gdb调试Linux内核启动。这是源分支:https://android.googlesource.com/kernel/goldfish/+/android-goldfish-3.18。配置为i386_ranchu_defconfig。这是我使用的步骤:

qemu-system-i386 -kernel ~/aosp/goldfish/arch/x86/boot/bzImage -s -S
gdb ~/aosp/goldfish/vmlinux
(gdb) target remote :1234
0x0000fff0 in ?? ()
(gdb) b startup_32
Breakpoint 1 at 0xc0200000: file arch/x86/kernel/head_32.S, line 96.
(gdb) c
Continuing.

但是该程序不会在startup_32处停止。相反,如果我将startup_32更改为start_kernel,那么它将起作用。

(gdb) b start_kernel
Breakpoint 1 at 0xc0b3672c: file init/main.c, line 498.
(gdb) c
Continuing.

Breakpoint 1, start_kernel () at init/main.c:498
498 {
(gdb) 

为什么程序不会在startup_32处停止?

1 个答案:

答案 0 :(得分:1)

startup_32是引导程序代码的一部分,并且尚未设置虚拟内存,因此尝试在0xc0200000(虚拟内存地址)处中断可能会锁定系统,而内核不会执行该跳转。

start_kernel OTOH,在初始化虚拟内存之后发生。

相关问题