Why Coredump files is not generating here?

邮差的信 提交于 2019-12-11 02:44:26

问题


I have a sitution here,few days back I was able to see core dumbed file on my target board,I have provided the coredump generation support by adding "ulimit -c unlimited" to my /etc/profile.But then someone told me

This will only take affect for program launched from a login shell, not for processes/services started by systemd,etc/limits would the the proper location for settings these defaults.

So I changed /etc/limits file and added "ulimit -c unlimited" line.but now I could not see Coredumped file

I am running kill -9 $$ to generate segmentation fault and it in turn will generate coredump file as it was doing earlier.

We tried changing "/proc/sys/kernel/core_pattern" file and running ulimit -c unlimited explicitly also but its not working out too

Where we are doing wrong??


回答1:


kill -9 will not generate a core file. The command kill -l gives a list of supported signals. kill -6 or kill -SIGABRT should produce a core file. As well as most other signals such as kill -BUS, kill -SEGV, etc.




回答2:


kill -11 always works for me. 11 is SIGSEGV (invalid memory reference)




回答3:


You have to first off enable user limits settings to ensure that core files can be created.

ulimit -c unlimited

Application user must run as and before you start the application in the same session. This setting is inherited by the application, so what ever the ulimit is set as before starting the application is what the ulimit setting will be for the application (unless a start script changes it).




回答4:


In addition of the other answers, you might also use gcore(1) to generate a core dump of some running process.

But if using kill(1) command (or the underlying kill(2) syscall, e.g. from some ad-hoc program), I recommend using SIGABRT (the signal that abort(3) send to itself after unblocking it), as documented in the signal(7).

Beware, a program can usually forbid core dumping, e.g. by calling setrlimit(2) with RLIMIT_CORE set to 0 or handling or ignoring some signals (with e.g. sigaction(2)...).



来源:https://stackoverflow.com/questions/18354686/why-coredump-files-is-not-generating-here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!