[转] gdb 查看vector, list, map 内容
转:http://blog.chinaunix.net/uid-13982689-id-34282.html
先下载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
https://github.com/brianchenming/profile/blob/master/.gdb/gdb_stl_utils
http://www.cnblogs.com/wangkangluo1/archive/2011/09/06/2169080.html
[转] gdb 查看vector, list, map 内容的更多相关文章
- map,vector 等容器内容的循环删除问题(C++)
map,vector 等容器内容的循环删除问题(C++) map,vector等容器的循环删除不能用普通的方法删除: for(auto p=list.begin();p!=list.end();p++ ...
- GDB查看内存命令(x命令) 用gdb查看指定地址的内存内容
GDB查看内存命令(x命令) - super119 - 博客园 https://www.cnblogs.com/super119/archive/2011/11/18/2254382.html 可以使 ...
- Java中List,ArrayList、Vector,map,HashTable,HashMap区别用法
Java中List,ArrayList.Vector,map,HashTable,HashMap区别用法 标签: vectorhashmaplistjavaiteratorinteger ArrayL ...
- x/nfu-用gdb查看内存
用gdb查看内存 2007-12-08 12:43 用gdb查看内存 格式: x /nfu <addr> 说明x 是 examine 的缩写 n表示要显示的内存单元的个数 f表示显示方式, ...
- Linux程序宕掉后如何通过gdb查看出错信息
我们在编写服务端程序的时候,由于多线程并且环境复杂,程序可能在不确定条件的情况下宕掉,还不好重新,这是我们如何获取程序的出错信息,一种方法通过打日志,有时候一些错误日志也不能体现出来,这时就用到我们的 ...
- Linux 如何使用gdb 查看core堆栈信息
转载:http://blog.csdn.net/mergerly/article/details/41994207 core dump 一般是在segmentation fault(段错误)的情况下产 ...
- GDB查看内存(x 命令)
gdb查看内存命令 首先使用gdb [YourFileName].c进入gdb界面 使用examine命令,字母缩写为x查看内存地址的值.x命令语法 x/[number][format] <ad ...
- Java容器类List、ArrayList、Vector及map、HashTable、HashMap的区别与用法
Java容器类List.ArrayList.Vector及map.HashTable.HashMap的区别与用法 ArrayList 和Vector是采用数组方式存储数据,此数组元素数大于实际存储的数 ...
- 一起talk GDB吧(第五回:GDB查看信息)
各位看官们.大家好,上一回中我们说的是GDB的调用栈调试功能,而且说了怎样使用GDB进行查看调用 栈.这一回中,我们继续介绍GDB的调试功能:查看信息.当然了.我们也会介绍怎样使用GDB查看程序 执行 ...
随机推荐
- 使用NPOI插件读取excel模版修改数据后保存到新目录新文件中
添加引用: using System.IO; using NPOI.XSSF.UserModel; using NPOI.SS.UserModel; using NPOI.HSSF.UserModel ...
- SqlParameter的用法和好处
关于Sql注入的基本概念,相信不需要多说,大家都清楚,经典的注入语句是' or 1=1--单引号而截断字符串,"or 1=1"的永真式的出现使得表的一些信息被暴露出来,如果sql语 ...
- openstack nova数据库计算结点IP地址
最近遇到一个问题就是在控制结点上查找nova数据库中 select * from compute_nodes\G;中出现IP地址一直是127.0.0.1不是计算结点的IP,就算修改成计算结点的IP,也 ...
- 使用C#连接ORACLE数据库
一.使用OracleClient组件连接Oracle .Net框架的System.Data.OracleClient.dll组件(ADO.Net组件),为连接和使用Oracle数据库提供了很大的方 ...
- 08_linux下安装chrome
首先下载chrome,需要改hosts哦(o(^▽^)o,别告诉我你不会,可以问度娘.谷哥哦) 下载地址:https://dl.google.com/linux/direct/google-chrom ...
- java中加载xml文件方法
this.getclass().getclassloader().getresourceasstream(String file); 可以加载文件,比如xml.
- 人见人爱a*b 杭电2035
求A^B的最后三位数表示的整数.说明:A^B的含义是“A的B次方” Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A= ...
- Serilog with Autofac
http://serilog.net/ ---不错的日志工具 1.直接绑定 builder.Register<ILogger>((c, p) => { return new Log ...
- webpack资料
https://zhuanlan.zhihu.com/p/20367175?columnSlug=FrontendMagazine http://www.cnblogs.com/tugenhua070 ...
- spring-boot 测试
在线项目构建:http://start.spring.io/ 下载:bookpub.zip 导入Idea15.0.1 运行: y@y:bookpub$ ./gradlew clean bootRun ...