这是正常的吗?我发誓直到最近才设置了1个断点。如何使它只在我运行的文件中设置断点而不是源文件。
(gdb) break main
Breakpoint 1 at 0x1dbf
Breakpoint 2 at 0x1ed8: file arrays.c, line 17.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb)
答案 0 :(得分:2)
有多个主要符号:)或许可以在gdb或
中查看“info breakpoints”objdump -C -t myprog
了解原因/何处。
使用cscope以交互方式搜索声明。
ctags -R . && grep -w main tags
[ -x /usr/bin/vim ] && vim +'tj main'
如果您安装了ctags(以及可选的vim)
,也应该会有所帮助如果一切都失败了,强力grep -RIw main .
应该有效。如果即使失败了,你也会发现自己有一个非常奇怪的外部头文件#defines,甚至是一个带有多余主符号的(静态)库。通过预处理来源强制搜索main
标识符:
find -name '*.c' -print0 | xargs -0n1 -iQ cpp -I/usr/include/... -DDEBUG Q Q.ii
find -name '*.c.ii' -print0 | xargs grep -wI main
(将-I/usr/include/... -DDEBUG
替换为相关的预处理器定义)