如何使用 GDB 7.x 查看 STL 容器的内容
I have been using the macro solution, as it is outlined here. However, there is a mention on how to view them without macros. I am referring to GDB version 7 and above.
Would someone illustrate how?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 SVN 获取 python 查看器
将以下内容添加到您的
~/.gdbinit
然后 print 应该可以工作:
在 gdb 中:
要返回到旧视图,请使用
print /r
(/r
表示原始)。另请参阅:http://sourceware.org/gdb/wiki/STLSupport
Get the python viewers from SVN
Add the following to your
~/.gdbinit
Then print should just work:
In gdb:
To get back to the old view use
print /r
(/r
is for raw).See also: http://sourceware.org/gdb/wiki/STLSupport
libstdcxx_printers 包含在最新版本的 GCC 中,因此如果您使用 GCC 4.5 或更高版本,则无需执行任何操作,即可正常打印。
要禁用漂亮打印,请使用
p/r
或print/r
获取“原始”输出。The libstdcxx_printers are included with recent versions of GCC, so if you're using GCC 4.5 or later then you don't need to do anything, pretty printing Just Works.
To disable the pretty printing use
p/r
orprint/r
to get "raw" output.