GDB调试benos的方法
服务端gdb命令代码
rlk@rlk:BenOS$ qemu-system-aarch64 -machine raspi4 -serial mon:stdio -nographic -kernel benos.bin -S -s
Welcome BenOS!
客户端gdb命令代码
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000080000 src/boot.S:7
breakpoint already hit 1 time
2 breakpoint keep y 0x0000000000080028 src/boot.S:22
breakpoint already hit 1 time
3 breakpoint keep y 0x0000000000080084 in uart_recv at src/pl_uart.c:17
breakpoint already hit 23 times
这时服务端显示
rlk@rlk:BenOS$ qemu-system-aarch64 -machine raspi4 -serial mon:stdio -nographic -kernel benos.bin -S -s
Welcome BenOS!
由于在串口死循环处打断点
17 while (readl(U_FR_REG) & (1<<4))
所以可以打印字符继续互动在服务端和客户端调试

文章描述了如何使用GDB进行远程调试BenOS的过程,特别是在服务端运行qemu-system-aarch64模拟器,并设置断点在特定源码行,如boot.S和pl_uart.c中的功能。通过在串口死循环处打断点,允许在服务端和客户端间进行交互式调试。
5189

被折叠的 条评论
为什么被折叠?



