cht電腦資訊Linux
adm Find login register

file 不知為何看不到 coredump file 是什麼程式產生的

eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
1subject: file 不知為何看不到 coredump file 是什麼程式產生的Promote 1 Bookmark 12008-12-15quote  

以前的 file 可以。 只好改用直接用 strings 看 coredump

$ strings core.27173  | head -3 | tail -1

coredump 主要是用來 debug 用的。如果程式有保留 debug 的 infomation 就可以用

gdb exec_filename core.xxxx 來看程式是當在哪裡。

由於一般人不會想去 debug,所以一般內定是會關閉,可以修改 /etc/profile

修改 or 加入  

ulimit -c unlimited

-c 是用來限制 coredump file 的 size。 如果設定成 0,就不會產生 coredump。

edited: 2
eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
2subject: Promote 1 Bookmark 12010-10-22quote  

如果在程式中想故意造成 coredump 方便 debug,我們可以用 abort() 這個 function

cht電腦資訊Linux
adm Find login register
views:8393