如何使 Qt Creator 的调试器显示 C++ 的内容? OS X 中的向量?
我正在编写一个广泛使用向量的程序,并且是第一次在 Mac OS X 10.6.6 上使用 Qt Creator 2.0.1 进行开发。
当我调试时,我可以在 Locals and Watchers 窗口中很好地看到文字和数组,但是一旦我去扩展向量(在本例中为 Student 类型) >,我得到这棵树:
与我一起工作的另一个人正在使用相同版本的 Qt Creator在 Ubuntu 上,可以很好地看到向量的内容。我做错了什么?
这是他的调试器:
I'm writing a program that makes extensive use of vectors and am developing with Qt Creator 2.0.1 on Mac OS X 10.6.6 for the first time.
As I am debugging, I can see literals and arrays just fine in the Locals and Watchers
window, but as soon as I go to expand a vector, in this case of type Student
, I get this tree:
The other person I am working with on this is using the same version of Qt Creator on Ubuntu and can see the contents of the vectors just fine. What am I doing wrong?
This is his debugger:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
QtCreator 2.6 支持 Mac FSF GDB (7.5)。 FSF GDB支持python,可以让qtcreator正确显示QVector、QSet、QList、QString等。可以从macports下载。
安装 FSF GDB 7.5:
授予 FSF GDB 调试应用程序的权限:
如果未找到 gdb-cert,请单击下面的链接创建 gdb-cert,然后按照“创建证书”的说明进行操作:
http://sourceware.org/gdb/wiki/BuildingOnDarwin
如果您不授予 ggdb 权限,您将得到:
在 QtCreator 中更改套件调试器
将路径从 /usr/bin/gdb 更改为 /opt/local/bin/ggdb
默认情况下,FSF GDB 无法正确处理断点,因为 mac clang++ 不导出调试符号。要导出调试符号,需要手动运行 dsymutil。幸运的是,使用 qmake 链接程序后,dysmutil 命令可以自动运行。在 .pro 文件中添加以下行:
<前><代码>macx {
配置(调试,调试|发布){
QMAKE_POST_LINK = dsymutil \"MyApp.app/Contents/MacOS/MyApp\"
}
}
QtCreator 2.6 has support for Mac FSF GDB (7.5) support. FSF GDB supports python which allows qtcreator to properly display QVector, QSet, QList, QString, etc. It can be download from macports.
To install FSF GDB 7.5:
Give FSF GDB permission to debug applications:
If gdb-cert isn't found, create a gdb-cert by clicking on the link below, and follow the directions for "Creating a certificate":
http://sourceware.org/gdb/wiki/BuildingOnDarwin
If you don't give permission to ggdb, you'll get a:
Change the kit debugger in QtCreator
Change the path from /usr/bin/gdb to /opt/local/bin/ggdb
By default FSF GDB fails to handle breakpoints correctly because mac clang++ doesn't export debug symbols. To export the debugging symbols, dsymutil needs to be run manually. Luckly, dysmutil command can be run automatically after link the program using qmake. Add the following lines in your .pro file:
您需要构建调试助手。应该在“工具”->“工具”下选项...
构建调试助手后,您还可以可视化 std::string、QString 和容器。
在您选择要使用的 Qt 版本的同一位置应该有一个重建按钮。
http://www.qtcentre.org/threads/31862-quot-No-valid-Qt-version-set.-Set-one-in-Tools-Options-quot-Windows-QtCreator
You need to build the debugging helper. Should be under Tools -> Options ...
Once the debugging helper is built, you can visualize std::string, QString and containers as well.
There should be a rebuild button in same the place as where you choose which version of Qt to use.
http://www.qtcentre.org/threads/31862-quot-No-valid-Qt-version-set.-Set-one-in-Tools-Options-quot-Windows-QtCreator
这两个答案都有点正确:一个不能在 mac 上使用基于 python 的调试助手,但仍然有一个可以与 Apple 的 gdb 一起使用的 C++ 版本。
The two answers are sort of right: one cannot use the python based debugging helpers on mac, still there is a C++ version of it that works with Apple's gdb.