解决报错:cannot locate debugging information for file
内核需要三部分调试信息
1 打开内核module解析
检查/proc/sys/kernel/kptr_restrict
# cat /proc/sys/kernel/kptr_restrict
0
- If the kptr_restrict value is 0, kernel addresses are provided without limitations (recommended).
- If the kptr_restict value is 1, addresses are provided if the current user has a CAP_SYSLOG capability.
- If the kptr_restrict value is 2, the kernel addresses are hidden regardless of privileges the current user has.
2 安装内核debug信息
查看包名
代码语言:javascript复制echo "kernel-debuginfo-common-x86_64-`uname -r`.rpm"
echo "kernel-debuginfo-`uname -r`.rpm"
下载debuginfo
代码语言:javascript复制wget http://debuginfo.centos.org/7/x86_64/kernel-debuginfo-common-x86_64-`uname -r`.rpm
wget http://debuginfo.centos.org/7/x86_64/kernel-debuginfo-`uname -r`.rpm
安装
代码语言:javascript复制yum install kernel-debuginfo-common-x86_64-3.10.0-693.2.2.el7.x86_64.rpm
yum install kernel-debuginfo-3.10.0-693.2.2.el7.x86_64.rpm
3 编译内核
重新编译内核,top-level Makefile增加:
代码语言:javascript复制CFLAGS_KERNEL := -g
CFLAGS := -g
make clean; make to create the vmlinux kernel file with debug information
(可选)4 内核源码
uname -r后找对应版本
https://vault.centos.org/7.4.1708/os/Source/SPackages/
参考