QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1096|回复: 13

请问在linux中如何保存应用程序的core file

[复制链接]
发表于 2003-4-25 09:07:28 | 显示全部楼层 |阅读模式
在sun OS下应用程序崩溃后会产生一个core文件,请问在linux下有吗?如果有,要怎么样才能把它保存下来?
发表于 2003-4-25 10:42:06 | 显示全部楼层
会有啊 自动保存在启动目录 不过有什么用??
回复

使用道具 举报

 楼主| 发表于 2003-4-25 10:43:14 | 显示全部楼层
做测试时用,可以把core文件让开发人员调试
回复

使用道具 举报

发表于 2003-4-25 12:48:38 | 显示全部楼层
我每次都把它删掉了,dbxtra对它有用吗
回复

使用道具 举报

发表于 2003-4-25 12:53:42 | 显示全部楼层
哇 有人看这个内存印象来调试的么?没听说真的有人这么牛的。几百k的大小上哪儿找异常去?调试还不如debug出点语句那?
回复

使用道具 举报

 楼主| 发表于 2003-4-25 13:00:13 | 显示全部楼层
我们公司一直这什么搞的,把core attach进去,然后就可以重现当时的状态和定们当时运行的代码行了。
回复

使用道具 举报

发表于 2003-4-25 22:52:06 | 显示全部楼层
[quote:930233c533="wsm"]哇 有人看这个内存印象来调试的么?没听说真的有人这么牛的。几百k的大小上哪儿找异常去?调试还不如debug出点语句那?[/quote]

debug tools can analyze this.
printf is a good method, but it is not always useful.
回复

使用道具 举报

发表于 2003-4-27 10:50:11 | 显示全部楼层
我们好像也一直都是把core直接删掉的,没有用过这个调试的.
那位有经验,谈谈吧.
回复

使用道具 举报

发表于 2003-4-28 00:00:53 | 显示全部楼层
i use it before. but i now only meet oops all the time, never meet it again.  Kan, can u write some pieces?
    
回复

使用道具 举报

 楼主| 发表于 2003-4-28 08:47:09 | 显示全部楼层
楼上的兄弟,小弟我不是干编程的,我也不会用。我公司也只是做版本控制和测试的。
不过,中午我吃饭的时候问一下我做开发的同事,然后我可以写一点。
回复

使用道具 举报

发表于 2003-4-28 08:57:28 | 显示全部楼层
Core files

In order to analyze a core file the following syntax is used: gdb -c (name of core file) (name of binary which core dumped. Example: gdb -c core gdbtest.

The following is the output of gdb when it loads the core file:

bushmaster:~/gdb/c$ gdb -c core gdbtest
GNU gdb 4.17
Copyright 1998 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 "i586-slackware-linux"...
Core was generated by `gdbtest'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.5...done.
Reading symbols from /lib/ld-linux.so.1...done.
#0  0x80485a1 in B () at gdbtest.c:22
22              *number = NULL;
(gdb)

gdb shows what line of code caused the program to core dump. All the commands shown in the previous section can be used to examine the state of the program when it core dumped.

Forcing a Core Dump

While frequently core dumps happen when least desired, it is possible to force Unix to terminate the process's execution and write it to a core file. To force a foreground process to core dump hold down the control key and press the \ key.

If the process is a background process it can either be brought to the foreground and killed using the procedure mentioned or killed with signal 11 (ie kill -11 processid).
回复

使用道具 举报

发表于 2003-4-28 09:57:54 | 显示全部楼层
突然觉得,自己比想象中的更菜...............
回复

使用道具 举报

发表于 2003-4-28 10:05:40 | 显示全部楼层
the more u know, u will feel more unknown than ever.
six years ago, i think i know many many thing; three years ago, i think i know many thing; now, i think i know a little. but i know i am growing up.
回复

使用道具 举报

 楼主| 发表于 2003-4-28 10:57:44 | 显示全部楼层
刚才问的,如果有需要等会可以问的更详细些!
solaris下面用workshop打开就可以。
linux下面用ddd,debuger等等调试工具先打开对应的可执行文件,然后打开core。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-16 02:21 , Processed in 0.041736 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表