开发者

core dump not generated

开发者 https://www.devze.com 2023-03-22 09:35 出处:网络
I am working on a PC running CentOS as its operating system. I also work on a embedded with the same OS.

I am working on a PC running CentOS as its operating system. I also work on a embedded with the same OS.

On my PC, I succeeded to create a core dump file on segmentation fault by changing:

    开发者_开发知识库
  1. core pattern
  2. core_uses_pid
  3. ulimit -c unlimited
  4. sysctl -p

But on the embedded system nothing works - the core dump is not generated! What could be the reason?

If it matters, the application that I would like a dump of is written in C++.

What can I do to get a core dump on the embedded system?


I've made a little crash program, and core dump is generated from the crash program but not for the one i need !!! So the problem is not on the O.S, but with the specific program. I discover that we strip -g executable/library files before sending them to the embeded system.I did the same for my crash program, and this one still produce core dump.


Are you certain the kernel on your embedded system supports core dumps? The feature can be disabled in the kernel build (ref), in which case you may have to fake it yourself using something like google-coredumper.


Ok,

i've made a little mistake when i checked ther program on my computer, i've checked it with another signal than on the embeded system. There were still a problem why for the custom signal handler, ther is no core dump. Solution is in one of the links:

Unfortunately, if your application is equipped with a customized signal handler, no core dump will be generated, because it is generated only by the default signal handlers. In case your application has a custom signal handler, disable it before starting to debug, otherwise, no core dump will be generated. Some sources in the Internet mention that restoring the default signal handler inside the signal handler after the exception has occurred, and sending it again in a loopback can trigger a core dump. In the tests I did, it did generate a core dump, but the only thing I saw in the core dump was the code that my handler executed (i.e. the calls to signal and kill), so this did not help me. Perhaps on other platforms this trick works better.

On my platform it do work - another solution would to generate the core dump in signal handler. I hears that gcore can do it, with windows core i got an error incompatibility.


I've seen two sources of possible information, both of which point to the /etc/security/limits.conf file:

Linux Disable Core Dumps - Yes, I know you want to enable core dumps, but this could help in reverse CentOS enabling core dumps - Another source pointing at limits.conf.

0

精彩评论

暂无评论...
验证码 换一张
取 消