2022年浙江大学操作系统实验lab0-如何调试内核

发布于:2022-12-10 ⋅ 阅读:(278) ⋅ 点赞:(0)

开启调试选项

安装所需包

sudo apt-get install libncurses-dev

生成默认配置

make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- defconfig

启用调试的配置

make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- menuconfig

我们选择kernel hacking选项,进入以后继续选择compile-time checks and compile options, 然后选择Debug information, 在Debug information中选择第二项即可。

image-20220922160042588

image-20220922160057399

image-20220922160110340

之后选择Save

image-20220922160140409

最后退出即可。

编译内核

make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- -j8

实验截图

配置截图

image-20220922160339111

调试截图

单步调试时可以尝试
①在 start_kernel 处设断点
②运行到start_kernel 处
③next
image-20220922162718375

本文含有隐藏内容,请 开通VIP 后查看