未生成核心转储文件 [英] Core dump file is not generated
问题描述
每次我的应用程序崩溃时,都不会生成核心转储文件.我记得几天前,在另一台服务器上 生成了它.我正在使用 bash 中的屏幕运行应用程序,如下所示:
Every time, my application crash a core dump file is not generated. I remember that few days ago, on another server it was generated. I'm running the app using screen in bash like this:
#!/bin/bash
ulimit -c unlimited
while true; do ./server; done
如您所见,我正在使用 ulimit -c unlimited
如果我想生成核心转储,这很重要,但是当我遇到分段错误时它仍然不会生成它.我怎样才能让它发挥作用?
As you can see I'm using ulimit -c unlimited
which is important if I want to generate a core dump, but it still doesn't generate it, when I got an segmentation fault.
How can I make it work?
推荐答案
确保您的当前目录(在崩溃时 -- server
可能会更改目录)是可写的.如果服务器调用 setuid
,则该目录必须是该用户可写的.
Make sure your current directory (at the time of crash -- server
may change directories) is writable. If the server calls setuid
, the directory has to be writable by that user.
同时检查 /proc/sys/kernel/core_pattern
.这可能会将核心转储重定向到另一个目录,并且 那个 目录必须是可写的.更多信息这里.
Also check /proc/sys/kernel/core_pattern
. That may redirect core dumps to another directory, and that directory must be writable. More info here.
这篇关于未生成核心转储文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!