1:在配置文件里面设置生成core文件
# 设置coredump产生core文件
ulimit -c unlimited
2:执行配置文件
[XX@linux-81 rec]$ . profile
3:编写测试程序,产生core文件--
其中"9015"是进程号
[
XX@linux-81 rec]$ ls
1 1.c core.9015 profile
4:查看core文件
[
XX@linux-81 rec]$ gdb 1 core.9015
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
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:
<
Reading symbols from /home/liuwx/rec/1...(no debugging symbols found)...done.
[New Thread 9015]
Missing separate debuginfo for
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/b5/d86fbcf0ccb03331e6c7c73897b96845e0a4eb
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Core was generated by `./1'.
Program terminated with signal 11, Segmentation fault.
#0 0x00000000004004e8 in sub ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.x86_64
(gdb) bt
#0 0x080482fd in core_test () at 1.c:7
#1 0x08048317 in main () at 1.c:12
#2 0x42015574 in __libc_start_main () from /lib/tls/libc.so.6
可以看出问题是出现在第七行...
阅读(1012) | 评论(0) | 转发(0) |