为什么生成核心转储文件? [英] Why are core dump files generated?

查看:76
本文介绍了为什么生成核心转储文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,当我运行代码时,通过 Ctrl + \ 终止程序时会生成一个核心转储文件.文件名的格式为core.*.该程序不会突然终止,并且没有分段错误.我相信它是SIGQUIT而不是SIGABRTSIGSEGV.如果我尝试 Ctrl + C Ctrl + Z ,则不会生成.

Sometimes when I run my code, a core dump file is generated when I terminate the program by Ctrl+\. The file name is of the form core.*. The program is not terminating abruptly, and there is no segmentation fault. I believe it is SIGQUIT and not SIGABRT or SIGSEGV. If I try Ctrl+C, or Ctrl+Z, then it is not generated.

谁能说出为什么只有按下 Ctrl + \ 时才生成它?如何避免生成此核心转储文件?核心转储文件有什么用?

Can anyone tell why it is generated only when Ctrl+\ is pressed? How can I avoid this core dump file from being generated? Is there any use for the core dumped file?

推荐答案

当进程由于程序故障而被操作系统终止时,进程将转储核心.发生这种情况的最典型原因是因为程序访问了无效的指针值.鉴于您有一个零星的转储,很可能您使用的是未初始化的指针.

A process dumps core when it is terminated by the operating system due to a fault in the program. The most typical reason this occurs is because the program accessed an invalid pointer value. Given that you have a sporadic dump, it's likely that you are using an uninitialized pointer.

您可以张贴引起故障的代码吗?除了模棱两可的概括之外,很难在不实际看到代码的情况下猜测出什么问题了.

Can you post the code that is causing the fault? Other than vague generalizations it's hard to guess what's wrong without actually seeing code.

关于核心转储实际上是什么,请查看这篇Wikipedia文章:

As for what a core dump actually is, check out this Wikipedia article:

这篇关于为什么生成核心转储文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆