gdb不知为何显示2次析构
gdb不知为何显示2次析构
(金庆的专栏 2016.11)
gdb 显示2次 A::~A():
(gdb) bt
#0 A::~A (this=0x602010, __in_chrg=<optimized out>) at main.cpp:10
#1 0x0000000000400a96 in A::~A (this=0x602010, __in_chrg=<optimized out>)
at main.cpp:12
#2 0x00000000004009c0 in main () at main.cpp:18
代码如下:
class A
{
public:
A() {}
virtual ~A()
{
cout << "~A()" << endl;
}
};
int main()
{
A* p = new A;
delete p;
return 0;
}
打断点显示:2 locations:
(gdb) b A::~A
Breakpoint 1 at 0x400a40: A::~A. (2 locations)
完整的 gdb 输出:
g++ -g main.cpp
[jinq@localhost test]$ gdb a.out
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jinq/test/a.out...done.
(gdb) b A::~A
Breakpoint 1 at 0x400a40: A::~A. (2 locations)
(gdb) run
Starting program: /home/jinq/test/a.out
Breakpoint 1, A::~A (this=0x602010, __in_chrg=<optimized out>) at main.cpp:12
12 }
Missing separate debuginfos, use: debuginfo-install glibc-2.17-106.el7_2.8.x86_64 libgcc-4.8.5-4.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64
(gdb) bt
#0 A::~A (this=0x602010, __in_chrg=<optimized out>) at main.cpp:12
#1 0x00000000004009c0 in main () at main.cpp:18
(gdb) s
Breakpoint 1, A::~A (this=0x602010, __in_chrg=<optimized out>) at main.cpp:10
10 {
(gdb) bt
#0 A::~A (this=0x602010, __in_chrg=<optimized out>) at main.cpp:10
#1 0x0000000000400a96 in A::~A (this=0x602010, __in_chrg=<optimized out>)
at main.cpp:12
#2 0x00000000004009c0 in main () at main.cpp:18
(gdb) ^CQuit
(gdb)
虚析构函数并且是delete才这样。
Also see: http://lists.qt-project.org/pipermail/interest/2015-November/019691.html
已提交Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20837
gdb不知为何显示2次析构的更多相关文章
- gdb调试3_显示变量 和 数组
http://www.cnblogs.com/shipfi/archive/2008/08/04/1260293.html 感谢作者! 程序变量查看文件中某变量的值:file::variablefu ...
- GDB命令行最基本操作
程序启动: A.冷启动 gdb program e.g., gdb ./cs gdb –p pid e.g., gdb –p `pidof c ...
- GDB配置与.gdbinit的编写
GDB配置与.gdbinit的编写 当 GDB(即 GNU Project Debugger)启动时,它在当前用户的主目录中寻找一个名为 .gdbinit 的文件:如果该文件存在,则 GDB 就执行该 ...
- GDB详解
1 简介 2 生成调试信息 3 启动GDB 的方法 4 程序运行上下文 4.1 程序运行参数 4.2 工作目录 4.3 程序的输入输出 5 设置断点 5.1 简单断点 5.2 多文件设置断点 5.3 ...
- GDB调试精粹及使用实例(转)
一:列文件清单 1. List (gdb) list line1,line2 二:执行程序 要想运行准备调试的程序,可使用run命令,在它后面可以跟随发给该程序的任何参数,包括标准输入和标准输出说明符 ...
- GDB教程详解
GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像VC.BCB等IDE的调试,但如果你是在UNIX平台下做软件,你会发现GDB这个调试工具有比VC ...
- GDB中文手册
用GDB调试程序GDB概述 2使用GDB 5GDB中运行UNIX的shell程序 8在GDB中运行程序 8调试已运行的程序 两种方法: 9暂停 / 恢复程序运行 9一.设置断点(BreakPoint) ...
- Linux高级编程--04.GDB调试程序(查看数据)
查看栈信息 当程序被停住了,你需要做的第一件事就是查看程序是在哪里停住的.当你的程序调用了一个函数,函数的地址,函数参数,函数内的局部变量都会被压入"栈"(Stack)中.你可以用 ...
- GDB调试器使用总结
概述:GDB是linux下调试程序的神器,做为linux程序员,如果不能熟练的使用GDB进行程序调试,那将是很失败的事情.强大的功能使GDB的使用也变得比较复杂,如果是初学者肯定会比繁杂的命令吓到.下 ...
随机推荐
- digest-MD5认证
digest-MD5认证机制是基于MD5算法的LINUX安全机制认证. 会比较用户端传送的杂凑值与使用者密码的杂凑值,以认证用户端. 但由于此机制必须读取使用者密码,因此,所有想透过digest-MD ...
- 谈mysql优化
公司订单系统每日订单量庞大,有很多表数据超千万.公司SQL优化这块做的很不好,可以说是没有做,所以导致查询很慢. 节选某个功能中的一句SQL EXPLAIN查看执行计划,EXPLAIN + SQL 查 ...
- springboot集成jpa
spring data jpa简介 spring data jpa是spring基于hibernate及jpa规范封装出来的一套持久层框架.该框架极大的降低了开发者工作量,提升开发效率.提供的关键字可 ...
- JS实现手机访问pc网址自动跳转到wap网站
之前写pc端直接跳转wap端一直是后端java写的,跟js一样都是根据navigator.userAgent来判断设备是电脑还是手机的,我知道这种前端也可已完成的功能,只是后台比较强势,本人本着以和为 ...
- [LeetCode] Max Stack 最大栈
Design a max stack that supports push, pop, top, peekMax and popMax. push(x) -- Push element x onto ...
- [LeetCode] Increasing Subsequences 递增子序列
Given an integer array, your task is to find all the different possible increasing subsequences of t ...
- [JSOI2008]Blue Mary开公司
Description Input 第一行 :一个整数N ,表示方案和询问的总数. 接下来N行,每行开头一个单词“Query”或“Project”. 若单词为Query,则后接一个整数T,表示Bl ...
- ●UOJ 21 缩进优化
题链: http://uoj.ac/problem/21 题解: ...技巧题吧 先看看题目让求什么: 令$F(x)=\sum_{i=1}^{n}(\lfloor a[i]/x \rfloor +a[ ...
- POJ - 3264:Balanced Lineup
ST表模版 #include<cstdio> #include<cstdlib> #include<algorithm> #include<cstring&g ...
- UVALive4727:jump
约瑟夫环变式 设f[i][j]表示处理i个人,按照处理顺序,倒数第j个人是谁 则有f[i][j]=(f[i-1][j]+k)%i #include<cstdio> #include< ...