core file有时可能在你发生错误时,并没有出现在你的当前文件夹中,发生这种情况的原因有两个,一个是当前终端被设置为不能弹出core file;另一种则是core file被制定了路径。
对于前者,我们可以使用ulimit这条命令对core file文件的大小进行设定。一般默认情况下,core file的大小被设置为了0,这样系统就不dump出core file了。这时用如下命令进行设置:
ulimit -c unlimited
这样便把core file的大小设置为了无限大,同时也可以使用数字来替代unlimited,对core file的上限值做更精确的设定。
core_pattern is used to specify a core dumpfile pattern name:
- max length is 64 characters
- the default value is "core"
- core_pattern is used as a pattern template for the output filename
- certain string patterns (beginning with "%") are substituted with their actual values.
- backward compatibility with core_uses_pid: if core_pattern does not include "%p" (default does not) and core_uses_pid is set, then .PID will be appended to the filename.
- corename format specifiers:
- %p - pid
- %u - uid
- %g - gid
- %s - signal number
- %t - UNIX time of dump
- %h - hostname
- %e - executable filename
- %% - output one "%"
- %<NUL> - "%" is dropped
- %<OTHER> - both are dropped