KGDB内核配置选项:
打开: CONFIG_KGDB CONFIG_DEBUG_INFO CONFIG_FRAME_POINTER 关闭: CONFIG_STRICT_KERNEL_RWX # CONFIG_STRICT_KERNEL_RWX is not set CONFIG_FRAME_POINTER=y CONFIG_KGDB=y CONFIG_KGDB_SERIAL_CONSOLE=y
目标机命令行参数:
linux /vmlinuz-6.7.0-rc6vec_lbt+ root=/dev/sda3 ro rhgb selinux=0 nokaslr console=ttyS0,115200 kgdboc=ttyS1,115200
目标机启动内核
目标机启动后:
输入命令:echo g > /proc/sysrq-trigger
系统同样会中断,进入假死状态,等待远程gdb的连接
调试机端在内核源码目录执行:
sudo chmod 777 /dev/ttyUSB0 gdb vmlinux set remotelogfile /home/fedora/work/kgdb/linux-loongson/gdb-kgdb.log set serial baud 115200 target remote /dev/ttyUSB0 Remote debugging using /dev/ttyUSB0 break sys_clone c
注意需要保证两台机器的串口是通的,使用如下命令发送数据测试
cat /dev/ttyS1 echo "hello123" > /dev/ttyUSB0 cat /dev/ttyUSB0 echo "hello123" > /dev/ttyS1
标签:KGDB,ttyS1,dev,gdb,设置,ttyUSB0,CONFIG,调试 From: https://www.cnblogs.com/lh03061238/p/18041010