linux - gdb 无法解析 linux 内核的符号

标签 linux linux-kernel gdb

我已经使用 VMware Workstation 设置了 Linux 内核调试环境。但是当我尝试连接正确连接的 gdb 时,我无法设置任何断点或检查任何内核符号。

目标机器(调试对象)Ubuntu 18: 我已经使用以下指令编译了 linux 内核 5.0-0:

CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_REDUCED is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_DEBUG_FS=y
# CONFIG_DEBUG_SECTION_MISMATCH is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set

还有我的 VMX 文件配置:

debugStub.listen.guest64 = "TRUE"
debugStub.listen.guest64.remote="TRUE"

之后我将 vmlinux 转移到调试机器并使用 gdb:

bash$ gdb vmlinux
gdb-peda$ target remote 10.251.31.28:8864
Remote debugging using 10.251.31.28:8864
Warning: not running or target is remote
0xffffffff9c623f36 in ?? ()
gdb-peda$ disas sys_open
No symbol "do_sys_open" in current context.

最佳答案

首先需要安装对应内核版本的kernel-debug-devel、kernel-debuginfo、kernel-debuginfo-common。 然后你可以使用 crash 实用程序调试内核,内核内部使用 gdb

关于linux - gdb 无法解析 linux 内核的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55104119/

相关文章:

linux-kernel - 使用 gdb 进行远程 Linux 内核调试时未命中断点

gdb - 查看以前的 gdb 命令

c++ - SDL2 - 从表面创建纹理的问题(屏幕截图)

linux - Tomcat 正常启动但不监听 8080

linux - 安排本月最后一个星期日的 crontab 作业

linux - netfilter 钩子(Hook)没有检索完整的数据包

c - 如何在内核模块的相同偏移量中预留内存

c - 函数签名中的 restrict 是什么意思?

regex - Sed:如何替换在文件中找到特定模式后找到的字符串

c++ - GDB 在函数末尾中断而不是指定的断点