c++ - 数据库 : Unable to resolve breakpoint in Hello World example

标签 c++ macos lldb

我用 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/

相关文章:

swift - 尝试在调试器中打印 Generic.self 会结束 session

c++ - Windows:处理所有线程中的段错误

c++ - 激活记录

c++ - Eclipse CDT + MinGW + GLEW,键入对 `LoadShaders(char const*, char const*)' 的 undefined reference

macos - brew doctor 显示的这些库是什么?

windows - Go - 是否可以像 Go 中的 webkit 一样嵌入 Google Chrome 浏览器?使 Mac、Windows、Linux 兼容?

java - 当页面导航到其他页面时如何关闭 mac 中的 java 控制台?

swift - 在 xcode 中使用调试器 Commend 跳转断点

c++ - fatal error c1083 "afxwin.h"

xcode - 让 lldb 的工作目录为 XCode 的项目目录