Chinaunix首页 | 论坛 | 博客
  • 博客访问: 963366
  • 博文数量: 58
  • 博客积分: 10192
  • 博客等级: 上将
  • 技术积分: 1845
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-22 21:24
文章分类

全部博文(58)

文章存档

2011年(11)

2010年(12)

2009年(20)

2008年(15)

分类: C/C++

2009-04-02 08:55:36

先下载gdb_stl_utils.tar.gz, extract it, and run make. This will compile and install the necessary files in ~/.gdb (edit the Makefile if you want to use a different directory). To use the p_stl_* functions, add:

source ~/.gdb/gdb_stl_utils

to your ~/.gdbinit.

I've tested this with GCC 3.3.3 and 3.4.0, and GDB 6.0. Let me know if you have any problems with it!

如何使用请查看gdbint文件,里面描述得很详细。

注意:
比如打印vector:
1.(gdb) p vec
$1 = {
  >> = {
    _M_impl = {
      > = {
        <__gnu_cxx::new_allocator> = {}, },
      members of std::_Vector_base >::_Vector_impl:
      _M_start = 0x92ec040,
      _M_finish = 0x92ec058,
      _M_end_of_storage = 0x92ec060
    }
  }, }

2.(gdb) p_stl_vector vec->_M_impl(_M_start和_M_finish位于_M_impl具体情况可能不同)
Vector Element 0:  $2 = 0
Vector Element 1:  $3 = 1
Vector Element 2:  $4 = 2
Vector Element 3:  $5 = 3
Vector Element 4:  $6 = 4
Vector Element 5:  $7 = 100

文件:gdb_stl_utils.tar.gz
大小:2KB
下载:下载



阅读(8316) | 评论(0) | 转发(0) |
0

上一篇:编译PF_RING相关资料资料

下一篇:C++中三种

给主人留下些什么吧!~~