先下载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 |
下载: | 下载 |
|
阅读(8437) | 评论(0) | 转发(0) |