简体   繁体   English

linux:如何生成核心文件?

[英]linux: how do I generate a core file?

I'm using Ubuntu 10.04.我正在使用 Ubuntu 10.04。 I run "ulimit -c 999" then I compile and execute ( gcc test.c &&./a.out ) this tiny app:我运行“ulimit -c 999”然后编译并执行( gcc test.c &&./a.out )这个小应用程序:

#include <signal.h>

int main( void )
{
    raise( SIGSEGV );

    return 0;
}

Even though this does print a "Segmentation fault" message, I don't see a core file.即使这确实打印了“分段错误”消息,我也没有看到核心文件。 What have I missed that is preventing the core file from being generated?我错过了什么阻止生成核心文件?

ulimit -c unlimited

More about enabling core dumps here有关在此处启用核心转储的更多信息

EDIT:编辑:

Ok, I see what is the problem.好的,我知道是什么问题。 Your core file limit is too low.您的核心文件限制太低。 999 bytes (as you set it) is not enough. 999 字节(按照您的设置)是不够的。 Increase it to something reasonable.将其增加到合理的程度。 unlimited is the best parameter.无限是最好的参数。

Use the ulimit command with the -c flag to control the maximum size of core file you want to allow.使用带有-c标志的ulimit命令来控制要允许的核心文件的最大大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM