使用带有/proc/kcore 的 gdb 时,为什么我的 vmlinux 中没有调试符号? [英] Why are there no debug symbols in my vmlinux when using gdb with /proc/kcore?
问题描述
我已经为 y
配置了所有与 CONFIG_DEBUG_
相关的选项,但是当我尝试调试内核时,它说没有找到调试符号:
I've configure all CONFIG_DEBUG_
related options to y
,but when I try to debug the kernel,it says no debug symbols found:
gdb /usr/src/linux-2.6.32.9/vmlinux /proc/kcore
Reading symbols from /usr/src/linux-2.6.32.9/vmlinux...(no debugging symbols found)...done.
为什么?
推荐答案
这是我目前最好的猜测:我不知道,没关系.
Here is my best guess so far: I don't know, and it doesn't matter.
我不知道为什么 GDB 会打印消息(未找到调试符号)".在构建自己的内核时,我实际上已经看到了这一点.我将内核配置为使用调试符号,但 GDB 在查看内核映像时仍会打印此消息.我从不费心去研究它,因为我的图像仍然可以很好地调试.尽管有消息,GDB 仍然可以反汇编函数、添加断点、查找符号和单步执行函数.我从来没有注意到缺少调试功能.我猜同样的事情也发生在你身上.
I don't know why GDB is printing the message "(no debugging symbols found)". I've actually seen this when building my own kernels. I configure a kernel to use debug symbols, but GDB still prints this message when it looks at the kernel image. I never bothered to look into it, because my image can still be debugged fine. Despite the message, GDB can still disassemble functions, add breakpoints, look up symbols, and single-step through functions. I never noticed a lack of debugging functionality. I'm guessing that the same thing is happening to you.
根据您对问题的评论,您似乎在使用调试器搜索错误的符号.系统调用处理程序以 sys_
前缀开头,但您无法通过查看代码来判断.宏 SYSCALL_DEFINE4(ptrace, ...)
只是最终将函数声明为 asmlinkage long sys_ptrace(...)
,尽管如果你有它会做一些其他疯狂的事情ftrace 已启用.
Based on the your comments to the question, it looks like you were searching for the wrong symbol with your debugger. System call handlers start with a prefix of sys_
, but you can't tell from looking at the code. The macro SYSCALL_DEFINE4(ptrace, ...)
just ends up declaring the function as asmlinkage long sys_ptrace(...)
, although it does some other crazy stuff if you have ftrace enabled.
这篇关于使用带有/proc/kcore 的 gdb 时,为什么我的 vmlinux 中没有调试符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!