我已经使用 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/