使用模板调试 C++ 代码,使用 gdb 调试 STL
这里的 gdb 用户如何看待它在使用模板和 STL 调试代码方面的功能?
What do gdb users here think about its capabilities in regards to debugging code with templates and STL?
您是否使用任何技巧使调试更简单?也许是一些 Python 脚本?或者你对gdb目前的方式满意吗(6.x版,7.x还没试过)?
Do you use any tricks to make the debugging any simpler? Perhaps some Python scripts? Or are you satisfied the way it is at present in gdb (ver 6.x, haven't tried 7.x yet)?
谢谢.
推荐答案
我假设您的意思是更好地可视化 STL 代码(而不是 调试模式 提供安全的迭代器和额外的运行时检查).我不确定你是否看过这些帖子:
I am assuming that you mean visualizing STL code better (and not the debug mode which give safe iterators and additional runtime checks). I am not sure if you have looked at these posts:
- GNU GCC 文档:调试支持
使用 gdb
从 7.0 版开始,GDB 支持在 Python 中编写漂亮的打印机.用于 STL 类的漂亮打印机随 GCC 4.5.0 版本一起分发.这些打印机的最新版本始终可以在 libstdc++ svn 存储库中找到.要启用这些打印机,请将最新的打印机签出到本地目录:
Starting with version 7.0, GDB includes support for writing pretty-printers in Python. Pretty printers for STL classes are distributed with GCC from version 4.5.0. The most recent version of these printers are always found in libstdc++ svn repository. To enable these printers, check-out the latest printers to a local directory:
- 漂亮的打印 STL 列表
另外,如果可能的话,尝试使用 KDevelop/DDD -- 他们确实有帮助.
Also, try using KDevelop/DDD if possible -- they do help.
相关文章