GNU gdb Fedora (6.8-37.el5) 内核 2.6.18-164.el5
我正在尝试调试我的应用程序。但是,每次我将二进制文件传递给 gdb 时,它都会显示:
(no debugging symbols found)
这是二进制文件的输出,你可以看到它没有被剥离:
vid: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
我正在使用以下 CFLAGS 进行编译:
CFLAGS = -Wall -Wextra -ggdb -O0 -Wunreachable-code
谁能告诉我这里是否遗漏了一些简单的东西?
最佳答案
-g
出现时“找不到调试符号”的最常见原因是存在一些“杂散”的 -s
或 -S
链接行某处的参数。
来自man ld
:
-s
--strip-all
Omit all symbol information from the output file.
-S
--strip-debug
Omit debugger symbol information (but not all symbols) from the output file.
关于c++ - 使用 gdb 时找不到调试符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5244509/