求教关于c/c crash report的问题

时间:2008-05-09 19:07:01   来源:论坛整理  作者:  编辑:chinaitzhe
在Linux上,简单c/c 程序碰到致命内存错误的时候,缺省的只打出一条Segmentation fault. Windows上只有提示框。这太不方便追踪错误了,尤其当程序在客户环境中无法调试的时候。在Linux里有core dump的办法可以返还给dev来追踪,但是一些系统缺省这个设置并不是打开的。
所以产品自带的错误报告变得有意义。
那么在c/c 的环境里,有没有什么标准的解决方案?有没有什么成熟的类库可以实现这个需求?比如截获某些signal然后像java那样清楚地记录call stack。
网友回复:
C/C code





Code highlighting produced by Actipro CodeHighlighter (freeware)

http://www.CodeHighlighter.com/





vs2005 支持dmp文件,能够保存程序 crash 时的调用堆栈信息



无论debug / release 都可以使用



单得到dmp文件时,直接可以用vs2005打开,假如你有源代码那就可以调试



前提要求是dmp文件生成的程序要和你的程序代码版本匹配








网友回复:
C/C code





Code highlighting produced by Actipro CodeHighlighter (freeware)

http://www.CodeHighlighter.com/





安装vs2005的msdn,搜索dumps 

它会告诉你如何建立dump文件





下面给你贴一段



Dump files, previously called crash dumps, allow you to save program information for debugging at a later time. The Visual Studio debugger can load dump files created by Visual Studio or by other programs that generate dump files. You can also save dump files, but only from native applications.



Dumps can be particularly useful if you are testing a program on a machine that does not have source files or PDB Files (C  ). When a crash occurs, you can save a dump file on that machine and debug it later on the build machine or another machine that has the source files and PDBs.



How to Create a Dump

There are several ways to create a dump:



While you are debugging a native process in Visual Studio, you can save a dump from the Debug menu. For more information, see How to: Save and Open Dump Files.



If you have Just-In-Time debugging enabled, you can attach to a crashed process running outside the debugger, break the process, then save a dump file. For more information, see How to: Save and Open Dump Files. 



You can create a dump using the UserDump utility, which is part of the OEM Support Tools package. You can download a copy from http://download.microsoft.com/download/win2000srv/Utility/3.0/NT45/EN-US/Oem3sr2.zip.



You can create a dump using the Autodump  (AD ) utility, which is part of Microsoft Debugging Tools for Windows. You can download a copy from http://www.microsoft.com/ddk/debugging.








网友回复:Linux 下面自己通过一个启动脚本,设置 ulimit -c unlimited 就可以得到 core 文件,不过这个也跟运行目录是否有写权限有关。

跨平台的标准解决方案没有。
网友回复:btw, i'm not sure if this still works or not..
http://bbs.chinaunix.net/viewthread.php?tid=829206&extra=page=1
网友回复:多谢Chiyer的dump信息,当然,dump最完善了,而现在想要得就是直观的可见log.在linux上,也有dump,就像wolf0403所说,但是很多系统上这个设置都是缺省关闭的。
所以假如产品自己生成crashdump最好了。wolf0403贴的那个link相当于产品正常的log,这个不错,但是还是
不能代替crash log。
这种直观小巧的crash log report, 跨平台得不好做,但是针对单个平台的还是可以做成库的。不知为什么没有
发现类似功能的库呢,因为这个功能非常鸡肋?
网友回复:因为假如生成让调试器使用的 dump log,那么必然是编译器相关的,别说跨平台,跨编译器平台都难。
网友回复:在http://topic.csdn.net/u/20080507/12/1522d46f-826e-48b1-8bbd-9ed77e1ed800.html找到一个linux上的文章,
结贴散分,thank wolf0403
关键字:求教,crash,report,问题,

文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面