【发布时间】:2016-07-02 19:37:10
【问题描述】:
我只能访问 C 可执行文件(没有源代码/.c 代码),我需要使用 gdb 来调试它。但我不断收到一条(未找到调试符号)消息。我见过其他类似的问题,但其中大多数建议重新编译源代码(我不能这样做,因为我没有它)或建议进行以下修复(见下文),这对我不起作用。
gdb test
Reading symbols from /usr/bin/test...(no debugging symbols found)...done.
(gdb) b main
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) b 2
No symbol table is loaded. Use the "file" command.
(gdb) file test
Reading symbols from /usr/bin/test...(no debugging symbols found)...done.
(gdb) exec-file test
(gdb) file test
Reading symbols from /usr/bin/test...(no debugging symbols found)...done.
(gdb) b 2
No symbol table is loaded. Use the "file" command.
附带说明,我不能在 main 处中断(奇怪,因为我可以保证这是一个 C 可执行文件)。
我是使用 gdb 的新手,非常迷茫,非常感谢任何帮助。非常感谢!
编辑:
正如@Jean-François Fabre 所建议的,我已将可执行文件名称更改为 foobar,但仍然遇到同样的问题。上面的输出已经更新:
gdb foobar
Reading symbols from /usr/bin/foobar...(no debugging symbols found)...done.
(gdb) b main
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) b 2
No symbol table is loaded. Use the "file" command.
(gdb) file foobar
Reading symbols from /usr/bin/foobar...(no debugging symbols found)...done.
(gdb) exec-file foobar
(gdb) file foobar
Reading symbols from /usr/bin/foobar...(no debugging symbols found)...done.
(gdb) b 2
No symbol table is loaded. Use the "file" command.
【问题讨论】:
-
遵循下面 Jean-Francois 的重命名建议。还有其他命令 [gdb 之外] 可以尝试:
objdump、readelf -s、ldd、file告诉您文件中的符号 [即使调试信息已被剥离,也应该存在这些符号] .b main[in gdb] 的失败可能是/usr/bin/test问题 -
感谢@Craig Estey!这些工具非常有用!
标签: c gdb executable