当前位置: 技术问答>linux和unix
使用gdb看core的问题
来源: 互联网 发布时间:2015-10-25
本文导语: 我在solaris下用gdb -c core查看函数栈. 但函数名都是?: --- # gdb -c 94048.001.866.core GNU gdb 6.0 Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it ...
我在solaris下用gdb -c core查看函数栈.
但函数名都是?:
---
# gdb -c 94048.001.866.core
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.7".
Attaching to process 94048
procfs:3571 -- /proc/94048: No such file or directory.
do_attach: couldn't open /proc file for process 94048
Core was generated by `./kfcm120'.
Program terminated with signal 11, Segmentation fault.
#0 0xfed706f0 in ?? ()
(gdb) where
#0 0xfed706f0 in ?? ()
#1 0xff12362c in ?? ()
#2 0xff115550 in ?? ()
----------------------
这样的问题, 在别的平台也有类似的, 请问如何看到函数名?
thx
但函数名都是?:
---
# gdb -c 94048.001.866.core
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.7".
Attaching to process 94048
procfs:3571 -- /proc/94048: No such file or directory.
do_attach: couldn't open /proc file for process 94048
Core was generated by `./kfcm120'.
Program terminated with signal 11, Segmentation fault.
#0 0xfed706f0 in ?? ()
(gdb) where
#0 0xfed706f0 in ?? ()
#1 0xff12362c in ?? ()
#2 0xff115550 in ?? ()
----------------------
这样的问题, 在别的平台也有类似的, 请问如何看到函数名?
thx
|
dbx yourprogram core
|
这个没办法,函数的符号已经被strip掉了,这样的话是没办法看得……
|
编译的时候加-g 选项,另外把该文件和源代码放在一个目录
|
不要使用-O优化选项
|
把这个core拷到你的编译的可执行文件同一目录下
然后gdb -c core文件名 可执行文件名
应该可以(linux下面)
然后gdb -c core文件名 可执行文件名
应该可以(linux下面)