debugging C++ code with templates and STL with gdb(使用模板调试 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.
这篇关于使用模板调试 C++ 代码,使用 gdb 调试 STL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用模板调试 C++ 代码,使用 gdb 调试 STL


基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- CString 到 char* 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01