免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2830 | 回复: 1
打印 上一主题 下一主题

[C++] GDB bt为何不显示源文件名和行号,有加-g编译 [复制链接]

论坛徽章:
9
程序设计版块每日发帖之星
日期:2016-02-13 06:20:00数据库技术版块每日发帖之星
日期:2016-06-15 06:20:00数据库技术版块每日发帖之星
日期:2016-06-16 06:20:00数据库技术版块每日发帖之星
日期:2016-06-18 06:20:00程序设计版块每日发帖之星
日期:2016-06-27 06:20:00程序设计版块每日发帖之星
日期:2016-07-09 06:20:00IT运维版块每日发帖之星
日期:2016-07-15 06:20:00IT运维版块每日发帖之星
日期:2016-07-27 06:20:00程序设计版块每日发帖之星
日期:2016-08-18 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-06-20 13:59 |只看该作者 |倒序浏览
本帖最后由 mordorwww 于 2016-06-20 14:45 编辑

Quit anyway? (y or n) y
[root@com2 wb]# g++ m.cpp -o m -std=c++0x -g
[root@com2 wb]#
[root@com2 wb]#
[root@com2 wb]#
[root@com2 wb]#
[root@com2 wb]#
[root@com2 wb]#
[root@com2 wb]#
[root@com2 wb]# gdb m
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 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/wb/m...done.
(gdb) r
Starting program: /home/wb/m
MyString() called
char str  MyString(const char* p) cons is  called:  Hellomove
Copy Assignment is called! source: Hellomove
str , return...
*** glibc detected *** /home/wb/m: double free or corruption (fasttop): 0x0000000000602010 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3590a76166]
/home/wb/m[0x400d8a]
/home/wb/m[0x400b6d]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x3590a1ed1d]
/home/wb/m[0x400a19]
======= Memory map: ========
00400000-00402000 r-xp 00000000 fd:02 14819880                           /home/wb/m
00601000-00602000 rw-p 00001000 fd:02 14819880                           /home/wb/m
00602000-00623000 rw-p 00000000 00:00 0                                  [heap]
31b4000000-31b4016000 r-xp 00000000 fd:00 1179736                        /lib64/libgcc_s-4.4.7-20120601.so.1
31b4016000-31b4215000 ---p 00016000 fd:00 1179736                        /lib64/libgcc_s-4.4.7-20120601.so.1
31b4215000-31b4216000 rw-p 00015000 fd:00 1179736                        /lib64/libgcc_s-4.4.7-20120601.so.1
3590200000-3590220000 r-xp 00000000 fd:00 1179766                        /lib64/ld-2.12.so
359041f000-3590420000 r--p 0001f000 fd:00 1179766                        /lib64/ld-2.12.so
3590420000-3590421000 rw-p 00020000 fd:00 1179766                        /lib64/ld-2.12.so
3590421000-3590422000 rw-p 00000000 00:00 0
3590a00000-3590b8b000 r-xp 00000000 fd:00 1179791                        /lib64/libc-2.12.so
3590b8b000-3590d8a000 ---p 0018b000 fd:00 1179791                        /lib64/libc-2.12.so
3590d8a000-3590d8e000 r--p 0018a000 fd:00 1179791                        /lib64/libc-2.12.so
3590d8e000-3590d8f000 rw-p 0018e000 fd:00 1179791                        /lib64/libc-2.12.so
3590d8f000-3590d94000 rw-p 00000000 00:00 0
3591a00000-3591a83000 r-xp 00000000 fd:00 1179980                        /lib64/libm-2.12.so
3591a83000-3591c82000 ---p 00083000 fd:00 1179980                        /lib64/libm-2.12.so
3591c82000-3591c83000 r--p 00082000 fd:00 1179980                        /lib64/libm-2.12.so
3591c83000-3591c84000 rw-p 00083000 fd:00 1179980                        /lib64/libm-2.12.so
3bfdc00000-3bfdceb000 r-xp 00000000 fd:02 15866974                       /home/wb/server-hbase-50threads/lib/libstdc++.so.6
3bfdceb000-3bfdeea000 ---p 000eb000 fd:02 15866974                       /home/wb/server-hbase-50threads/lib/libstdc++.so.6
3bfdeea000-3bfdef2000 r--p 000ea000 fd:02 15866974                       /home/wb/server-hbase-50threads/lib/libstdc++.so.6
3bfdef2000-3bfdef4000 rw-p 000f2000 fd:02 15866974                       /home/wb/server-hbase-50threads/lib/libstdc++.so.6
3bfdef4000-3bfdf09000 rw-p 00000000 00:00 0
7ffff7fe7000-7ffff7fec000 rw-p 00000000 00:00 0
7ffff7ffb000-7ffff7ffe000 rw-p 00000000 00:00 0
7ffff7ffe000-7ffff7fff000 r-xp 00000000 00:00 0                          [vdso]
7ffffffea000-7ffffffff000 rw-p 00000000 00:00 0                          [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Program received signal SIGABRT, Aborted.
0x0000003590a32925 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.x86_64 libgcc-4.4.7-4.el6.x86_64
(gdb) bt
#0  0x0000003590a32925 in raise () from /lib64/libc.so.6
#1  0x0000003590a34105 in abort () from /lib64/libc.so.6
#2  0x0000003590a70837 in __libc_message () from /lib64/libc.so.6
#3  0x0000003590a76166 in malloc_printerr () from /lib64/libc.so.6
#4  0x0000000000400d8a in MyString::~MyString() ()
#5  0x0000000000400b6d in main ()
(gdb) help bt
Print backtrace of all stack frames, or innermost COUNT frames.
With a negative argument, print outermost -COUNT frames.
Use of the 'full' qualifier also prints the values of the local variables.

(gdb) full bt
Undefined command: "full".  Try "help".
(gdb) bt full
#0  0x0000003590a32925 in raise () from /lib64/libc.so.6
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::npos = 18446744073709551615
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_max_size = 1152921504606846974
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_empty_rep_storage = 0x3bfdf084e0
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_terminal = 0 L'\000'
#1  0x0000003590a34105 in abort () from /lib64/libc.so.6
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::npos = 18446744073709551615
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_max_size = 1152921504606846974
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_empty_rep_storage = 0x3bfdf084e0
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_terminal = 0 L'\000'
#2  0x0000003590a70837 in __libc_message () from /lib64/libc.so.6
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::npos = 18446744073709551615
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_max_size = 1152921504606846974
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_empty_rep_storage = 0x3bfdf084e0
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_terminal = 0 L'\000'
#3  0x0000003590a76166 in malloc_printerr () from /lib64/libc.so.6
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::npos = 18446744073709551615
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_max_size = 1152921504606846974
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_empty_rep_storage = 0x3bfdf084e0
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_terminal = 0 L'\000'
#4  0x0000000000400d8a in MyString::~MyString() ()
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::npos = 18446744073709551615
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_max_size = 1152921504606846974
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_empty_rep_storage = 0x3bfdf084e0
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_terminal = 0 L'\000'
#5  0x0000000000400b6d in main ()
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::npos = 18446744073709551615
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_max_size = 1152921504606846974
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_empty_rep_storage = 0x3bfdf084e0
        std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_terminal = 0 L'\000'
(gdb) list
78          {
79                      free(_data);
80                      _data = 0;
81          }
82        }
83       };
84
85       int main() {
86        //MyString a;
87        MyString b;
(gdb)

论坛徽章:
89
水瓶座
日期:2014-04-01 08:53:31天蝎座
日期:2014-04-01 08:53:53天秤座
日期:2014-04-01 08:54:02射手座
日期:2014-04-01 08:54:15子鼠
日期:2014-04-01 08:55:35辰龙
日期:2014-04-01 08:56:36未羊
日期:2014-04-01 08:56:27戌狗
日期:2014-04-01 08:56:13亥猪
日期:2014-04-01 08:56:02亥猪
日期:2014-04-08 08:38:58程序设计版块每日发帖之星
日期:2016-01-05 06:20:00程序设计版块每日发帖之星
日期:2016-01-07 06:20:00
2 [报告]
发表于 2016-06-20 14:36 |只看该作者
好久没用gdb了,话说也基本上没用过几次。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP