使用gdb跟踪分析一个系统调用内核函数(以 sys_chmod为例)
- 启动调试内核
qemu -kernel linux-3.18.6/arch/x86/boot/bzImage -initrd rootfs.img -s -S

- gdb 调试
另开 shell
1 | gdb |


- 系统启动

- 设置断点 sys_chmod
(gbd)b sys_chmod

- 执行命令 chmod

- 触发 gdb 中断

- 单步执行
(gbd) s

- 继续执行
(gbd) c

- 系统调用完成,返回

##system_call中断处理过程图解
