[转] 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查看程序 执行 ...
随机推荐
- Swift - 32 - 函数类型
//: Playground - noun: a place where people can play import UIKit func add(a:Int, b:Int) -> Int { ...
- Linux网络配置命令ifconfig输出信息解析
eth0 Link encap:Ethernet HWaddr 00:1e:4f:e9:c2:84 inet addr:128.224.163.153 Bcast:128.224.163 ...
- 如何使用LoadRunner监控Windows
1.监视连接前的准备工作 1)进入被监视windows系统,开启以下二个服务Remote Procedure Call(RPC) 和Remote Registry Service (开始—)运行 ...
- 文件上传-html
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>文件 ...
- underscorejs-pluck学习
2.14 pluck 2.14.1 语法: _.pluck(list, key) 2.14.2 说明: pluck方法根据key对list数组中的每个对象进行检索,返回检索成功的属性值,否则返回und ...
- C# ORM—Entity Framework 之Code first(代码优先)(二)
一.Entity Framework Code first(代码优先)使用过程 1.1Entity Framework 代码优先简介 不得不提Entity Framework Code First这个 ...
- Quartz2D使用
使用Quartz2D前 先导入QuartzCore.framework //划线 //1.获取图形上下文 CGContextRef ctx=UIGraphicsGetCurrentContext() ...
- ionic中使用Cordova Uglify 压缩js与css
参照:https://www.npmjs.com/package/cordova-uglify 安装:npm install cordova-uglify 安装完成之后,打开: hooks/uglif ...
- 使用 Spring Boot 快速构建 Spring 框架应用,PropertyPlaceholderConfigurer
Spring 框架对于很多 Java 开发人员来说都不陌生.自从 2002 年发布以来,Spring 框架已经成为企业应用开发领域非常流行的基础框架.有大量的企业应用基于 Spring 框架来开发.S ...
- 修改一行和修改全表的TX锁
SQL> select * from v$mystat where rownum<2; SID STATISTIC# VALUE ---------- ---------- ------- ...