我用 C++ 创建了一个 Hello World 示例,并尝试在 Mac OSX 的终端上使用 lldb 对其进行调试。
> lldb a.out
Current executable set to 'a.out' (x86_64).
我可以在名称上设置断点(例如“main”),但不能在行号上设置。如果我尝试
breakpoint set --file test.c --line 5
或
b test.c:5
我明白了
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
文件“test.c”位于当前文件夹中。出了什么问题?
最佳答案
根据 Dwarf Debugging Information Format ,行号,文件位置信息以Dwarf格式存储。这些信息是 GDB 用来设置行号作为断点的信息。
通常,Dwarf 格式信息是由编译器生成的,例如带有-g
选项的GCC。请尝试使用 -g
选项以查看它是否有效。
同时,还有some other debug helpful options in GCC这可能对您更有帮助,例如-g3
,编译器将生成更多详细信息以进行调试,例如宏。
关于c++ - 数据库 : Unable to resolve breakpoint in Hello World example,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29650572/