为什么在使用gdb和/ proc / kcore时,我的vmlinux中没有调试符号? [英] Why are there no debug symbols in my vmlinux when using gdb with /proc/kcore?
问题描述
我将所有 CONFIG_DEBUG _
相关选项配置为 y
,但是当我尝试调试内核时,它发现没有调试符号:
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.
这篇关于为什么在使用gdb和/ proc / kcore时,我的vmlinux中没有调试符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!