只在ubuntu上试过, 以例子说明
强制当前shell sigsegv core dump, 当前shell会退出
$kill -SIGSEGV $$
core file 已经产生
$/var/tmp/cores>ls
core
用gdb列出program name
$gdb
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 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-linux-gnu".
For bug reporting instructions, please see:
(gdb) core-file ./core
[New LWP 1808]
Core was generated by `/usr/local/bin/ksh'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f654584d707 in ?? ()
(gdb) quit
用知道的program名字来load core, 并列出stack
$gdb /usr/local/bin/ksh core
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 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-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /usr/local/bin/ksh...(no debugging symbols found)...done.
[New LWP 1808]
warning: Can't read pathname for load map: Input/output error.
Core was generated by `/usr/local/bin/ksh'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f654584d707 in kill () at ../sysdeps/unix/syscall-template.S:82
82 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0 0x00007f654584d707 in kill () at ../sysdeps/unix/syscall-template.S:82
#1 0x000000000043244c in job_kill ()
#2 0x00000000004322ed in job_walk ()
#3 0x0000000000474ad9 in b_kill ()
#4 0x000000000045d871 in sh_exec ()
#5 0x0000000000412b16 in exfile ()
#6 0x00000000004135ea in sh_main ()
#7 0x0000000000411f7a in main ()